id stringlengths 3 21 | category stringclasses 3
values | source stringclasses 2
values | difficulty stringclasses 1
value | statement stringlengths 78 251 | primary_function stringlengths 2 24 | signature_aliases listlengths 0 3 | selection_rationale stringlengths 19 77 | timeout_s float64 5 5 | tests listlengths 1 5 |
|---|---|---|---|---|---|---|---|---|---|
fib | dp | internal | easy | Return the n-th Fibonacci number where fib(0)=0, fib(1)=1. Implement a function fib(n: int) -> int. Use O(n) time and O(1) space. | fib | [
"fibonacci",
"fib_n"
] | Canonical DP recurrence; tests base cases and iterative form. | 5 | [
{
"args": "[0]",
"expected": "0",
"call": null,
"description": "n=0 base case",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[1]",
"expected": "1",
"call": null,
"description": "n=1 base case",
"kind": "deterministic",
"has_custom_judge": false... |
climb_stairs | dp | internal | easy | You are climbing a staircase. It takes n steps to reach the top. Each time you can climb 1 or 2 steps. Return the number of distinct ways. Implement climbStairs(n: int) -> int. | climbStairs | [
"climb_stairs",
"count_ways",
"ways_to_climb"
] | Fibonacci-equivalent DP under a different name; tests recurrence recognition. | 5 | [
{
"args": "[1]",
"expected": "1",
"call": null,
"description": "n=1",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[2]",
"expected": "2",
"call": null,
"description": "n=2",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args"... |
coin_change | dp | internal | easy | Given coins (list of int) and an integer amount, return the minimum number of coins to make ``amount`` or -1 if impossible. Implement coinChange(coins, amount). | coinChange | [
"coin_change",
"min_coins"
] | Classic unbounded-knapsack DP; tests unreachable-state handling. | 5 | [
{
"args": "[[1, 2, 5], 11]",
"expected": "3",
"call": null,
"description": "standard",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[2], 3]",
"expected": "-1",
"call": null,
"description": "unreachable",
"kind": "deterministic",
"has_custom_ju... |
lcs | dp | internal | easy | Return the length of the longest common subsequence of two strings a and b. Implement longestCommonSubsequence(a: str, b: str) -> int. | longestCommonSubsequence | [
"lcs",
"longest_common_subsequence"
] | Two-string DP; common LLM failure: confusing subsequence with substring. | 5 | [
{
"args": "[\"abcde\", \"ace\"]",
"expected": "3",
"call": null,
"description": "standard",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[\"abc\", \"abc\"]",
"expected": "3",
"call": null,
"description": "identical",
"kind": "deterministic",
"h... |
house_robber | dp | internal | easy | Given an array nums of non-negative ints, return the max sum you can collect without picking adjacent elements. Implement rob(nums: list[int]) -> int. | rob | [
"house_robber",
"max_rob"
] | 1D DP with adjacency constraint; tests linear scan formulation. | 5 | [
{
"args": "[[1, 2, 3, 1]]",
"expected": "4",
"call": null,
"description": "standard",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[2, 7, 9, 3, 1]]",
"expected": "12",
"call": null,
"description": "standard",
"kind": "deterministic",
"has_cust... |
min_cost_path | dp | internal | easy | Given an m x n grid of non-negative ints, return the minimum path sum from top-left to bottom-right moving only right or down. Implement minPathSum(grid: list[list[int]]) -> int. | minPathSum | [
"min_path_sum",
"min_cost_path"
] | 2D DP on a grid; tests indexing and boundary handling. | 5 | [
{
"args": "[[[1, 3, 1], [1, 5, 1], [4, 2, 1]]]",
"expected": "7",
"call": null,
"description": "standard",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[[1, 2, 3], [4, 5, 6]]]",
"expected": "12",
"call": null,
"description": "rectangle",
"kind": "... |
lis | dp | internal | easy | Given an integer array nums, return the length of the longest strictly increasing subsequence. Implement lengthOfLIS(nums) -> int. | lengthOfLIS | [
"lis",
"longest_increasing_subsequence"
] | O(n log n) preferred; tests common O(n^2) baseline against optimal. | 5 | [
{
"args": "[[10, 9, 2, 5, 3, 7, 101, 18]]",
"expected": "4",
"call": null,
"description": "standard",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[0, 1, 0, 3, 2, 3]]",
"expected": "4",
"call": null,
"description": "repeats",
"kind": "deterministi... |
rod_cutting | dp | internal | easy | Given prices[i] = price of a rod of length i+1 and an integer n, return the max obtainable revenue by cutting the rod of length n. Implement rodCutting(prices, n). | rodCutting | [
"rod_cutting",
"max_revenue"
] | Unbounded knapsack pattern with index off-by-one risk. | 5 | [
{
"args": "[[1, 5, 8, 9, 10, 17, 17, 20], 8]",
"expected": "22",
"call": null,
"description": "textbook",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[3, 5, 8, 9, 10, 17, 17, 20], 8]",
"expected": "24",
"call": null,
"description": "alt prices",
... |
matrix_chain | dp | internal | easy | Given an array p of length n where matrix A_i has dimensions p[i-1] x p[i], return the minimum number of scalar multiplications. Implement matrixChainOrder(p: list[int]) -> int. | matrixChainOrder | [
"matrix_chain",
"matrix_chain_order"
] | Interval DP; tests nested-loop formulation. | 5 | [
{
"args": "[[1, 2, 3, 4]]",
"expected": "18",
"call": null,
"description": "3 matrices",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[10, 20, 30, 40, 30]]",
"expected": "30000",
"call": null,
"description": "textbook 1",
"kind": "deterministic",
... |
subset_sum | dp | apps-introductory | easy | Given a list of positive ints nums and a target T, return True iff some subset of nums sums to T. Implement subsetSum(nums, target) -> bool. | subsetSum | [
"subset_sum",
"can_partition"
] | APPS-style decision DP; tests boolean DP table. | 5 | [
{
"args": "[[1, 2, 3, 7], 6]",
"expected": "true",
"call": null,
"description": "standard",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[1, 2, 7, 1, 5], 10]",
"expected": "true",
"call": null,
"description": "standard",
"kind": "deterministic",
... |
topo_sort | graph | internal | easy | Given the number of tasks N and a list of dependency pairs prerequisites where [a, b] means b must finish before a, return any valid order or [] if impossible. Implement findOrder(numCourses: int, prerequisites: list[list[int]]) -> list[int]. | findOrder | [
"topological_sort",
"course_order",
"topo_sort"
] | Cycle detection + topo order; common LLM failure: missing cycle check. | 5 | [
{
"args": "[4, [[1, 0], [2, 1], [3, 2]]]",
"expected": "[0, 1, 2, 3]",
"call": null,
"description": "linear chain",
"kind": "deterministic",
"has_custom_judge": true
},
{
"args": "[2, [[0, 1], [1, 0]]]",
"expected": "[]",
"call": null,
"description": "cycle",
"kind": ... |
cycle_detect | graph | internal | easy | Given an undirected graph as an adjacency list adj (list of list of int), return True iff it contains a cycle. Implement hasCycle(adj: list[list[int]]) -> bool. | hasCycle | [
"has_cycle",
"detect_cycle"
] | Undirected cycle detection (parent-tracking DFS). | 5 | [
{
"args": "[[[1], [0, 2], [1]]]",
"expected": "false",
"call": null,
"description": "path",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[[1, 2], [0, 2], [0, 1]]]",
"expected": "true",
"call": null,
"description": "triangle",
"kind": "deterministi... |
bfs | graph | internal | easy | Given an adjacency list adj and a start node s, return the BFS visit order from s (ties broken by neighbour list order). Implement bfs(adj: list[list[int]], s: int) -> list[int]. | bfs | [
"breadth_first_search"
] | BFS basics; tests queue usage and visited set. | 5 | [
{
"args": "[[[1, 2], [0, 3], [0], [1]], 0]",
"expected": "[0, 1, 2, 3]",
"call": null,
"description": "tree",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[[]], 0]",
"expected": "[0]",
"call": null,
"description": "single",
"kind": "deterministic"... |
dfs | graph | internal | easy | Given an adjacency list adj and a start node s, return the DFS preorder visit order (recursive, neighbour order respected). Implement dfs(adj: list[list[int]], s: int) -> list[int]. | dfs | [
"depth_first_search"
] | DFS basics; tests recursion + visited. | 5 | [
{
"args": "[[[1, 2], [0, 3], [0], [1]], 0]",
"expected": "[0, 1, 3, 2]",
"call": null,
"description": "tree",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[[]], 0]",
"expected": "[0]",
"call": null,
"description": "single",
"kind": "deterministic"... |
dijkstra | graph | internal | easy | Given a weighted graph as adj where adj[u] = list of (v, w), and a source s, return a list dist of length n with shortest distances from s (use float('inf') for unreachable). Implement dijkstra(adj: list[list[tuple[int, int]]], s: int) -> list[float]. | dijkstra | [
"shortest_path",
"single_source_shortest"
] | Priority queue + relaxation; common LLM failure: missing heap usage. | 5 | [
{
"args": "[[[[1, 4], [2, 1]], [[2, 2], [3, 5]], [[1, 2], [3, 8]], []], 0]",
"expected": "[0, 3, 1, 8]",
"call": null,
"description": "textbook",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[[]], 0]",
"expected": "[0]",
"call": null,
"description": "... |
bellman_ford | graph | internal | easy | Given n nodes and a list of weighted edges (u, v, w) (directed), return shortest distances from source s, or None if a negative cycle is reachable. Implement bellmanFord(n, edges, s) -> list | None. | bellmanFord | [
"bellman_ford"
] | Tests negative-cycle detection. | 5 | [
{
"args": "[3, [[0, 1, 1], [1, 2, 2], [0, 2, 5]], 0]",
"expected": "[0, 1, 3]",
"call": null,
"description": "",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[3, [[0, 1, 1], [1, 2, -1], [2, 0, -1]], 0]",
"expected": "null",
"call": null,
"description":... |
connected_components | graph | internal | easy | Given an adjacency list adj of an undirected graph, return the number of connected components. Implement countComponents(adj) -> int. | countComponents | [
"count_components",
"connected_components"
] | Tests union-find or DFS sweep. | 5 | [
{
"args": "[[[1], [0], [3], [2]]]",
"expected": "2",
"call": null,
"description": "",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[[]]]",
"expected": "1",
"call": null,
"description": "",
"kind": "deterministic",
"has_custom_judge": false
}... |
scc | graph | internal | easy | Given a directed graph as adjacency list adj, return the number of strongly connected components. Implement countSCC(adj) -> int. | countSCC | [
"count_scc",
"strongly_connected_components"
] | Kosaraju / Tarjan; tests two-pass DFS. | 5 | [
{
"args": "[[[1], [2], [0]]]",
"expected": "1",
"call": null,
"description": "single SCC",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[[1], [], []]]",
"expected": "3",
"call": null,
"description": "path 3",
"kind": "deterministic",
"has_cust... |
unweighted_shortest | graph | internal | easy | Given an adjacency list adj and source s, return shortest hop counts from s. Use -1 for unreachable. Implement shortestHops(adj, s) -> list[int]. | shortestHops | [
"shortest_hops",
"bfs_distances"
] | Tests BFS distance variant. | 5 | [
{
"args": "[[[1], [0, 2], [1, 3], [2]], 0]",
"expected": "[0, 1, 2, 3]",
"call": null,
"description": "",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[[]], 0]",
"expected": "[0]",
"call": null,
"description": "",
"kind": "deterministic",
"has... |
grid_shortest_path | graph | apps-introductory | easy | Given an m x n binary grid where 0 is passable and 1 is a wall, return the length of the shortest path from (0,0) to (m-1,n-1) using 4-neighbour moves, or -1 if unreachable. Implement shortestPath(grid) -> int. | shortestPath | [
"shortest_path_grid"
] | APPS-style grid BFS; tests boundary + visited. | 5 | [
{
"args": "[[[0, 0, 0], [1, 1, 0], [0, 0, 0]]]",
"expected": "5",
"call": null,
"description": "",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[[[0]]]",
"expected": "1",
"call": null,
"description": "",
"kind": "deterministic",
"has_custom_jud... |
lru_cache | ds | internal | easy | Implement an LRU cache class LRUCache with __init__(self, capacity: int), get(key) -> int (returns -1 if absent), and put(key, value). Capacity is a positive int. | LRUCache | [] | Class with O(1) get/put; common LLM failure: incorrect eviction. | 5 | [
{
"args": "[]",
"expected": "[[null, null, 1, null, -1, null, -1, 3, 4]]",
"call": "[(lambda c: ([c.put(1,1), c.put(2,2), c.get(1), c.put(3,3), c.get(2), c.put(4,4), c.get(1), c.get(3), c.get(4)]))(LRUCache(2))]",
"description": "textbook",
"kind": "deterministic",
"has_custom_judge": false
... |
min_stack | ds | internal | easy | Implement a stack class MinStack supporting push(x), pop(), top(), getMin() all in O(1). | MinStack | [] | Tests auxiliary-stack pattern. | 5 | [
{
"args": "[]",
"expected": "[[null, null, null, -3, null, 0, -2]]",
"call": "[(lambda s: ([s.push(-2), s.push(0), s.push(-3), s.getMin(), s.pop(), s.top(), s.getMin()]))(MinStack())]",
"description": "textbook",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[]",
... |
stack_using_queue | ds | internal | easy | Implement class MyStack with push(x), pop(), top(), empty() using only queues. | MyStack | [] | Tests queue-based simulation of stack semantics. | 5 | [
{
"args": "[]",
"expected": "[[null, null, 2, 2, false]]",
"call": "[(lambda s: ([s.push(1), s.push(2), s.top(), s.pop(), s.empty()]))(MyStack())]",
"description": "basic",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[]",
"expected": "[[null, 1, true]]",
... |
reverse_linked_list | ds | internal | easy | Define class ListNode(self, val=0, next=None) and a function reverseList(head: ListNode | None) -> ListNode | None that reverses the list. Also provide a helper to_list(head) -> list[int] that materializes a linked list. | reverseList | [
"reverse_list"
] | Tests pointer-rewiring; LLM failure: lost head pointer. | 5 | [
{
"args": "[]",
"expected": "[[], [1], [3, 2, 1]]",
"call": "(lambda: ([to_list(reverseList(None)),to_list(reverseList(ListNode(1))),to_list(reverseList(ListNode(1, ListNode(2, ListNode(3))))),]))()",
"description": "three cases",
"kind": "deterministic",
"has_custom_judge": false
}
] |
binary_tree_traversal | ds | internal | easy | Define class TreeNode(self, val=0, left=None, right=None) and a function inorder(root) -> list[int] that returns the inorder traversal. | inorder | [] | Tests recursive traversal. | 5 | [
{
"args": "[]",
"expected": "[[], [1], [2, 1, 3]]",
"call": "(lambda: (inorder(None),inorder(TreeNode(1)),inorder(TreeNode(1, TreeNode(2), TreeNode(3)))))()",
"description": "three trees",
"kind": "deterministic",
"has_custom_judge": false
}
] |
priority_queue | ds | internal | easy | Implement class PQ with push(x), pop() -> smallest, top() -> smallest, empty(). | PQ | [] | Min-heap semantics. | 5 | [
{
"args": "[]",
"expected": "[null, null, null, 1, 1, 2, false]",
"call": "(lambda q: ([q.push(3), q.push(1), q.push(2), q.top(), q.pop(), q.pop(), q.empty()]))(PQ())",
"description": "basic",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[]",
"expected": "true... |
heapify | ds | internal | easy | Implement heapify(arr: list[int]) -> None that converts arr into a min-heap in-place. | heapify | [
"build_heap"
] | Tests in-place heap construction. | 5 | [
{
"args": "[]",
"expected": "[null, true]",
"call": "(lambda a: (heapify(a), a == sorted(a) or all(a[i] <= a[2*i+1] for i in range(len(a)) if 2*i+1 < len(a)) and all(a[i] <= a[2*i+2] for i in range(len(a)) if 2*i+2 < len(a))))([4,1,3,2,16,9,10,14,8,7])",
"description": "textbook",
"kind": "deter... |
avl | ds | internal | easy | Implement class AVL with insert(key) and inorder() -> list[int] that returns the sorted keys after insertions while maintaining AVL balance. | AVL | [] | Balanced BST; tests rotation correctness. | 5 | [
{
"args": "[]",
"expected": "[10, 20, 25, 30, 40, 50]",
"call": "(lambda t: ([t.insert(k) for k in [10,20,30,40,50,25]] and t.inorder()))(AVL())",
"description": "balanced inorder",
"kind": "deterministic",
"has_custom_judge": false
}
] |
adj_list_construct | ds | internal | easy | Given n vertices and a list of undirected edges, return an adjacency list (list of sorted neighbour lists). Implement adjList(n, edges). | adjList | [
"adjacency_list"
] | Tests data-structure assembly. | 5 | [
{
"args": "[3, [[0, 1], [0, 2]]]",
"expected": "[[1, 2], [0], [0]]",
"call": null,
"description": "",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[1, []]",
"expected": "[[]]",
"call": null,
"description": "",
"kind": "deterministic",
"has_cust... |
valid_parentheses | ds | apps-introductory | easy | Given a string of '()[]{}', return True iff brackets close in correct order. Implement isValid(s: str) -> bool. | isValid | [
"is_valid",
"valid_parentheses"
] | APPS-style stack; classic textbook. | 5 | [
{
"args": "[\"()\"]",
"expected": "true",
"call": null,
"description": "",
"kind": "deterministic",
"has_custom_judge": false
},
{
"args": "[\"()[]{}\"]",
"expected": "true",
"call": null,
"description": "",
"kind": "deterministic",
"has_custom_judge": false
},
... |
ExecuGraph Internal-30 Benchmark
Anonymized for double-blind review. Author, affiliation, and citation metadata are withheld and will be released on acceptance.
A curated suite of 30 data-structures-and-algorithms (DSA) problems used as the headline benchmark for the ExecuGraph framework. Each problem ships with an unambiguous natural-language specification, the target function signature (and accepted aliases), a documented selection rationale, and a set of deterministic test cases (boundary, canonical, and stress).
Composition
| Category | Problems | Notes |
|---|---|---|
Dynamic Programming (dp) |
10 | Fibonacci, coin change, LCS, LIS, edit-distance-style recurrences |
Graph Algorithms (graph) |
10 | BFS/DFS, topological sort, Dijkstra, Bellman–Ford, SCC, connectivity |
Data Structures (ds) |
10 | LRU cache, min-stack, heap/priority queue, AVL, linked-list, traversal |
- 27 problems are originally designed; 3 are adapted from the
APPS-introductory partition (marked
source = "apps-…"). - 30 problems, 125 deterministic test cases in total.
Fields
Each line in internal30.jsonl is one problem:
| Field | Type | Description |
|---|---|---|
id |
string | Stable problem identifier (e.g. topo_sort) |
category |
string | dp | graph | ds |
source |
string | internal or apps-<id> |
difficulty |
string | easy | medium | hard |
statement |
string | Self-contained problem specification |
primary_function |
string | Expected function name |
signature_aliases |
list[string] | Accepted alternative function names |
selection_rationale |
string | Why the problem is included |
timeout_s |
float | Per-execution wall-clock budget |
tests |
list[object] | Test cases: {args, expected, call, description, kind, has_custom_judge} |
Within each test, args and expected are JSON-encoded strings (their
native types vary between int, list, bool, … across problems, so they are
serialized for a uniform, Arrow-loadable schema). Parse them back with
json.loads. A small number of graph problems whose correct output is not
uniquely ordered (e.g. topological sort) use a custom equality judge in the
reference harness; those tests are flagged with has_custom_judge = true. For
portable use, treat them as exact-match or supply an order-insensitive
comparison.
Usage
import json
from datasets import load_dataset
ds = load_dataset("anonymousreview111/execugraph-internal30", split="train")
p = ds[0]
print(p["id"], p["category"], len(p["tests"]))
args = json.loads(p["tests"][0]["args"]) # -> e.g. [10]
expected = json.loads(p["tests"][0]["expected"]) # -> e.g. 55
Reproducibility
This dataset is regenerated from the framework's single source of truth
(execugraph/benchmarks/internal30.py) via scripts/export_dataset.py in the
accompanying (anonymized) code repository. Every numeric claim in the paper's
internal-30 tables is reproducible from that code together with this dataset.
License
Released under the Apache-2.0 license.
- Downloads last month
- -