row_uuid
string
dataset_uuid
string
dataset_name
string
dataset_description
string
keywords
list
preferred_score
string
metrics
list
question_template
string
question_template_input
string
answer
string
compute_function
string
image
image
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-15
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 1]], "start": [6, 8], "end": [3, 5]}
10
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-9
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[1, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 1, 0, 0, 1], [1, 1, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 1], [0, 1, 1, 0, 1, 0, 1, 0, 1, 0]], "start": [6, 6], "end": [0, 2]}
10
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-14
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[1, 1, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 1, 1, 0, 1, 0, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 1, 0, 1]], "start": [3, 5], "end": [7, 6]}
9
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-7
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 1, 0, 0, 1]], "start": [6, 3], "end": [6, 6]}
5
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-12
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 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, 1, 0, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 1], [1, 0, 1, 0, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 1, 1, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0]], "start": [7, 3], "end": [0, 7]}
11
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-10
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[0, 0, 1, 1, 1, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 1, 0], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0], [1, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0, 0, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]], "start": [1, 0], "end": [2, 2]}
3
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-6
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[0, 0, 1, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 1, 0, 0], [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, 1, 0, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 1, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 0]], "start": [8, 6], "end": [4, 5]}
5
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-19
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[0, 1, 0, 0, 1, 1, 0, 0, 0, 1], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 1, 1, 0, 1, 1, 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, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0]], "start": [9, 8], "end": [0, 7]}
12
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-3
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[1, 0, 0, 0, 1, 0, 0, 1, 1, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 1, 1, 0, 1]], "start": [1, 1], "end": [9, 1]}
18
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-0
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 0, 0, 1, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1]], "start": [8, 6], "end": [2, 3]}
13
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-16
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[1, 1, 1, 0, 0, 1, 0, 0, 0, 0], [1, 1, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 1], [1, 1, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0, 0, 1, 0]], "start": [6, 9], "end": [9, 7]}
5
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-5
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[0, 1, 0, 0, 1, 0, 0, 1, 1, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 1, 0], [1, 0, 0, 0, 1, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 1, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], "start": [3, 1], "end": [6, 2]}
4
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-11
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 1, 1, 0], [1, 1, 0, 0, 1, 0, 1, 1, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 1, 1]], "start": [3, 9], "end": [3, 3]}
8
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-18
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 1, 1, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 1, 1]], "start": [6, 6], "end": [7, 5]}
2
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10-2
401d4e49-afb8-4fad-b0b6-1a55c9da1a53-multimodal-grid10
diffusion_path_multimodal_grid10
Find shortest path on a 10x10 grid (multimodal version).
[ "computer science", "pathfinding", "BFS", "grid", "algorithmic reasoning", "materials science", "diffusion", "multimodal" ]
exact_str_match
[ "exact_str_match" ]
The image {{entry1}} shows a grid representing a crystal surface where 0 is a walkable site and 1 is an impassable defect. An atom must move from the start coordinate {{start}} to the end coordinate {{end}}. What is the length of the shortest possible path? Movement is restricted to up, down, left, or right steps. If no path exists, the answer is -1.
{"grid": [[0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0, 1, 0], [0, 1, 1, 0, 1, 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], [1, 1, 0, 1, 1, 0, 0, 0, 1, 1], [1, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 0, 1]], "start": [4, 9], "end": [0, 1]}
12
import collections def calculate_solution(template_input: dict) -> str: """ Finds the length of the shortest path in a grid from start to end using the Breadth-First Search (BFS) algorithm. """ grid = template_input['grid'] start = tuple(template_input['start']) end = tuple(template_input['end']) rows, cols = len(grid), len(grid[0]) # Check if start or end are on an obstacle if grid[start[0]][start[1]] == 1 or grid[end[0]][end[1]] == 1: return "-1" # Queue for BFS: (row, col, distance) queue = collections.deque([(start[0], start[1], 0)]) # Set to keep track of visited cells visited = {start} while queue: r, c, dist = queue.popleft() # If we reached the end, return the distance if (r, c) == end: return str(dist) # Explore neighbors (up, down, left, right) for dr, dc in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nr, nc = r + dr, c + dc # Check for valid next step if (0 <= nr < rows and 0 <= nc < cols and grid[nr][nc] == 0 and (nr, nc) not in visited): visited.add((nr, nc)) queue.append((nr, nc, dist + 1)) # If the queue empties and we haven't found the end, it's unreachable return "-1"