diff_sorted_id
stringclasses
105 values
problem_statement
stringlengths
778
1.74k
problem_type
stringclasses
11 values
problem_category
stringclasses
5 values
relative_diff_score
stringclasses
35 values
opt_solution
stringlengths
24
474
opt_solution_cost
stringlengths
1
4
opt_solution_compute_t
stringlengths
14
20
solution_depth
stringclasses
40 values
max_successor_states
stringclasses
51 values
num_vars_per_state
stringclasses
47 values
is_feasible_args
stringlengths
43
1.24k
is_correct_args
stringlengths
43
1.26k
A*_args
stringlengths
46
1.27k
37
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Red', 'Blue', 'Red'], ['Red', 'Blue', 'Green', 'Blue'], ['Green', 'Green', 'Blue', 'Green']]
color_sorting
sorting
8
[[0, 1], [0, 1], [0, 2], [1, 0], [1, 0], [1, 0], [1, 2], [1, 0], [2, 1], [2, 1], [2, 0], [2, 0], [2, 1], [0, 2], [0, 2], [0, 2]]
16
1.3703632354736328
16
6
12
[[["Red", "Red", "Blue", "Red"], ["Red", "Blue", "Green", "Blue"], ["Green", "Green", "Blue", "Green"]], 7]
[[["Red", "Red", "Blue", "Red"], ["Red", "Blue", "Green", "Blue"], ["Green", "Green", "Blue", "Green"]], 7]
["[['Red', 'Red', 'Blue', 'Red'], ['Red', 'Blue', 'Green', 'Blue'], ['Green', 'Green', 'Blue', 'Green']]", "7"]
37
We have a 3x3 numerical grid, with numbers ranging from 48 to 101 (48 included in the range but 101 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['57' 'x' '86'] ['x' '75' 'x'] ['x' '76' '90']]
consecutive_grid
underdetermined_system
8
[[0, 1, 58], [1, 0, 49], [1, 2, 87], [2, 0, 48]]
686
0.38043832778930664
4
53
9
["[['57', '', '86'], ['', '75', ''], ['', '76', '90']]", 48, 101]
["[['57', '', '86'], ['', '75', ''], ['', '76', '90']]", 48, 101]
["[['57', '', '86'], ['', '75', ''], ['', '76', '90']]", "48", "101"]
37
In the magic square problem, a 3x3 grid is filled with unique integers ranging from 40 to 89. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 150, and sum of row 1 must be 209. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 169. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['48' 'x' 'x'] ['x' 'x' 'x'] ['x' '49' 'x']]
magic_square
underdetermined_system
7
[[0, 1, 40], [0, 2, 42], [1, 0, 60], [1, 1, 61], [1, 2, 88], [2, 0, 66], [2, 2, 41]]
495
6.065331697463989
7
39
9
["[['48', '', ''], ['', '', ''], ['', '49', '']]", 3, 40, 89]
["[['48', '', ''], ['', '', ''], ['', '49', '']]", 40, 89, [1, 2], [1, 2], [150], [209], 169]
["[['48', '', ''], ['', '', ''], ['', '49', '']]", "40", "89", "[None, 150, None]", "[None, 209, None]", "169"]
37
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 3, 1: 2, 2: 1, 3: 7, 4: 5, 5: 5, 6: 6, 7: 4}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], ['Blue', 'Black', 'Blue', 'Yellow', 'Red'], ['Red', 'Green', 'Black', 'Green', 'Black'], [], ['Red', 'Red', 'Green', 'Yellow', 'Yellow'], [], [], ['Blue', 'Yellow', 'Green', 'Black', 'Blue']]
restricted_sorting
sorting
2
[[2, 0], [2, 5], [2, 3], [7, 6], [2, 5], [4, 0], [4, 0], [4, 5], [7, 4], [7, 5], [7, 2], [1, 7], [1, 2], [1, 7], [1, 4], [6, 7], [1, 0], [3, 2]]
70
8.884233713150024
18
56
20
[[[], ["Blue", "Black", "Blue", "Yellow", "Red"], ["Red", "Green", "Black", "Green", "Black"], [], ["Red", "Red", "Green", "Yellow", "Yellow"], [], [], ["Blue", "Yellow", "Green", "Black", "Blue"]], 5, {"0": 3, "1": 2, "2": 1, "3": 7, "4": 5, "5": 5, "6": 6, "7": 4}]
[[[], ["Blue", "Black", "Blue", "Yellow", "Red"], ["Red", "Green", "Black", "Green", "Black"], [], ["Red", "Red", "Green", "Yellow", "Yellow"], [], [], ["Blue", "Yellow", "Green", "Black", "Blue"]], 5, {"0": 3, "1": 2, "2": 1, "3": 7, "4": 5, "5": 5, "6": 6, "7": 4}, 4]
["[[], ['Blue', 'Black', 'Blue', 'Yellow', 'Red'], ['Red', 'Green', 'Black', 'Green', 'Black'], [], ['Red', 'Red', 'Green', 'Yellow', 'Yellow'], [], [], ['Blue', 'Yellow', 'Green', 'Black', 'Blue']]", "{0: 3, 1: 2, 2: 1, 3: 7, 4: 5, 5: 5, 6: 6, 7: 4}", "5", "4"]
37
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (7, 5) to his destination workshop at index (1, 0), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 6, and district 3 covering rows 7 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [15 x 12 x 9 19 x x 13 x 16] [14 6 3 18 x 8 18 x x x x] [16 10 9 4 9 5 15 4 x x 2] [5 9 x 8 1 15 7 15 x x x] [6 x 3 x 4 6 6 19 x 16 13] [17 x 11 5 18 11 18 x x 10 19] [6 3 x x 10 18 2 x x x x] [x x 4 2 x 13 7 x 3 19 16] [x 1 10 x 15 x 2 x 1 7 10] [x x x 4 7 x 7 x x 6 x] [16 x 15 3 x 8 x x 13 x 14]
traffic
pathfinding
3
[[7, 5], [6, 5], [5, 5], [4, 5], [4, 4], [3, 4], [3, 3], [2, 3], [2, 2], [1, 2], [1, 1], [1, 0]]
84
0.0287020206451416
12
4
4
[[["15", "x", "12", "x", "9", "19", "x", "x", "13", "x", "16"], ["14", "6", "3", "18", "x", "8", "18", "x", "x", "x", "x"], ["16", "10", "9", "4", "9", "5", "15", "4", "x", "x", "2"], ["5", "9", "x", "8", "1", "15", "7", "15", "x", "x", "x"], ["6", "x", "3", "x", "4", "6", "6", "19", "x", "16", "13"], ["17", "x", "11", "5", "18", "11", "18", "x", "x", "10", "19"], ["6", "3", "x", "x", "10", "18", "2", "x", "x", "x", "x"], ["x", "x", "4", "2", "x", "13", "7", "x", "3", "19", "16"], ["x", "1", "10", "x", "15", "x", "2", "x", "1", "7", "10"], ["x", "x", "x", "4", "7", "x", "7", "x", "x", "6", "x"], ["16", "x", "15", "3", "x", "8", "x", "x", "13", "x", "14"]]]
[[["15", "x", "12", "x", "9", "19", "x", "x", "13", "x", "16"], ["14", "6", "3", "18", "x", "8", "18", "x", "x", "x", "x"], ["16", "10", "9", "4", "9", "5", "15", "4", "x", "x", "2"], ["5", "9", "x", "8", "1", "15", "7", "15", "x", "x", "x"], ["6", "x", "3", "x", "4", "6", "6", "19", "x", "16", "13"], ["17", "x", "11", "5", "18", "11", "18", "x", "x", "10", "19"], ["6", "3", "x", "x", "10", "18", "2", "x", "x", "x", "x"], ["x", "x", "4", "2", "x", "13", "7", "x", "3", "19", "16"], ["x", "1", "10", "x", "15", "x", "2", "x", "1", "7", "10"], ["x", "x", "x", "4", "7", "x", "7", "x", "x", "6", "x"], ["16", "x", "15", "3", "x", "8", "x", "x", "13", "x", "14"]], [7, 5], [1, 0], 1, 6]
["[['15', 'x', '12', 'x', '9', '19', 'x', 'x', '13', 'x', '16'], ['14', '6', '3', '18', 'x', '8', '18', 'x', 'x', 'x', 'x'], ['16', '10', '9', '4', '9', '5', '15', '4', 'x', 'x', '2'], ['5', '9', 'x', '8', '1', '15', '7', '15', 'x', 'x', 'x'], ['6', 'x', '3', 'x', '4', '6', '6', '19', 'x', '16', '13'], ['17', 'x', '11', '5', '18', '11', '18', 'x', 'x', '10', '19'], ['6', '3', 'x', 'x', '10', '18', '2', 'x', 'x', 'x', 'x'], ['x', 'x', '4', '2', 'x', '13', '7', 'x', '3', '19', '16'], ['x', '1', '10', 'x', '15', 'x', '2', 'x', '1', '7', '10'], ['x', 'x', 'x', '4', '7', 'x', '7', 'x', 'x', '6', 'x'], ['16', 'x', '15', '3', 'x', '8', 'x', 'x', '13', 'x', '14']]", "(7, 5)", "(1, 0)", "1", "6"]
37
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (0, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (6, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 0 1 0 0 1 0 1 0 0 0 0 1 0 0 1 1 1 1 0 0 1 1 1 0 1 0 0 1 0 0 1 1 1 0 1 0 0 0 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 0 0 0 0 1 1 1 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 1 0 0 0 1 0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 1 1 0 0 1 1 1 0 1 1 1 0 1 1
trampoline_matrix
pathfinding
11
[[0, 9], [1, 9], [2, 8], [3, 7], [3, 6], [3, 5], [3, 4], [4, 4], [5, 3], [5, 2], [5, 1], [5, 0], [6, 0]]
13
0.02647542953491211
13
8
2
["[[1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0], [1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1], [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0], [1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1]]", 3]
["[[1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0], [1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1], [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0], [1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1]]", [0, 9], [6, 0], 3]
["[[1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0], [1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1], [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0], [1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1]]", "(0, 9)", "(6, 0)", "3"]
37
Given 9 labeled water jugs with capacities 19, 122, 104, 145, 38, 141, 126, 82, 37, 33 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 256, 399, 410 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 145, 3], ["+", 145, 3], ["+", 38, 3], ["+", 82, 3], ["+", 122, 2], ["+", 122, 2], ["+", 33, 2], ["+", 122, 2], ["+", 82, 1], ["+", 141, 1], ["+", 33, 1]]
11
0.04917335510253906
11
60
3
[[19, 122, 104, 145, 38, 141, 126, 82, 37, 33], [256, 399, 410]]
[[19, 122, 104, 145, 38, 141, 126, 82, 37, 33], [256, 399, 410]]
["[19, 122, 104, 145, 38, 141, 126, 82, 37, 33]", "[256, 399, 410]"]
38
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[75, 59, 74, 73], ['_', 79, 26, 17], [64, 29, 47, 39]]
8_puzzle
puzzle
4
[79, 26, 17, 73, 74, 59, 75, 79, 64, 29, 47, 17, 59, 74, 73, 39, 17, 47, 26, 59, 47, 17]
22
0.22814416885375977
22
4
12
[[[75, 59, 74, 73], ["_", 79, 26, 17], [64, 29, 47, 39]]]
[[[75, 59, 74, 73], ["_", 79, 26, 17], [64, 29, 47, 39]]]
["[[75, 59, 74, 73], ['_', 79, 26, 17], [64, 29, 47, 39]]"]
38
In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: nieve, astely, oecist, mewler The initial board: [['s', 'n', '_', 'e', 'y', 'e'], ['a', 'e', 't', 'i', 'l', 'e'], ['o', 'e', 'c', 'i', 'v', 't'], ['m', 'l', 'w', 's', 'e', 'r']]
8_puzzle_words
puzzle
3
["down-left", "down-right", "down-left", "up-left", "up-right", "up-right", "down-right", "down-right", "up-right", "up-left", "down-left", "down-right", "down-left", "up-left", "up-left", "down-left", "down-right", "up-right", "up-left", "up-left"]
20
0.39636731147766113
20
4
24
[[["s", "n", "_", "e", "y", "e"], ["a", "e", "t", "i", "l", "e"], ["o", "e", "c", "i", "v", "t"], ["m", "l", "w", "s", "e", "r"]]]
[[["s", "n", "_", "e", "y", "e"], ["a", "e", "t", "i", "l", "e"], ["o", "e", "c", "i", "v", "t"], ["m", "l", "w", "s", "e", "r"]], ["nieve", "astely", "oecist", "mewler"]]
["[['s', 'n', '_', 'e', 'y', 'e'], ['a', 'e', 't', 'i', 'l', 'e'], ['o', 'e', 'c', 'i', 'v', 't'], ['m', 'l', 'w', 's', 'e', 'r']]", "['nieve', 'astely', 'oecist', 'mewler']"]
38
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'Q'. Our task is to visit city V and city F excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from F and V, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. S X Y Q O R D V H J F C S 0 1 0 0 0 0 0 1 0 0 1 1 X 0 0 0 0 1 0 1 0 0 0 0 0 Y 1 1 0 0 0 1 0 0 0 0 1 0 Q 0 1 0 0 0 0 1 0 0 0 0 0 O 0 0 0 0 0 1 0 1 1 0 0 0 R 0 1 0 0 0 0 0 1 0 0 0 1 D 1 0 1 0 0 0 0 0 1 0 0 0 V 0 0 1 0 0 1 1 0 0 0 0 1 H 1 0 1 1 0 0 0 1 0 0 0 1 J 0 1 1 0 0 1 0 0 1 0 0 0 F 0 0 1 0 0 0 1 1 0 1 0 0 C 1 1 0 0 0 0 0 1 0 1 0 0
city_directed_graph
pathfinding
12
["Q", "D", "S", "F", "V", "Y", "F", "V"]
8
0.028425216674804688
8
12
15
[[[0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0, 0, 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, 1, 0, 0]], ["S", "X", "Y", "Q", "O", "R", "D", "V", "H", "J", "F", "C"], "V", "F"]
[[[0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0, 0, 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, 1, 0, 0]], ["S", "X", "Y", "Q", "O", "R", "D", "V", "H", "J", "F", "C"], "Q", "V", "F"]
["[[0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0, 0, 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, 1, 0, 0]]", "['S', 'X', 'Y', 'Q', 'O', 'R', 'D', 'V', 'H', 'J', 'F', 'C']", "['Q']", "['V', 'F']"]
38
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [30, 24, 27, 14, 29, 17, 4, 21, 20, 14, 19, 23, 18, 4, 12, 9, 24, 26, 21, 17, 3, 13, 25, 20, 16, 12, 2, 9, 17, 5, 6, 24, 13, 11, 6, 15, 13, 5, 13, 25, 10, 15, 10, 3, 2, 18, 7, 23, 5, 18, 21, 6], such that the sum of the chosen coins adds up to 300. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {14: 11, 3: 1, 18: 5, 21: 1, 27: 2, 19: 14, 6: 6, 25: 8, 5: 3, 29: 4, 7: 6, 24: 10, 10: 2, 13: 9, 9: 1, 11: 8, 16: 10, 2: 1, 12: 12, 15: 4, 23: 17, 17: 9, 26: 13, 30: 17, 4: 3, 20: 6}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
31
[9, 9, 21, 21, 10, 27, 29, 18, 10, 15, 25, 20, 18, 21, 25, 20, 2]
58
0.056997060775756836
17
52
52
[[30, 24, 27, 14, 29, 17, 4, 21, 20, 14, 19, 23, 18, 4, 12, 9, 24, 26, 21, 17, 3, 13, 25, 20, 16, 12, 2, 9, 17, 5, 6, 24, 13, 11, 6, 15, 13, 5, 13, 25, 10, 15, 10, 3, 2, 18, 7, 23, 5, 18, 21, 6]]
[[30, 24, 27, 14, 29, 17, 4, 21, 20, 14, 19, 23, 18, 4, 12, 9, 24, 26, 21, 17, 3, 13, 25, 20, 16, 12, 2, 9, 17, 5, 6, 24, 13, 11, 6, 15, 13, 5, 13, 25, 10, 15, 10, 3, 2, 18, 7, 23, 5, 18, 21, 6], {"14": 11, "3": 1, "18": 5, "21": 1, "27": 2, "19": 14, "6": 6, "25": 8, "5": 3, "29": 4, "7": 6, "24": 10, "10": 2, "13": 9, "9": 1, "11": 8, "16": 10, "2": 1, "12": 12, "15": 4, "23": 17, "17": 9, "26": 13, "30": 17, "4": 3, "20": 6}, 300]
["[30, 24, 27, 14, 29, 17, 4, 21, 20, 14, 19, 23, 18, 4, 12, 9, 24, 26, 21, 17, 3, 13, 25, 20, 16, 12, 2, 9, 17, 5, 6, 24, 13, 11, 6, 15, 13, 5, 13, 25, 10, 15, 10, 3, 2, 18, 7, 23, 5, 18, 21, 6]", "{14: 11, 3: 1, 18: 5, 21: 1, 27: 2, 19: 14, 6: 6, 25: 8, 5: 3, 29: 4, 7: 6, 24: 10, 10: 2, 13: 9, 9: 1, 11: 8, 16: 10, 2: 1, 12: 12, 15: 4, 23: 17, 17: 9, 26: 13, 30: 17, 4: 3, 20: 6}", "300"]
38
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Green', 'Blue', 'Red'], ['Red', 'Green', 'Blue', 'Red'], ['Green', 'Red', 'Green', 'Blue']]
color_sorting
sorting
8
[[2, 0], [1, 2], [1, 0], [1, 0], [2, 1], [2, 1], [2, 1], [0, 2], [0, 1], [0, 1], [0, 2], [0, 1], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [2, 1]]
19
5.927346706390381
19
6
12
[[["Blue", "Green", "Blue", "Red"], ["Red", "Green", "Blue", "Red"], ["Green", "Red", "Green", "Blue"]], 7]
[[["Blue", "Green", "Blue", "Red"], ["Red", "Green", "Blue", "Red"], ["Green", "Red", "Green", "Blue"]], 7]
["[['Blue', 'Green', 'Blue', 'Red'], ['Red', 'Green', 'Blue', 'Red'], ['Green', 'Red', 'Green', 'Blue']]", "7"]
38
We have a 3x3 numerical grid, with numbers ranging from 45 to 98 (45 included in the range but 98 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' '89' '95'] ['x' 'x' '96'] ['74' '93' 'x']]
consecutive_grid
underdetermined_system
8
[[0, 0, 45], [1, 0, 46], [1, 1, 90], [2, 2, 97]]
749
0.5823245048522949
4
53
9
["[['', '89', '95'], ['', '', '96'], ['74', '93', '']]", 45, 98]
["[['', '89', '95'], ['', '', '96'], ['74', '93', '']]", 45, 98]
["[['', '89', '95'], ['', '', '96'], ['74', '93', '']]", "45", "98"]
38
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 40 to 66. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 227, 215, None for columns 1 to 2 respectively, and the sums of rows must be None, 207, 218, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 195. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' '56' 'x' '40'] ['x' 'x' '44' '60'] ['x' '52' 'x' '45'] ['x' 'x' '62' '47']]
magic_square
underdetermined_system
7
[[0, 0, 41], [0, 2, 46], [1, 0, 48], [1, 1, 55], [2, 0, 58], [2, 2, 63], [3, 0, 59], [3, 1, 64]]
840
3.1795032024383545
8
39
9
["[['', '56', '', '40'], ['', '', '44', '60'], ['', '52', '', '45'], ['', '', '62', '47']]", 4, 40, 66]
["[['', '56', '', '40'], ['', '', '44', '60'], ['', '52', '', '45'], ['', '', '62', '47']]", 40, 66, [1, 3], [1, 3], [227, 215], [207, 218], 195]
["[['', '56', '', '40'], ['', '', '44', '60'], ['', '52', '', '45'], ['', '', '62', '47']]", "40", "66", "[None, 227, 215, None]", "[None, 207, 218, None]", "195"]
38
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 7, 1: 5, 2: 7, 3: 2, 4: 6, 5: 7, 6: 5, 7: 3}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Blue', 'Black', 'Yellow', 'Black', 'Red'], ['Blue', 'Blue', 'Green', 'Black', 'Yellow'], [], ['Yellow', 'Red', 'Red', 'Green', 'Green'], [], [], ['Red', 'Blue', 'Black', 'Green', 'Yellow'], []]
restricted_sorting
sorting
2
[[0, 7], [6, 4], [6, 7], [3, 2], [3, 4], [3, 4], [1, 7], [1, 7], [1, 3], [1, 5], [6, 5], [6, 3], [0, 5], [0, 1], [0, 5], [0, 4], [2, 1], [6, 1]]
90
0.06386184692382812
18
56
20
[[["Blue", "Black", "Yellow", "Black", "Red"], ["Blue", "Blue", "Green", "Black", "Yellow"], [], ["Yellow", "Red", "Red", "Green", "Green"], [], [], ["Red", "Blue", "Black", "Green", "Yellow"], []], 5, {"0": 7, "1": 5, "2": 7, "3": 2, "4": 6, "5": 7, "6": 5, "7": 3}]
[[["Blue", "Black", "Yellow", "Black", "Red"], ["Blue", "Blue", "Green", "Black", "Yellow"], [], ["Yellow", "Red", "Red", "Green", "Green"], [], [], ["Red", "Blue", "Black", "Green", "Yellow"], []], 5, {"0": 7, "1": 5, "2": 7, "3": 2, "4": 6, "5": 7, "6": 5, "7": 3}, 4]
["[['Blue', 'Black', 'Yellow', 'Black', 'Red'], ['Blue', 'Blue', 'Green', 'Black', 'Yellow'], [], ['Yellow', 'Red', 'Red', 'Green', 'Green'], [], [], ['Red', 'Blue', 'Black', 'Green', 'Yellow'], []]", "{0: 7, 1: 5, 2: 7, 3: 2, 4: 6, 5: 7, 6: 5, 7: 3}", "5", "4"]
38
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 6) to his destination workshop at index (8, 0), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 7, and district 3 covering rows 8 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x x x 3 x x 16 x 2 16 3] [8 x 8 5 x x 10 x 19 4 x] [x x 18 1 16 x 9 15 x x 11] [x x 17 16 4 19 2 x 1 11 x] [9 x 5 16 18 x x 7 x 18 6] [x 15 7 x x x 19 8 9 17 x] [x 15 19 x x x 6 2 6 x 5] [x 12 11 3 11 4 x x x 3 x] [18 12 4 x 3 10 x 3 x 7 14] [15 11 12 x 13 2 x x 5 14 x] [x x 15 x 16 4 10 13 x x 4]
traffic
pathfinding
3
[[3, 6], [3, 5], [3, 4], [3, 3], [4, 3], [4, 2], [5, 2], [6, 2], [7, 2], [8, 2], [8, 1], [8, 0]]
131
0.035286903381347656
12
4
4
[[["x", "x", "x", "3", "x", "x", "16", "x", "2", "16", "3"], ["8", "x", "8", "5", "x", "x", "10", "x", "19", "4", "x"], ["x", "x", "18", "1", "16", "x", "9", "15", "x", "x", "11"], ["x", "x", "17", "16", "4", "19", "2", "x", "1", "11", "x"], ["9", "x", "5", "16", "18", "x", "x", "7", "x", "18", "6"], ["x", "15", "7", "x", "x", "x", "19", "8", "9", "17", "x"], ["x", "15", "19", "x", "x", "x", "6", "2", "6", "x", "5"], ["x", "12", "11", "3", "11", "4", "x", "x", "x", "3", "x"], ["18", "12", "4", "x", "3", "10", "x", "3", "x", "7", "14"], ["15", "11", "12", "x", "13", "2", "x", "x", "5", "14", "x"], ["x", "x", "15", "x", "16", "4", "10", "13", "x", "x", "4"]]]
[[["x", "x", "x", "3", "x", "x", "16", "x", "2", "16", "3"], ["8", "x", "8", "5", "x", "x", "10", "x", "19", "4", "x"], ["x", "x", "18", "1", "16", "x", "9", "15", "x", "x", "11"], ["x", "x", "17", "16", "4", "19", "2", "x", "1", "11", "x"], ["9", "x", "5", "16", "18", "x", "x", "7", "x", "18", "6"], ["x", "15", "7", "x", "x", "x", "19", "8", "9", "17", "x"], ["x", "15", "19", "x", "x", "x", "6", "2", "6", "x", "5"], ["x", "12", "11", "3", "11", "4", "x", "x", "x", "3", "x"], ["18", "12", "4", "x", "3", "10", "x", "3", "x", "7", "14"], ["15", "11", "12", "x", "13", "2", "x", "x", "5", "14", "x"], ["x", "x", "15", "x", "16", "4", "10", "13", "x", "x", "4"]], [3, 6], [8, 0], 3, 7]
["[['x', 'x', 'x', '3', 'x', 'x', '16', 'x', '2', '16', '3'], ['8', 'x', '8', '5', 'x', 'x', '10', 'x', '19', '4', 'x'], ['x', 'x', '18', '1', '16', 'x', '9', '15', 'x', 'x', '11'], ['x', 'x', '17', '16', '4', '19', '2', 'x', '1', '11', 'x'], ['9', 'x', '5', '16', '18', 'x', 'x', '7', 'x', '18', '6'], ['x', '15', '7', 'x', 'x', 'x', '19', '8', '9', '17', 'x'], ['x', '15', '19', 'x', 'x', 'x', '6', '2', '6', 'x', '5'], ['x', '12', '11', '3', '11', '4', 'x', 'x', 'x', '3', 'x'], ['18', '12', '4', 'x', '3', '10', 'x', '3', 'x', '7', '14'], ['15', '11', '12', 'x', '13', '2', 'x', 'x', '5', '14', 'x'], ['x', 'x', '15', 'x', '16', '4', '10', '13', 'x', 'x', '4']]", "(3, 6)", "(8, 0)", "3", "7"]
38
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (8, 8) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (0, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 0 0 0 0 0 1 1 1 0 1 1 1 0 0 1 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 1 1 0 0 1 0 0 0 1 0 0 1 0 0 0 0 1 1 1 0 1 1 1 1 1 0 1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 1 0 1 1 0 0 0 1 1 0 1 1 1 0 1 0 0 0 0 1 1 1 0 1 0 1 0 0 0 1 0
trampoline_matrix
pathfinding
11
[[8, 8], [7, 7], [7, 6], [6, 5], [5, 4], [4, 4], [3, 4], [3, 3], [2, 3], [2, 2], [1, 2], [0, 2], [0, 1], [0, 0]]
14
0.025176048278808594
14
8
2
["[[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1], [1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1], [1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1], [1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1], [0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0]]", 3]
["[[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1], [1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1], [1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1], [1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1], [0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0]]", [8, 8], [0, 0], 3]
["[[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1], [1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1], [1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1], [1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1], [0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0]]", "(8, 8)", "(0, 0)", "3"]
38
Given 9 labeled water jugs with capacities 117, 128, 36, 129, 103, 53, 21, 119, 105, 26 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 394, 425, 426 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 53, 3], ["+", 117, 3], ["+", 128, 3], ["+", 128, 3], ["+", 26, 2], ["+", 128, 2], ["+", 128, 2], ["+", 26, 2], ["+", 117, 2], ["+", 117, 1], ["+", 128, 1], ["+", 21, 1], ["+", 128, 1]]
13
0.05204272270202637
13
60
3
[[117, 128, 36, 129, 103, 53, 21, 119, 105, 26], [394, 425, 426]]
[[117, 128, 36, 129, 103, 53, 21, 119, 105, 26], [394, 425, 426]]
["[117, 128, 36, 129, 103, 53, 21, 119, 105, 26]", "[394, 425, 426]"]
39
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[30, 39, 59, 78], [100, 57, 55, 48], [82, '_', 15, 88]]
8_puzzle
puzzle
4
[15, 88, 48, 55, 57, 39, 59, 57, 88, 15, 39, 100, 30, 59, 100, 30, 82, 39, 30, 82, 59, 100, 57, 88, 82, 57, 88, 82, 55, 48]
30
0.43415212631225586
30
4
12
[[[30, 39, 59, 78], [100, 57, 55, 48], [82, "_", 15, 88]]]
[[[30, 39, 59, 78], [100, 57, 55, 48], [82, "_", 15, 88]]]
["[[30, 39, 59, 78], [100, 57, 55, 48], [82, '_', 15, 88]]"]
39
In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: jibby, entone, xenium, enwomb The initial board: [['n', 'j', '_', 'b', 'e', 'y'], ['e', 'i', 't', 'u', 'n', 'o'], ['x', 'e', 'n', 'i', 'b', 'm'], ['e', 'n', 'w', 'o', 'm', 'b']]
8_puzzle_words
puzzle
3
["down-right", "down-right", "up-right", "up-left", "down-left", "up-left", "down-left", "down-right", "down-right", "up-right", "up-left", "down-left", "up-left", "up-left"]
14
0.235795259475708
14
4
24
[[["n", "j", "_", "b", "e", "y"], ["e", "i", "t", "u", "n", "o"], ["x", "e", "n", "i", "b", "m"], ["e", "n", "w", "o", "m", "b"]]]
[[["n", "j", "_", "b", "e", "y"], ["e", "i", "t", "u", "n", "o"], ["x", "e", "n", "i", "b", "m"], ["e", "n", "w", "o", "m", "b"]], ["jibby", "entone", "xenium", "enwomb"]]
["[['n', 'j', '_', 'b', 'e', 'y'], ['e', 'i', 't', 'u', 'n', 'o'], ['x', 'e', 'n', 'i', 'b', 'm'], ['e', 'n', 'w', 'o', 'm', 'b']]", "['jibby', 'entone', 'xenium', 'enwomb']"]
39
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'O'. Our task is to visit city N and city T excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from T and N, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. O Z J K E M T W N Q U Y O 0 1 0 0 0 1 0 0 0 0 0 0 Z 0 0 0 0 0 0 0 0 1 0 0 1 J 1 0 0 0 0 1 0 0 1 0 1 0 K 1 0 0 0 0 0 0 1 0 1 0 0 E 1 0 1 0 0 0 1 0 0 0 0 1 M 0 1 0 1 0 0 0 0 0 0 0 0 T 0 1 1 0 1 0 0 0 0 0 0 1 W 0 0 1 0 0 1 1 0 1 0 0 0 N 1 0 0 1 1 1 0 0 0 0 0 1 Q 0 0 0 0 1 0 0 1 0 0 0 0 U 0 0 0 0 1 0 0 0 1 1 0 0 Y 1 0 1 1 0 1 0 1 0 0 1 0
city_directed_graph
pathfinding
12
["O", "Z", "N", "E", "T", "Y", "W", "T", "J", "N"]
10
0.033557891845703125
10
12
15
[[[0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0], [1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0], [1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0]], ["O", "Z", "J", "K", "E", "M", "T", "W", "N", "Q", "U", "Y"], "N", "T"]
[[[0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0], [1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0], [1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0]], ["O", "Z", "J", "K", "E", "M", "T", "W", "N", "Q", "U", "Y"], "O", "N", "T"]
["[[0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0], [1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0], [1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0]]", "['O', 'Z', 'J', 'K', 'E', 'M', 'T', 'W', 'N', 'Q', 'U', 'Y']", "['O']", "['N', 'T']"]
39
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [26, 24, 8, 2, 11, 10, 11, 14, 20, 9, 13, 10, 25, 21, 7, 20, 15, 27, 18, 12, 23, 4, 2, 4, 22, 23, 15, 16, 24, 14, 22, 13, 15, 21, 5, 14, 2, 21, 14, 10, 2, 2, 24, 26, 17, 2, 20, 22, 3, 27, 8, 20, 2, 25, 7], such that the sum of the chosen coins adds up to 273. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {24: 18, 14: 4, 15: 10, 23: 15, 26: 12, 22: 4, 17: 8, 5: 2, 18: 2, 16: 3, 11: 3, 2: 1, 27: 9, 3: 3, 10: 5, 20: 4, 4: 2, 21: 4, 12: 1, 8: 6, 13: 2, 7: 2, 9: 6, 25: 15}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
32
[22, 18, 16, 12, 13, 13, 21, 21, 20, 21, 20, 27, 22, 20, 2, 5]
54
0.061914682388305664
16
55
55
[[26, 24, 8, 2, 11, 10, 11, 14, 20, 9, 13, 10, 25, 21, 7, 20, 15, 27, 18, 12, 23, 4, 2, 4, 22, 23, 15, 16, 24, 14, 22, 13, 15, 21, 5, 14, 2, 21, 14, 10, 2, 2, 24, 26, 17, 2, 20, 22, 3, 27, 8, 20, 2, 25, 7]]
[[26, 24, 8, 2, 11, 10, 11, 14, 20, 9, 13, 10, 25, 21, 7, 20, 15, 27, 18, 12, 23, 4, 2, 4, 22, 23, 15, 16, 24, 14, 22, 13, 15, 21, 5, 14, 2, 21, 14, 10, 2, 2, 24, 26, 17, 2, 20, 22, 3, 27, 8, 20, 2, 25, 7], {"24": 18, "14": 4, "15": 10, "23": 15, "26": 12, "22": 4, "17": 8, "5": 2, "18": 2, "16": 3, "11": 3, "2": 1, "27": 9, "3": 3, "10": 5, "20": 4, "4": 2, "21": 4, "12": 1, "8": 6, "13": 2, "7": 2, "9": 6, "25": 15}, 273]
["[26, 24, 8, 2, 11, 10, 11, 14, 20, 9, 13, 10, 25, 21, 7, 20, 15, 27, 18, 12, 23, 4, 2, 4, 22, 23, 15, 16, 24, 14, 22, 13, 15, 21, 5, 14, 2, 21, 14, 10, 2, 2, 24, 26, 17, 2, 20, 22, 3, 27, 8, 20, 2, 25, 7]", "{24: 18, 14: 4, 15: 10, 23: 15, 26: 12, 22: 4, 17: 8, 5: 2, 18: 2, 16: 3, 11: 3, 2: 1, 27: 9, 3: 3, 10: 5, 20: 4, 4: 2, 21: 4, 12: 1, 8: 6, 13: 2, 7: 2, 9: 6, 25: 15}", "273"]
39
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Green', 'Blue', 'Red'], ['Blue', 'Red', 'Blue', 'Green'], ['Green', 'Red', 'Blue', 'Green']]
color_sorting
sorting
8
[[2, 0], [2, 1], [2, 1], [0, 2], [0, 1], [0, 2], [0, 2], [1, 0], [1, 2], [1, 0], [1, 2], [1, 0], [1, 0], [1, 0], [2, 1], [2, 1], [2, 1], [0, 2], [0, 1]]
19
6.7476325035095215
19
6
12
[[["Red", "Green", "Blue", "Red"], ["Blue", "Red", "Blue", "Green"], ["Green", "Red", "Blue", "Green"]], 7]
[[["Red", "Green", "Blue", "Red"], ["Blue", "Red", "Blue", "Green"], ["Green", "Red", "Blue", "Green"]], 7]
["[['Red', 'Green', 'Blue', 'Red'], ['Blue', 'Red', 'Blue', 'Green'], ['Green', 'Red', 'Blue', 'Green']]", "7"]
39
We have a 3x3 numerical grid, with numbers ranging from 18 to 71 (18 included in the range but 71 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' '60' 'x'] ['x' 'x' '53'] ['52' '39' '20']]
consecutive_grid
underdetermined_system
8
[[0, 0, 18], [0, 2, 61], [1, 0, 19], [1, 1, 40]]
351
0.6906087398529053
4
53
9
["[['', '60', ''], ['', '', '53'], ['52', '39', '20']]", 18, 71]
["[['', '60', ''], ['', '', '53'], ['52', '39', '20']]", 18, 71]
["[['', '60', ''], ['', '', '53'], ['52', '39', '20']]", "18", "71"]
39
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 24 to 50. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 174, 158, None for columns 1 to 2 respectively, and the sums of rows must be None, 158, 131, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 156. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' '35' 'x' 'x'] ['43' 'x' '41' '30'] ['x' '46' '33' 'x'] ['x' '49' 'x' 'x']]
magic_square
underdetermined_system
7
[[0, 0, 24], [0, 2, 36], [0, 3, 29], [1, 1, 44], [2, 0, 25], [2, 3, 27], [3, 0, 40], [3, 2, 48], [3, 3, 26]]
576
7.876656532287598
9
39
9
["[['', '35', '', ''], ['43', '', '41', '30'], ['', '46', '33', ''], ['', '49', '', '']]", 4, 24, 50]
["[['', '35', '', ''], ['43', '', '41', '30'], ['', '46', '33', ''], ['', '49', '', '']]", 24, 50, [1, 3], [1, 3], [174, 158], [158, 131], 156]
["[['', '35', '', ''], ['43', '', '41', '30'], ['', '46', '33', ''], ['', '49', '', '']]", "24", "50", "[None, 174, 158, None]", "[None, 158, 131, None]", "156"]
39
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 8, 1: 8, 2: 1, 3: 2, 4: 9, 5: 4, 6: 7, 7: 8}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Green', 'Green', 'Black', 'Blue', 'Black'], [], [], [], ['Yellow', 'Red', 'Black', 'Red', 'Blue'], ['Yellow', 'Blue', 'Red', 'Black', 'Blue'], ['Red', 'Green', 'Green', 'Yellow', 'Yellow'], []]
restricted_sorting
sorting
2
[[0, 1], [0, 1], [6, 2], [6, 1], [6, 1], [5, 6], [5, 7], [4, 6], [5, 2], [5, 3], [7, 5], [0, 3], [0, 5], [4, 2], [4, 3], [4, 2], [4, 5], [0, 3]]
78
4.903253078460693
18
56
20
[[["Green", "Green", "Black", "Blue", "Black"], [], [], [], ["Yellow", "Red", "Black", "Red", "Blue"], ["Yellow", "Blue", "Red", "Black", "Blue"], ["Red", "Green", "Green", "Yellow", "Yellow"], []], 5, {"0": 8, "1": 8, "2": 1, "3": 2, "4": 9, "5": 4, "6": 7, "7": 8}]
[[["Green", "Green", "Black", "Blue", "Black"], [], [], [], ["Yellow", "Red", "Black", "Red", "Blue"], ["Yellow", "Blue", "Red", "Black", "Blue"], ["Red", "Green", "Green", "Yellow", "Yellow"], []], 5, {"0": 8, "1": 8, "2": 1, "3": 2, "4": 9, "5": 4, "6": 7, "7": 8}, 4]
["[['Green', 'Green', 'Black', 'Blue', 'Black'], [], [], [], ['Yellow', 'Red', 'Black', 'Red', 'Blue'], ['Yellow', 'Blue', 'Red', 'Black', 'Blue'], ['Red', 'Green', 'Green', 'Yellow', 'Yellow'], []]", "{0: 8, 1: 8, 2: 1, 3: 2, 4: 9, 5: 4, 6: 7, 7: 8}", "5", "4"]
39
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 1) to his destination workshop at index (5, 10), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 2, district 2 covering rows 3 to 4, and district 3 covering rows 5 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [15 8 18 3 19 x 17 x x x x] [19 16 x 18 20 2 5 7 11 12 3] [18 x 18 1 2 x x x 12 16 4] [9 20 4 19 5 15 x x x 6 4] [x 18 8 1 x 7 1 7 10 1 4] [x 18 x 18 19 9 18 5 15 1 7] [3 x 12 14 x x x x 1 x x] [x 12 6 x 6 x 1 x 1 7 x] [x 5 10 14 2 x x 7 11 3 x] [6 9 13 x x x x x x x 3] [19 12 x 15 x 14 x 9 x x 19]
traffic
pathfinding
3
[[3, 1], [3, 2], [2, 2], [2, 3], [2, 4], [3, 4], [3, 5], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [5, 9], [5, 10]]
79
0.028283357620239258
14
4
4
[[["15", "8", "18", "3", "19", "x", "17", "x", "x", "x", "x"], ["19", "16", "x", "18", "20", "2", "5", "7", "11", "12", "3"], ["18", "x", "18", "1", "2", "x", "x", "x", "12", "16", "4"], ["9", "20", "4", "19", "5", "15", "x", "x", "x", "6", "4"], ["x", "18", "8", "1", "x", "7", "1", "7", "10", "1", "4"], ["x", "18", "x", "18", "19", "9", "18", "5", "15", "1", "7"], ["3", "x", "12", "14", "x", "x", "x", "x", "1", "x", "x"], ["x", "12", "6", "x", "6", "x", "1", "x", "1", "7", "x"], ["x", "5", "10", "14", "2", "x", "x", "7", "11", "3", "x"], ["6", "9", "13", "x", "x", "x", "x", "x", "x", "x", "3"], ["19", "12", "x", "15", "x", "14", "x", "9", "x", "x", "19"]]]
[[["15", "8", "18", "3", "19", "x", "17", "x", "x", "x", "x"], ["19", "16", "x", "18", "20", "2", "5", "7", "11", "12", "3"], ["18", "x", "18", "1", "2", "x", "x", "x", "12", "16", "4"], ["9", "20", "4", "19", "5", "15", "x", "x", "x", "6", "4"], ["x", "18", "8", "1", "x", "7", "1", "7", "10", "1", "4"], ["x", "18", "x", "18", "19", "9", "18", "5", "15", "1", "7"], ["3", "x", "12", "14", "x", "x", "x", "x", "1", "x", "x"], ["x", "12", "6", "x", "6", "x", "1", "x", "1", "7", "x"], ["x", "5", "10", "14", "2", "x", "x", "7", "11", "3", "x"], ["6", "9", "13", "x", "x", "x", "x", "x", "x", "x", "3"], ["19", "12", "x", "15", "x", "14", "x", "9", "x", "x", "19"]], [3, 1], [5, 10], 2, 4]
["[['15', '8', '18', '3', '19', 'x', '17', 'x', 'x', 'x', 'x'], ['19', '16', 'x', '18', '20', '2', '5', '7', '11', '12', '3'], ['18', 'x', '18', '1', '2', 'x', 'x', 'x', '12', '16', '4'], ['9', '20', '4', '19', '5', '15', 'x', 'x', 'x', '6', '4'], ['x', '18', '8', '1', 'x', '7', '1', '7', '10', '1', '4'], ['x', '18', 'x', '18', '19', '9', '18', '5', '15', '1', '7'], ['3', 'x', '12', '14', 'x', 'x', 'x', 'x', '1', 'x', 'x'], ['x', '12', '6', 'x', '6', 'x', '1', 'x', '1', '7', 'x'], ['x', '5', '10', '14', '2', 'x', 'x', '7', '11', '3', 'x'], ['6', '9', '13', 'x', 'x', 'x', 'x', 'x', 'x', 'x', '3'], ['19', '12', 'x', '15', 'x', '14', 'x', '9', 'x', 'x', '19']]", "(3, 1)", "(5, 10)", "2", "4"]
39
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (9, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (0, 3). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 1 1 0 1 0 1 1 1 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 0 0 0 1 1 1 0 1 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 0 1 1 1 0 0 0 1 1 0 0 1 0 1 1 1 0 1 0 0 1 1 1
trampoline_matrix
pathfinding
11
[[9, 9], [8, 8], [7, 9], [6, 9], [6, 8], [5, 8], [4, 8], [3, 7], [3, 6], [3, 5], [3, 4], [2, 4], [1, 4], [0, 4], [0, 3]]
15
0.025874614715576172
15
8
2
["[[0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0], [1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0], [1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0], [1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0], [1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1]]", 3]
["[[0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0], [1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0], [1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0], [1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0], [1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1]]", [9, 9], [0, 3], 3]
["[[0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0], [1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0], [1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0], [1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0], [1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1]]", "(9, 9)", "(0, 3)", "3"]
39
Given 9 labeled water jugs with capacities 76, 63, 111, 59, 11, 108, 16, 66, 75, 67 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 191, 269, 328 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 66, 3], ["+", 75, 3], ["+", 76, 3], ["+", 111, 3], ["+", 59, 2], ["+", 75, 2], ["+", 76, 2], ["+", 59, 2], ["+", 75, 1], ["+", 108, 1], ["-", 67, 1], ["+", 75, 1]]
12
0.045966386795043945
12
60
3
[[76, 63, 111, 59, 11, 108, 16, 66, 75, 67], [191, 269, 328]]
[[76, 63, 111, 59, 11, 108, 16, 66, 75, 67], [191, 269, 328]]
["[76, 63, 111, 59, 11, 108, 16, 66, 75, 67]", "[191, 269, 328]"]
40
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[28, 11, 50, 15], [94, 93, '_', 26], [34, 7, 3, 82]]
8_puzzle
puzzle
4
[26, 82, 3, 7, 34, 94, 93, 11, 28, 93, 94, 34, 11, 26, 82, 15, 50, 82, 26, 28, 93, 94, 34, 11, 7, 3]
26
0.45993494987487793
26
4
12
[[[28, 11, 50, 15], [94, 93, "_", 26], [34, 7, 3, 82]]]
[[[28, 11, 50, 15], [94, 93, "_", 26], [34, 7, 3, 82]]]
["[[28, 11, 50, 15], [94, 93, '_', 26], [34, 7, 3, 82]]"]
40
In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: nolle, yapman, pitaya, crawly The initial board: [['a', 'n', '_', 'l', 'l', 'e'], ['y', 'p', 'p', 'o', 'a', 'n'], ['r', 'i', 'm', 'a', 'y', 'a'], ['c', 't', 'a', 'w', 'l', 'y']]
8_puzzle_words
puzzle
3
["down-right", "down-left", "down-left", "up-left", "up-right", "up-left"]
6
0.2233717441558838
6
4
24
[[["a", "n", "_", "l", "l", "e"], ["y", "p", "p", "o", "a", "n"], ["r", "i", "m", "a", "y", "a"], ["c", "t", "a", "w", "l", "y"]]]
[[["a", "n", "_", "l", "l", "e"], ["y", "p", "p", "o", "a", "n"], ["r", "i", "m", "a", "y", "a"], ["c", "t", "a", "w", "l", "y"]], ["nolle", "yapman", "pitaya", "crawly"]]
["[['a', 'n', '_', 'l', 'l', 'e'], ['y', 'p', 'p', 'o', 'a', 'n'], ['r', 'i', 'm', 'a', 'y', 'a'], ['c', 't', 'a', 'w', 'l', 'y']]", "['nolle', 'yapman', 'pitaya', 'crawly']"]
40
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'F'. Our task is to visit city R and city A excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from A and R, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. R L F E D Q G U H T Z A R 0 0 0 1 0 0 1 0 0 0 1 0 L 0 0 0 0 0 0 1 0 0 0 0 1 F 0 0 0 0 0 1 0 0 0 0 0 0 E 0 0 0 0 0 1 0 1 0 0 0 0 D 1 0 0 1 0 0 0 0 1 0 0 1 Q 1 1 0 0 0 0 0 1 1 0 0 0 G 0 1 1 1 1 0 0 1 1 0 0 0 U 0 0 0 0 1 0 0 0 1 0 1 0 H 1 0 1 0 0 0 0 0 0 0 0 0 T 0 1 0 0 1 0 0 0 1 0 1 0 Z 1 0 1 0 1 1 0 0 1 0 0 0 A 0 0 0 0 1 1 0 0 0 1 0 0
city_directed_graph
pathfinding
12
["F", "Q", "R", "Z", "R", "G", "L", "A", "D", "A"]
10
0.030649185180664062
10
12
15
[[[0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0]], ["R", "L", "F", "E", "D", "Q", "G", "U", "H", "T", "Z", "A"], "R", "A"]
[[[0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0]], ["R", "L", "F", "E", "D", "Q", "G", "U", "H", "T", "Z", "A"], "F", "R", "A"]
["[[0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0]]", "['R', 'L', 'F', 'E', 'D', 'Q', 'G', 'U', 'H', 'T', 'Z', 'A']", "['F']", "['R', 'A']"]
40
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [25, 22, 26, 12, 18, 12, 5, 6, 6, 21, 28, 26, 6, 26, 9, 11, 27, 24, 16, 1, 12, 5, 10, 23, 11, 10, 28, 2, 3, 7, 23, 28, 27, 12, 3, 3, 27, 21, 13, 8, 18, 25, 6, 7, 9, 25, 18, 18, 23, 12, 11, 15, 2, 16], such that the sum of the chosen coins adds up to 289. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {10: 6, 24: 14, 5: 3, 3: 1, 16: 6, 27: 10, 13: 1, 12: 4, 21: 17, 8: 2, 28: 10, 6: 3, 1: 1, 18: 2, 25: 14, 11: 3, 23: 7, 7: 6, 26: 16, 15: 4, 2: 1, 9: 3, 22: 8}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
33
[18, 23, 18, 23, 18, 23, 18, 8, 11, 15, 2, 11, 11, 27, 12, 2, 3, 3, 9, 9, 13, 12]
73
0.06098175048828125
22
54
54
[[25, 22, 26, 12, 18, 12, 5, 6, 6, 21, 28, 26, 6, 26, 9, 11, 27, 24, 16, 1, 12, 5, 10, 23, 11, 10, 28, 2, 3, 7, 23, 28, 27, 12, 3, 3, 27, 21, 13, 8, 18, 25, 6, 7, 9, 25, 18, 18, 23, 12, 11, 15, 2, 16]]
[[25, 22, 26, 12, 18, 12, 5, 6, 6, 21, 28, 26, 6, 26, 9, 11, 27, 24, 16, 1, 12, 5, 10, 23, 11, 10, 28, 2, 3, 7, 23, 28, 27, 12, 3, 3, 27, 21, 13, 8, 18, 25, 6, 7, 9, 25, 18, 18, 23, 12, 11, 15, 2, 16], {"10": 6, "24": 14, "5": 3, "3": 1, "16": 6, "27": 10, "13": 1, "12": 4, "21": 17, "8": 2, "28": 10, "6": 3, "1": 1, "18": 2, "25": 14, "11": 3, "23": 7, "7": 6, "26": 16, "15": 4, "2": 1, "9": 3, "22": 8}, 289]
["[25, 22, 26, 12, 18, 12, 5, 6, 6, 21, 28, 26, 6, 26, 9, 11, 27, 24, 16, 1, 12, 5, 10, 23, 11, 10, 28, 2, 3, 7, 23, 28, 27, 12, 3, 3, 27, 21, 13, 8, 18, 25, 6, 7, 9, 25, 18, 18, 23, 12, 11, 15, 2, 16]", "{10: 6, 24: 14, 5: 3, 3: 1, 16: 6, 27: 10, 13: 1, 12: 4, 21: 17, 8: 2, 28: 10, 6: 3, 1: 1, 18: 2, 25: 14, 11: 3, 23: 7, 7: 6, 26: 16, 15: 4, 2: 1, 9: 3, 22: 8}", "289"]
40
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Green', 'Green', 'Blue'], ['Red', 'Blue', 'Green', 'Green'], ['Red', 'Red', 'Red', 'Blue']]
color_sorting
sorting
8
[[0, 2], [1, 2], [1, 2], [0, 1], [0, 1], [2, 1], [0, 1], [2, 0], [2, 1], [2, 0], [2, 0], [2, 0], [1, 2], [1, 2], [1, 2]]
15
0.6760032176971436
15
6
12
[[["Blue", "Green", "Green", "Blue"], ["Red", "Blue", "Green", "Green"], ["Red", "Red", "Red", "Blue"]], 7]
[[["Blue", "Green", "Green", "Blue"], ["Red", "Blue", "Green", "Green"], ["Red", "Red", "Red", "Blue"]], 7]
["[['Blue', 'Green', 'Green', 'Blue'], ['Red', 'Blue', 'Green', 'Green'], ['Red', 'Red', 'Red', 'Blue']]", "7"]
40
We have a 3x3 numerical grid, with numbers ranging from 34 to 87 (34 included in the range but 87 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' 'x' 'x'] ['65' 'x' 'x'] ['79' '73' '50']]
consecutive_grid
underdetermined_system
9
[[0, 0, 34], [0, 1, 35], [0, 2, 36], [1, 1, 38], [1, 2, 37]]
350
0.1763606071472168
5
53
9
["[['', '', ''], ['65', '', ''], ['79', '73', '50']]", 34, 87]
["[['', '', ''], ['65', '', ''], ['79', '73', '50']]", 34, 87]
["[['', '', ''], ['65', '', ''], ['79', '73', '50']]", "34", "87"]
40
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 24 to 50. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 149, 178, None for columns 1 to 2 respectively, and the sums of rows must be None, 135, 130, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 151. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['38' 'x' 'x' 'x'] ['x' 'x' 'x' 'x'] ['x' '39' '40' '27'] ['32' '46' 'x' '25']]
magic_square
underdetermined_system
7
[[0, 1, 30], [0, 2, 42], [0, 3, 33], [1, 0, 26], [1, 1, 34], [1, 2, 47], [1, 3, 28], [2, 0, 24], [3, 2, 49]]
560
11.717026948928833
9
39
9
["[['38', '', '', ''], ['', '', '', ''], ['', '39', '40', '27'], ['32', '46', '', '25']]", 4, 24, 50]
["[['38', '', '', ''], ['', '', '', ''], ['', '39', '40', '27'], ['32', '46', '', '25']]", 24, 50, [1, 3], [1, 3], [149, 178], [135, 130], 151]
["[['38', '', '', ''], ['', '', '', ''], ['', '39', '40', '27'], ['32', '46', '', '25']]", "24", "50", "[None, 149, 178, None]", "[None, 135, 130, None]", "151"]
40
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 5, 1: 5, 2: 1, 3: 7, 4: 7, 5: 9, 6: 1, 7: 6}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], [], ['Green', 'Yellow', 'Black', 'Red', 'Black'], ['Black', 'Red', 'Yellow', 'Blue', 'Yellow'], ['Green', 'Blue', 'Blue', 'Red', 'Black'], [], [], ['Red', 'Green', 'Blue', 'Green', 'Yellow']]
restricted_sorting
sorting
2
[[2, 0], [2, 5], [4, 0], [4, 6], [4, 6], [4, 1], [3, 4], [2, 4], [2, 1], [2, 4], [3, 1], [7, 1], [7, 0], [7, 6], [7, 0], [3, 2], [3, 6], [3, 2], [5, 2], [7, 2]]
78
9.45132565498352
20
56
20
[[[], [], ["Green", "Yellow", "Black", "Red", "Black"], ["Black", "Red", "Yellow", "Blue", "Yellow"], ["Green", "Blue", "Blue", "Red", "Black"], [], [], ["Red", "Green", "Blue", "Green", "Yellow"]], 5, {"0": 5, "1": 5, "2": 1, "3": 7, "4": 7, "5": 9, "6": 1, "7": 6}]
[[[], [], ["Green", "Yellow", "Black", "Red", "Black"], ["Black", "Red", "Yellow", "Blue", "Yellow"], ["Green", "Blue", "Blue", "Red", "Black"], [], [], ["Red", "Green", "Blue", "Green", "Yellow"]], 5, {"0": 5, "1": 5, "2": 1, "3": 7, "4": 7, "5": 9, "6": 1, "7": 6}, 4]
["[[], [], ['Green', 'Yellow', 'Black', 'Red', 'Black'], ['Black', 'Red', 'Yellow', 'Blue', 'Yellow'], ['Green', 'Blue', 'Blue', 'Red', 'Black'], [], [], ['Red', 'Green', 'Blue', 'Green', 'Yellow']]", "{0: 5, 1: 5, 2: 1, 3: 7, 4: 7, 5: 9, 6: 1, 7: 6}", "5", "4"]
40
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 10) to his destination workshop at index (5, 1), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 4, and district 3 covering rows 5 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x 10 x 8 13 8 4 3 15 x 17] [9 x 6 4 17 x 16 3 19 x x] [8 3 18 x x 3 x 7 12 16 17] [8 x x 13 x 7 x 8 x 12 9] [2 9 x x 9 4 18 x x 11 x] [14 20 x x x x 10 x x 7 x] [x x 18 16 12 10 x x 10 x x] [x x 16 x x 10 x x 3 18 18] [x x x x x x 13 3 x x x] [5 13 1 x x 8 x 19 x x x] [x x 16 x x 7 18 4 11 x 16]
traffic
pathfinding
3
[[3, 10], [3, 9], [2, 9], [2, 8], [2, 7], [1, 7], [0, 7], [0, 6], [0, 5], [0, 4], [0, 3], [1, 3], [1, 2], [2, 2], [2, 1], [2, 0], [3, 0], [4, 0], [4, 1], [5, 1]]
164
0.028056621551513672
20
4
4
[[["x", "10", "x", "8", "13", "8", "4", "3", "15", "x", "17"], ["9", "x", "6", "4", "17", "x", "16", "3", "19", "x", "x"], ["8", "3", "18", "x", "x", "3", "x", "7", "12", "16", "17"], ["8", "x", "x", "13", "x", "7", "x", "8", "x", "12", "9"], ["2", "9", "x", "x", "9", "4", "18", "x", "x", "11", "x"], ["14", "20", "x", "x", "x", "x", "10", "x", "x", "7", "x"], ["x", "x", "18", "16", "12", "10", "x", "x", "10", "x", "x"], ["x", "x", "16", "x", "x", "10", "x", "x", "3", "18", "18"], ["x", "x", "x", "x", "x", "x", "13", "3", "x", "x", "x"], ["5", "13", "1", "x", "x", "8", "x", "19", "x", "x", "x"], ["x", "x", "16", "x", "x", "7", "18", "4", "11", "x", "16"]]]
[[["x", "10", "x", "8", "13", "8", "4", "3", "15", "x", "17"], ["9", "x", "6", "4", "17", "x", "16", "3", "19", "x", "x"], ["8", "3", "18", "x", "x", "3", "x", "7", "12", "16", "17"], ["8", "x", "x", "13", "x", "7", "x", "8", "x", "12", "9"], ["2", "9", "x", "x", "9", "4", "18", "x", "x", "11", "x"], ["14", "20", "x", "x", "x", "x", "10", "x", "x", "7", "x"], ["x", "x", "18", "16", "12", "10", "x", "x", "10", "x", "x"], ["x", "x", "16", "x", "x", "10", "x", "x", "3", "18", "18"], ["x", "x", "x", "x", "x", "x", "13", "3", "x", "x", "x"], ["5", "13", "1", "x", "x", "8", "x", "19", "x", "x", "x"], ["x", "x", "16", "x", "x", "7", "18", "4", "11", "x", "16"]], [3, 10], [5, 1], 1, 4]
["[['x', '10', 'x', '8', '13', '8', '4', '3', '15', 'x', '17'], ['9', 'x', '6', '4', '17', 'x', '16', '3', '19', 'x', 'x'], ['8', '3', '18', 'x', 'x', '3', 'x', '7', '12', '16', '17'], ['8', 'x', 'x', '13', 'x', '7', 'x', '8', 'x', '12', '9'], ['2', '9', 'x', 'x', '9', '4', '18', 'x', 'x', '11', 'x'], ['14', '20', 'x', 'x', 'x', 'x', '10', 'x', 'x', '7', 'x'], ['x', 'x', '18', '16', '12', '10', 'x', 'x', '10', 'x', 'x'], ['x', 'x', '16', 'x', 'x', '10', 'x', 'x', '3', '18', '18'], ['x', 'x', 'x', 'x', 'x', 'x', '13', '3', 'x', 'x', 'x'], ['5', '13', '1', 'x', 'x', '8', 'x', '19', 'x', 'x', 'x'], ['x', 'x', '16', 'x', 'x', '7', '18', '4', '11', 'x', '16']]", "(3, 10)", "(5, 1)", "1", "4"]
40
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (9, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (2, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 1 0 1 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 1 1 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 0 0 0 1 1 0 0 1 0 0 0 1 0 1 1 0 1 1 1 1 0 0 0 0 1 1 1 0 1 0 0 1 1 0 0 0 0 0 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 0 0 1
trampoline_matrix
pathfinding
11
[[9, 9], [8, 8], [7, 7], [7, 6], [6, 5], [6, 4], [6, 3], [5, 3], [5, 2], [4, 2], [4, 1], [4, 0], [3, 0], [2, 0]]
14
0.03258109092712402
14
8
2
["[[1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1], [0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1], [0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0], [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1]]", 3]
["[[1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1], [0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1], [0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0], [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1]]", [9, 9], [2, 0], 3]
["[[1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1], [0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1], [0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0], [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1]]", "(9, 9)", "(2, 0)", "3"]
40
Given 9 labeled water jugs with capacities 62, 144, 80, 72, 100, 127, 18, 82, 42, 99 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 258, 310, 514 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 82, 3], ["+", 144, 3], ["+", 144, 3], ["+", 144, 3], ["+", 62, 2], ["+", 144, 2], ["+", 42, 2], ["+", 62, 2], ["+", 42, 1], ["+", 72, 1], ["+", 144, 1]]
11
0.03391599655151367
11
60
3
[[62, 144, 80, 72, 100, 127, 18, 82, 42, 99], [258, 310, 514]]
[[62, 144, 80, 72, 100, 127, 18, 82, 42, 99], [258, 310, 514]]
["[62, 144, 80, 72, 100, 127, 18, 82, 42, 99]", "[258, 310, 514]"]
41
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[81, 10, 54, '_'], [89, 77, 33, 29], [26, 44, 61, 18]]
8_puzzle
puzzle
4
[54, 33, 61, 18, 29, 54, 33, 61, 54, 33, 61, 10, 77, 54, 10, 77, 81, 89, 54, 44, 18, 10, 33, 29]
24
0.06885409355163574
24
4
12
[[[81, 10, 54, "_"], [89, 77, 33, 29], [26, 44, 61, 18]]]
[[[81, 10, 54, "_"], [89, 77, 33, 29], [26, 44, 61, 18]]]
["[[81, 10, 54, '_'], [89, 77, 33, 29], [26, 44, 61, 18]]"]
41
In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: alias, doocot, cerite, commie The initial board: [['o', 'a', '_', 'i', 't', 's'], ['d', 'r', 'o', 'o', 'o', 'a'], ['c', 'e', 'm', 'i', 'l', 'e'], ['c', 'c', 'm', 't', 'i', 'e']]
8_puzzle_words
puzzle
3
["down-right", "down-right", "down-left", "up-left", "down-left", "up-left", "up-right", "up-right", "down-right", "up-right", "down-right", "down-left", "up-left", "down-left", "up-left", "down-left", "down-right", "up-right", "up-left", "up-left"]
20
0.3230454921722412
20
4
24
[[["o", "a", "_", "i", "t", "s"], ["d", "r", "o", "o", "o", "a"], ["c", "e", "m", "i", "l", "e"], ["c", "c", "m", "t", "i", "e"]]]
[[["o", "a", "_", "i", "t", "s"], ["d", "r", "o", "o", "o", "a"], ["c", "e", "m", "i", "l", "e"], ["c", "c", "m", "t", "i", "e"]], ["alias", "doocot", "cerite", "commie"]]
["[['o', 'a', '_', 'i', 't', 's'], ['d', 'r', 'o', 'o', 'o', 'a'], ['c', 'e', 'm', 'i', 'l', 'e'], ['c', 'c', 'm', 't', 'i', 'e']]", "['alias', 'doocot', 'cerite', 'commie']"]
41
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'E'. Our task is to visit city Y and city A excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from A and Y, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. L Y V E A M C Q F Z G O L 0 0 0 0 1 1 0 0 0 0 0 0 Y 0 0 0 0 1 0 0 0 1 0 0 1 V 1 0 0 0 0 1 0 1 0 0 0 0 E 0 0 0 0 0 0 0 0 0 0 1 0 A 0 0 0 1 0 0 1 0 0 0 0 0 M 0 0 0 1 1 0 0 1 0 0 1 0 C 0 0 0 0 0 1 0 0 0 1 0 0 Q 0 1 0 0 1 0 0 0 0 0 0 0 F 1 1 1 1 0 1 0 0 0 0 1 0 Z 0 1 0 0 0 0 0 0 1 0 0 0 G 1 0 1 0 0 0 0 1 0 0 0 0 O 1 1 1 1 0 0 1 1 1 0 0 0
city_directed_graph
pathfinding
12
["E", "G", "Q", "Y", "A", "C", "Z", "Y", "A"]
9
0.02761673927307129
9
12
15
[[[0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0]], ["L", "Y", "V", "E", "A", "M", "C", "Q", "F", "Z", "G", "O"], "Y", "A"]
[[[0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0]], ["L", "Y", "V", "E", "A", "M", "C", "Q", "F", "Z", "G", "O"], "E", "Y", "A"]
["[[0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0]]", "['L', 'Y', 'V', 'E', 'A', 'M', 'C', 'Q', 'F', 'Z', 'G', 'O']", "['E']", "['Y', 'A']"]
41
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [20, 27, 20, 26, 2, 19, 25, 5, 14, 28, 7, 4, 20, 25, 9, 7, 3, 9, 27, 23, 2, 17, 25, 19, 10, 2, 8, 15, 3, 6, 24, 6, 22, 3, 10, 3, 2, 24, 7, 16, 2, 24, 21, 5, 23, 25, 10, 5, 20, 14, 24, 12, 11, 11, 13], such that the sum of the chosen coins adds up to 284. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {14: 7, 15: 15, 2: 2, 22: 7, 7: 1, 25: 7, 10: 4, 11: 11, 16: 11, 27: 8, 3: 2, 13: 5, 19: 10, 8: 5, 23: 18, 5: 4, 12: 4, 28: 6, 6: 4, 21: 3, 20: 15, 26: 1, 4: 4, 9: 9, 24: 6, 17: 13}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
34
[7, 7, 21, 25, 24, 25, 24, 25, 24, 27, 26, 24, 25]
66
0.05327725410461426
13
55
55
[[20, 27, 20, 26, 2, 19, 25, 5, 14, 28, 7, 4, 20, 25, 9, 7, 3, 9, 27, 23, 2, 17, 25, 19, 10, 2, 8, 15, 3, 6, 24, 6, 22, 3, 10, 3, 2, 24, 7, 16, 2, 24, 21, 5, 23, 25, 10, 5, 20, 14, 24, 12, 11, 11, 13]]
[[20, 27, 20, 26, 2, 19, 25, 5, 14, 28, 7, 4, 20, 25, 9, 7, 3, 9, 27, 23, 2, 17, 25, 19, 10, 2, 8, 15, 3, 6, 24, 6, 22, 3, 10, 3, 2, 24, 7, 16, 2, 24, 21, 5, 23, 25, 10, 5, 20, 14, 24, 12, 11, 11, 13], {"14": 7, "15": 15, "2": 2, "22": 7, "7": 1, "25": 7, "10": 4, "11": 11, "16": 11, "27": 8, "3": 2, "13": 5, "19": 10, "8": 5, "23": 18, "5": 4, "12": 4, "28": 6, "6": 4, "21": 3, "20": 15, "26": 1, "4": 4, "9": 9, "24": 6, "17": 13}, 284]
["[20, 27, 20, 26, 2, 19, 25, 5, 14, 28, 7, 4, 20, 25, 9, 7, 3, 9, 27, 23, 2, 17, 25, 19, 10, 2, 8, 15, 3, 6, 24, 6, 22, 3, 10, 3, 2, 24, 7, 16, 2, 24, 21, 5, 23, 25, 10, 5, 20, 14, 24, 12, 11, 11, 13]", "{14: 7, 15: 15, 2: 2, 22: 7, 7: 1, 25: 7, 10: 4, 11: 11, 16: 11, 27: 8, 3: 2, 13: 5, 19: 10, 8: 5, 23: 18, 5: 4, 12: 4, 28: 6, 6: 4, 21: 3, 20: 15, 26: 1, 4: 4, 9: 9, 24: 6, 17: 13}", "284"]
41
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Green', 'Blue', 'Red', 'Blue'], ['Red', 'Green', 'Blue', 'Green'], ['Red', 'Blue', 'Green', 'Red']]
color_sorting
sorting
8
[[0, 1], [0, 2], [0, 1], [2, 0], [2, 1], [2, 0], [2, 0], [1, 2], [1, 2], [1, 0], [1, 2], [1, 0], [1, 2], [0, 1], [0, 1], [0, 1], [2, 0]]
17
2.059692859649658
17
6
12
[[["Green", "Blue", "Red", "Blue"], ["Red", "Green", "Blue", "Green"], ["Red", "Blue", "Green", "Red"]], 7]
[[["Green", "Blue", "Red", "Blue"], ["Red", "Green", "Blue", "Green"], ["Red", "Blue", "Green", "Red"]], 7]
["[['Green', 'Blue', 'Red', 'Blue'], ['Red', 'Green', 'Blue', 'Green'], ['Red', 'Blue', 'Green', 'Red']]", "7"]
41
We have a 3x3 numerical grid, with numbers ranging from 29 to 82 (29 included in the range but 82 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' 'x' 'x'] ['39' 'x' '50'] ['32' 'x' '55']]
consecutive_grid
underdetermined_system
9
[[0, 0, 40], [0, 1, 30], [0, 2, 29], [1, 1, 41], [2, 1, 42]]
369
0.19344615936279297
5
53
9
["[['', '', ''], ['39', '', '50'], ['32', '', '55']]", 29, 82]
["[['', '', ''], ['39', '', '50'], ['32', '', '55']]", 29, 82]
["[['', '', ''], ['39', '', '50'], ['32', '', '55']]", "29", "82"]
41
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 24 to 50. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 135, 160, None for columns 1 to 2 respectively, and the sums of rows must be None, 125, 164, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 146. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' 'x' '40' 'x'] ['x' '31' 'x' '43'] ['37' 'x' 'x' '32'] ['34' '29' 'x' 'x']]
magic_square
underdetermined_system
7
[[0, 0, 25], [0, 1, 26], [0, 3, 36], [1, 0, 24], [1, 2, 27], [2, 1, 49], [2, 2, 46], [3, 2, 47], [3, 3, 28]]
554
4.838366508483887
9
44
9
["[['', '', '40', ''], ['', '31', '', '43'], ['37', '', '', '32'], ['34', '29', '', '']]", 4, 24, 50]
["[['', '', '40', ''], ['', '31', '', '43'], ['37', '', '', '32'], ['34', '29', '', '']]", 24, 50, [1, 3], [1, 3], [135, 160], [125, 164], 146]
["[['', '', '40', ''], ['', '31', '', '43'], ['37', '', '', '32'], ['34', '29', '', '']]", "24", "50", "[None, 135, 160, None]", "[None, 125, 164, None]", "146"]
41
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 2, 1: 1, 2: 2, 3: 8, 4: 4, 5: 3, 6: 6, 7: 3}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Green', 'Blue', 'Yellow', 'Green', 'Blue'], ['Black', 'Green', 'Red', 'Red', 'Black'], [], ['Blue', 'Yellow', 'Red', 'Black', 'Yellow'], [], [], ['Blue', 'Red', 'Black', 'Yellow', 'Green'], []]
restricted_sorting
sorting
2
[[6, 2], [6, 4], [6, 5], [6, 7], [0, 6], [1, 5], [1, 6], [0, 2], [0, 7], [0, 6], [1, 4], [1, 4], [3, 2], [3, 7], [3, 4], [1, 5], [3, 5], [3, 7], [0, 2]]
66
34.940831422805786
19
56
20
[[["Green", "Blue", "Yellow", "Green", "Blue"], ["Black", "Green", "Red", "Red", "Black"], [], ["Blue", "Yellow", "Red", "Black", "Yellow"], [], [], ["Blue", "Red", "Black", "Yellow", "Green"], []], 5, {"0": 2, "1": 1, "2": 2, "3": 8, "4": 4, "5": 3, "6": 6, "7": 3}]
[[["Green", "Blue", "Yellow", "Green", "Blue"], ["Black", "Green", "Red", "Red", "Black"], [], ["Blue", "Yellow", "Red", "Black", "Yellow"], [], [], ["Blue", "Red", "Black", "Yellow", "Green"], []], 5, {"0": 2, "1": 1, "2": 2, "3": 8, "4": 4, "5": 3, "6": 6, "7": 3}, 4]
["[['Green', 'Blue', 'Yellow', 'Green', 'Blue'], ['Black', 'Green', 'Red', 'Red', 'Black'], [], ['Blue', 'Yellow', 'Red', 'Black', 'Yellow'], [], [], ['Blue', 'Red', 'Black', 'Yellow', 'Green'], []]", "{0: 2, 1: 1, 2: 2, 3: 8, 4: 4, 5: 3, 6: 6, 7: 3}", "5", "4"]
41
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (5, 10) to his destination workshop at index (3, 0), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 4, and district 3 covering rows 5 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [19 7 11 x 3 18 8 x x x x] [12 18 6 1 13 12 14 11 13 5 19] [11 10 10 18 15 x 12 x 4 17 10] [4 3 3 7 x 19 x x x 12 9] [x x 6 19 x 4 14 x 9 4 15] [4 7 6 5 8 x 15 3 x 16 3] [13 x x 1 9 1 9 x x x x] [2 13 5 9 5 x 6 x 18 x 3] [19 x 2 9 4 13 x x x 16 6] [x x x 12 x 7 9 3 9 8 1] [x 10 x 12 3 6 x 4 12 4 x]
traffic
pathfinding
3
[[5, 10], [4, 10], [4, 9], [3, 9], [2, 9], [2, 8], [1, 8], [1, 7], [1, 6], [1, 5], [1, 4], [1, 3], [1, 2], [2, 2], [3, 2], [3, 1], [3, 0]]
142
0.02771902084350586
17
4
4
[[["19", "7", "11", "x", "3", "18", "8", "x", "x", "x", "x"], ["12", "18", "6", "1", "13", "12", "14", "11", "13", "5", "19"], ["11", "10", "10", "18", "15", "x", "12", "x", "4", "17", "10"], ["4", "3", "3", "7", "x", "19", "x", "x", "x", "12", "9"], ["x", "x", "6", "19", "x", "4", "14", "x", "9", "4", "15"], ["4", "7", "6", "5", "8", "x", "15", "3", "x", "16", "3"], ["13", "x", "x", "1", "9", "1", "9", "x", "x", "x", "x"], ["2", "13", "5", "9", "5", "x", "6", "x", "18", "x", "3"], ["19", "x", "2", "9", "4", "13", "x", "x", "x", "16", "6"], ["x", "x", "x", "12", "x", "7", "9", "3", "9", "8", "1"], ["x", "10", "x", "12", "3", "6", "x", "4", "12", "4", "x"]]]
[[["19", "7", "11", "x", "3", "18", "8", "x", "x", "x", "x"], ["12", "18", "6", "1", "13", "12", "14", "11", "13", "5", "19"], ["11", "10", "10", "18", "15", "x", "12", "x", "4", "17", "10"], ["4", "3", "3", "7", "x", "19", "x", "x", "x", "12", "9"], ["x", "x", "6", "19", "x", "4", "14", "x", "9", "4", "15"], ["4", "7", "6", "5", "8", "x", "15", "3", "x", "16", "3"], ["13", "x", "x", "1", "9", "1", "9", "x", "x", "x", "x"], ["2", "13", "5", "9", "5", "x", "6", "x", "18", "x", "3"], ["19", "x", "2", "9", "4", "13", "x", "x", "x", "16", "6"], ["x", "x", "x", "12", "x", "7", "9", "3", "9", "8", "1"], ["x", "10", "x", "12", "3", "6", "x", "4", "12", "4", "x"]], [5, 10], [3, 0], 3, 4]
["[['19', '7', '11', 'x', '3', '18', '8', 'x', 'x', 'x', 'x'], ['12', '18', '6', '1', '13', '12', '14', '11', '13', '5', '19'], ['11', '10', '10', '18', '15', 'x', '12', 'x', '4', '17', '10'], ['4', '3', '3', '7', 'x', '19', 'x', 'x', 'x', '12', '9'], ['x', 'x', '6', '19', 'x', '4', '14', 'x', '9', '4', '15'], ['4', '7', '6', '5', '8', 'x', '15', '3', 'x', '16', '3'], ['13', 'x', 'x', '1', '9', '1', '9', 'x', 'x', 'x', 'x'], ['2', '13', '5', '9', '5', 'x', '6', 'x', '18', 'x', '3'], ['19', 'x', '2', '9', '4', '13', 'x', 'x', 'x', '16', '6'], ['x', 'x', 'x', '12', 'x', '7', '9', '3', '9', '8', '1'], ['x', '10', 'x', '12', '3', '6', 'x', '4', '12', '4', 'x']]", "(5, 10)", "(3, 0)", "3", "4"]
41
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (10, 0) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (2, 7). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 0 1 0 0 1 1 0 0 0 1 1 1 1 1 0 1 0 0 0 0 1 0 1 1 1 0 0 0 1 1 1 0 1 0 1 1 0 0 0 0 0 1 0 1 0 1 0 1 0 0 1 1 1 1 1 1 0 1 0 0 0 0 1 1 0 1 1 0 0 0 0 0 1 0 1 1 0 0 1 0 1 1 0 0 1 1 0 1
trampoline_matrix
pathfinding
11
[[10, 0], [9, 1], [8, 1], [7, 2], [6, 3], [5, 3], [5, 4], [5, 5], [4, 5], [4, 6], [3, 6], [3, 7], [2, 7]]
13
0.023111343383789062
13
8
2
["[[1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1], [1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1], [1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1], [0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1], [1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0], [0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1]]", 3]
["[[1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1], [1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1], [1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1], [0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1], [1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0], [0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1]]", [10, 0], [2, 7], 3]
["[[1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1], [1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1], [1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1], [0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1], [1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0], [0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1]]", "(10, 0)", "(2, 7)", "3"]
41
Given 9 labeled water jugs with capacities 80, 69, 12, 52, 107, 53, 82, 95, 108 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 170, 385, 499 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 69, 3], ["+", 107, 3], ["+", 107, 3], ["+", 108, 3], ["+", 108, 3], ["+", 52, 2], ["+", 107, 2], ["+", 107, 2], ["+", 107, 2], ["+", 12, 2], ["+", 52, 1], ["+", 107, 1], ["-", 69, 1], ["+", 80, 1]]
14
0.027560949325561523
14
54
3
[[80, 69, 12, 52, 107, 53, 82, 95, 108], [170, 385, 499]]
[[80, 69, 12, 52, 107, 53, 82, 95, 108], [170, 385, 499]]
["[80, 69, 12, 52, 107, 53, 82, 95, 108]", "[170, 385, 499]"]
42
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[74, 37, 2, 22], [4, 21, '_', 54], [33, 70, 9, 11]]
8_puzzle
puzzle
4
[2, 37, 21, 70, 9, 2, 37, 22, 54, 37, 22, 21, 70, 4, 33, 9, 4, 22, 21, 54, 37, 11]
22
0.05596041679382324
22
4
12
[[[74, 37, 2, 22], [4, 21, "_", 54], [33, 70, 9, 11]]]
[[[74, 37, 2, 22], [4, 21, "_", 54], [33, 70, 9, 11]]]
["[[74, 37, 2, 22], [4, 21, '_', 54], [33, 70, 9, 11]]"]
42
In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: jerib, zoysia, reesty, griqua The initial board: [['_', 'j', 'a', 'r', 'e', 'b'], ['z', 'o', 'y', 's', 'i', 'i'], ['r', 'e', 'r', 's', 't', 'y'], ['g', 'e', 'i', 'q', 'u', 'a']]
8_puzzle_words
puzzle
3
["down-right", "down-right", "up-right", "up-left", "down-left", "down-right", "down-right", "up-right", "up-left", "up-right", "down-right", "down-left", "down-left", "up-left", "up-left", "up-right", "down-right", "down-left", "down-left", "up-left", "up-right", "up-left"]
22
0.27234864234924316
22
4
24
[[["_", "j", "a", "r", "e", "b"], ["z", "o", "y", "s", "i", "i"], ["r", "e", "r", "s", "t", "y"], ["g", "e", "i", "q", "u", "a"]]]
[[["_", "j", "a", "r", "e", "b"], ["z", "o", "y", "s", "i", "i"], ["r", "e", "r", "s", "t", "y"], ["g", "e", "i", "q", "u", "a"]], ["jerib", "zoysia", "reesty", "griqua"]]
["[['_', 'j', 'a', 'r', 'e', 'b'], ['z', 'o', 'y', 's', 'i', 'i'], ['r', 'e', 'r', 's', 't', 'y'], ['g', 'e', 'i', 'q', 'u', 'a']]", "['jerib', 'zoysia', 'reesty', 'griqua']"]
42
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'F'. Our task is to visit city H and city N excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from N and H, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. J U T S N F Y C H A M P J 0 0 0 0 0 0 1 0 0 0 1 0 U 0 0 1 0 0 0 1 1 0 0 0 1 T 1 0 0 0 1 0 0 0 1 0 0 0 S 1 1 0 0 0 0 1 0 0 0 0 1 N 1 0 0 1 0 0 0 0 0 1 1 0 F 0 0 0 0 0 0 0 0 0 1 0 0 Y 0 0 0 0 0 0 0 0 1 0 0 0 C 0 0 1 0 0 1 0 0 0 0 0 0 H 1 1 0 1 0 0 0 1 0 0 0 0 A 1 0 0 0 0 1 0 0 1 0 1 0 M 0 0 1 0 0 0 0 0 1 0 0 0 P 0 0 0 0 1 0 0 1 1 0 1 0
city_directed_graph
pathfinding
12
["F", "A", "H", "C", "T", "N", "S", "P", "N", "M", "H"]
11
0.03896760940551758
11
12
15
[[[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 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, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0]], ["J", "U", "T", "S", "N", "F", "Y", "C", "H", "A", "M", "P"], "H", "N"]
[[[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 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, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0]], ["J", "U", "T", "S", "N", "F", "Y", "C", "H", "A", "M", "P"], "F", "H", "N"]
["[[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 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, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0]]", "['J', 'U', 'T', 'S', 'N', 'F', 'Y', 'C', 'H', 'A', 'M', 'P']", "['F']", "['H', 'N']"]
42
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [24, 10, 24, 3, 21, 7, 21, 26, 8, 14, 24, 5, 13, 10, 25, 6, 9, 4, 18, 4, 15, 4, 10, 23, 6, 13, 26, 20, 8, 10, 29, 27, 27, 20, 2, 15, 9, 9, 25, 8, 2, 27, 5, 22, 19, 26, 2, 29, 12, 9, 6, 12, 2, 15, 5, 16, 3, 29, 19], such that the sum of the chosen coins adds up to 300. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {5: 2, 9: 8, 12: 5, 14: 4, 22: 8, 26: 3, 8: 7, 27: 2, 20: 13, 3: 3, 13: 3, 2: 1, 19: 19, 29: 4, 10: 3, 18: 14, 21: 12, 15: 12, 4: 3, 23: 5, 16: 9, 25: 16, 7: 4, 24: 17, 6: 6}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
35
[27, 27, 26, 2, 13, 29, 26, 27, 29, 29, 26, 2, 23, 14]
41
0.06342601776123047
14
59
59
[[24, 10, 24, 3, 21, 7, 21, 26, 8, 14, 24, 5, 13, 10, 25, 6, 9, 4, 18, 4, 15, 4, 10, 23, 6, 13, 26, 20, 8, 10, 29, 27, 27, 20, 2, 15, 9, 9, 25, 8, 2, 27, 5, 22, 19, 26, 2, 29, 12, 9, 6, 12, 2, 15, 5, 16, 3, 29, 19]]
[[24, 10, 24, 3, 21, 7, 21, 26, 8, 14, 24, 5, 13, 10, 25, 6, 9, 4, 18, 4, 15, 4, 10, 23, 6, 13, 26, 20, 8, 10, 29, 27, 27, 20, 2, 15, 9, 9, 25, 8, 2, 27, 5, 22, 19, 26, 2, 29, 12, 9, 6, 12, 2, 15, 5, 16, 3, 29, 19], {"5": 2, "9": 8, "12": 5, "14": 4, "22": 8, "26": 3, "8": 7, "27": 2, "20": 13, "3": 3, "13": 3, "2": 1, "19": 19, "29": 4, "10": 3, "18": 14, "21": 12, "15": 12, "4": 3, "23": 5, "16": 9, "25": 16, "7": 4, "24": 17, "6": 6}, 300]
["[24, 10, 24, 3, 21, 7, 21, 26, 8, 14, 24, 5, 13, 10, 25, 6, 9, 4, 18, 4, 15, 4, 10, 23, 6, 13, 26, 20, 8, 10, 29, 27, 27, 20, 2, 15, 9, 9, 25, 8, 2, 27, 5, 22, 19, 26, 2, 29, 12, 9, 6, 12, 2, 15, 5, 16, 3, 29, 19]", "{5: 2, 9: 8, 12: 5, 14: 4, 22: 8, 26: 3, 8: 7, 27: 2, 20: 13, 3: 3, 13: 3, 2: 1, 19: 19, 29: 4, 10: 3, 18: 14, 21: 12, 15: 12, 4: 3, 23: 5, 16: 9, 25: 16, 7: 4, 24: 17, 6: 6}", "300"]
42
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Green', 'Blue', 'Red'], ['Red', 'Green', 'Blue', 'Red'], ['Green', 'Red', 'Green', 'Blue']]
color_sorting
sorting
8
[[2, 0], [1, 2], [1, 0], [1, 0], [2, 1], [2, 1], [2, 1], [0, 2], [0, 1], [0, 1], [0, 2], [0, 1], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [2, 1]]
19
6.271071672439575
19
6
12
[[["Blue", "Green", "Blue", "Red"], ["Red", "Green", "Blue", "Red"], ["Green", "Red", "Green", "Blue"]], 7]
[[["Blue", "Green", "Blue", "Red"], ["Red", "Green", "Blue", "Red"], ["Green", "Red", "Green", "Blue"]], 7]
["[['Blue', 'Green', 'Blue', 'Red'], ['Red', 'Green', 'Blue', 'Red'], ['Green', 'Red', 'Green', 'Blue']]", "7"]
42
We have a 3x3 numerical grid, with numbers ranging from 45 to 98 (45 included in the range but 98 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['46' '80' '90'] ['51' 'x' 'x'] ['x' 'x' 'x']]
consecutive_grid
underdetermined_system
9
[[1, 1, 49], [1, 2, 47], [2, 0, 52], [2, 1, 48], [2, 2, 45]]
538
0.20381546020507812
5
53
9
["[['46', '80', '90'], ['51', '', ''], ['', '', '']]", 45, 98]
["[['46', '80', '90'], ['51', '', ''], ['', '', '']]", 45, 98]
["[['46', '80', '90'], ['51', '', ''], ['', '', '']]", "45", "98"]
42
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 24 to 50. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 141, 134, None for columns 1 to 2 respectively, and the sums of rows must be None, 133, 150, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 155. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' '42' 'x' 'x'] ['x' '38' 'x' 'x'] ['x' '36' '46' 'x'] ['49' '25' '24' 'x']]
magic_square
underdetermined_system
7
[[0, 0, 26], [0, 2, 27], [0, 3, 33], [1, 0, 28], [1, 2, 37], [1, 3, 30], [2, 0, 29], [2, 3, 39], [3, 3, 31]]
540
0.6481747627258301
9
44
9
["[['', '42', '', ''], ['', '38', '', ''], ['', '36', '46', ''], ['49', '25', '24', '']]", 4, 24, 50]
["[['', '42', '', ''], ['', '38', '', ''], ['', '36', '46', ''], ['49', '25', '24', '']]", 24, 50, [1, 3], [1, 3], [141, 134], [133, 150], 155]
["[['', '42', '', ''], ['', '38', '', ''], ['', '36', '46', ''], ['49', '25', '24', '']]", "24", "50", "[None, 141, 134, None]", "[None, 133, 150, None]", "155"]
42
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 7, 1: 5, 2: 7, 3: 2, 4: 6, 5: 7, 6: 5, 7: 3}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Blue', 'Black', 'Yellow', 'Black', 'Red'], ['Blue', 'Blue', 'Green', 'Black', 'Yellow'], [], ['Yellow', 'Red', 'Red', 'Green', 'Green'], [], [], ['Red', 'Blue', 'Black', 'Green', 'Yellow'], []]
restricted_sorting
sorting
2
[[0, 7], [6, 4], [6, 7], [3, 2], [3, 4], [3, 4], [1, 7], [1, 7], [1, 3], [1, 5], [6, 5], [6, 3], [0, 5], [0, 1], [0, 5], [0, 4], [2, 1], [6, 1]]
90
0.08126401901245117
18
56
20
[[["Blue", "Black", "Yellow", "Black", "Red"], ["Blue", "Blue", "Green", "Black", "Yellow"], [], ["Yellow", "Red", "Red", "Green", "Green"], [], [], ["Red", "Blue", "Black", "Green", "Yellow"], []], 5, {"0": 7, "1": 5, "2": 7, "3": 2, "4": 6, "5": 7, "6": 5, "7": 3}]
[[["Blue", "Black", "Yellow", "Black", "Red"], ["Blue", "Blue", "Green", "Black", "Yellow"], [], ["Yellow", "Red", "Red", "Green", "Green"], [], [], ["Red", "Blue", "Black", "Green", "Yellow"], []], 5, {"0": 7, "1": 5, "2": 7, "3": 2, "4": 6, "5": 7, "6": 5, "7": 3}, 4]
["[['Blue', 'Black', 'Yellow', 'Black', 'Red'], ['Blue', 'Blue', 'Green', 'Black', 'Yellow'], [], ['Yellow', 'Red', 'Red', 'Green', 'Green'], [], [], ['Red', 'Blue', 'Black', 'Green', 'Yellow'], []]", "{0: 7, 1: 5, 2: 7, 3: 2, 4: 6, 5: 7, 6: 5, 7: 3}", "5", "4"]
42
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (6, 10) to his destination workshop at index (3, 2), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 5, and district 3 covering rows 6 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [14 x 11 x x 8 15 17 18 x 11] [13 9 2 7 9 12 7 x x x 12] [x 2 8 13 5 x x 7 18 x x] [19 6 1 6 19 13 14 x x 17 x] [x 9 6 x x 14 10 x x 5 x] [12 x x x 7 17 11 x x 1 x] [x 16 x 2 11 15 6 x 14 14 4] [x 15 14 11 x 17 20 18 4 16 8] [x 3 6 4 1 5 x x 3 7 9] [18 14 3 4 x x x 12 15 10 x] [x 8 x 1 18 x x x x x x]
traffic
pathfinding
3
[[6, 10], [7, 10], [7, 9], [7, 8], [7, 7], [7, 6], [6, 6], [5, 6], [4, 6], [3, 6], [3, 5], [3, 4], [3, 3], [3, 2]]
146
0.027129411697387695
14
4
4
[[["14", "x", "11", "x", "x", "8", "15", "17", "18", "x", "11"], ["13", "9", "2", "7", "9", "12", "7", "x", "x", "x", "12"], ["x", "2", "8", "13", "5", "x", "x", "7", "18", "x", "x"], ["19", "6", "1", "6", "19", "13", "14", "x", "x", "17", "x"], ["x", "9", "6", "x", "x", "14", "10", "x", "x", "5", "x"], ["12", "x", "x", "x", "7", "17", "11", "x", "x", "1", "x"], ["x", "16", "x", "2", "11", "15", "6", "x", "14", "14", "4"], ["x", "15", "14", "11", "x", "17", "20", "18", "4", "16", "8"], ["x", "3", "6", "4", "1", "5", "x", "x", "3", "7", "9"], ["18", "14", "3", "4", "x", "x", "x", "12", "15", "10", "x"], ["x", "8", "x", "1", "18", "x", "x", "x", "x", "x", "x"]]]
[[["14", "x", "11", "x", "x", "8", "15", "17", "18", "x", "11"], ["13", "9", "2", "7", "9", "12", "7", "x", "x", "x", "12"], ["x", "2", "8", "13", "5", "x", "x", "7", "18", "x", "x"], ["19", "6", "1", "6", "19", "13", "14", "x", "x", "17", "x"], ["x", "9", "6", "x", "x", "14", "10", "x", "x", "5", "x"], ["12", "x", "x", "x", "7", "17", "11", "x", "x", "1", "x"], ["x", "16", "x", "2", "11", "15", "6", "x", "14", "14", "4"], ["x", "15", "14", "11", "x", "17", "20", "18", "4", "16", "8"], ["x", "3", "6", "4", "1", "5", "x", "x", "3", "7", "9"], ["18", "14", "3", "4", "x", "x", "x", "12", "15", "10", "x"], ["x", "8", "x", "1", "18", "x", "x", "x", "x", "x", "x"]], [6, 10], [3, 2], 3, 5]
["[['14', 'x', '11', 'x', 'x', '8', '15', '17', '18', 'x', '11'], ['13', '9', '2', '7', '9', '12', '7', 'x', 'x', 'x', '12'], ['x', '2', '8', '13', '5', 'x', 'x', '7', '18', 'x', 'x'], ['19', '6', '1', '6', '19', '13', '14', 'x', 'x', '17', 'x'], ['x', '9', '6', 'x', 'x', '14', '10', 'x', 'x', '5', 'x'], ['12', 'x', 'x', 'x', '7', '17', '11', 'x', 'x', '1', 'x'], ['x', '16', 'x', '2', '11', '15', '6', 'x', '14', '14', '4'], ['x', '15', '14', '11', 'x', '17', '20', '18', '4', '16', '8'], ['x', '3', '6', '4', '1', '5', 'x', 'x', '3', '7', '9'], ['18', '14', '3', '4', 'x', 'x', 'x', '12', '15', '10', 'x'], ['x', '8', 'x', '1', '18', 'x', 'x', 'x', 'x', 'x', 'x']]", "(6, 10)", "(3, 2)", "3", "5"]
42
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (10, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (3, 1). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 0 1 0 0 0 1 1 1 0 0 1 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 1 0 0 1 1 1 0 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 0 1 0 0 1 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 1 0 1 0 1 0 0 0 1 0 0 1 1 1 1 0 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 1
trampoline_matrix
pathfinding
11
[[10, 9], [10, 8], [9, 7], [8, 6], [8, 5], [7, 4], [7, 3], [7, 2], [6, 2], [5, 2], [4, 2], [4, 1], [3, 1]]
13
0.029900312423706055
13
8
2
["[[0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0], [1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1], [0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0], [1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1], [1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]", 3]
["[[0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0], [1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1], [0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0], [1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1], [1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]", [10, 9], [3, 1], 3]
["[[0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0], [1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1], [0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0], [1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], [1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1], [1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]]", "(10, 9)", "(3, 1)", "3"]
42
Given 9 labeled water jugs with capacities 36, 72, 16, 80, 45, 67, 38, 32, 149, 37 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 201, 202, 233 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 32, 3], ["+", 36, 3], ["+", 149, 3], ["+", 16, 3], ["+", 37, 2], ["+", 149, 2], ["+", 16, 2], ["+", 36, 1], ["+", 149, 1], ["+", 16, 1]]
10
0.032448768615722656
10
60
3
[[36, 72, 16, 80, 45, 67, 38, 32, 149, 37], [201, 202, 233]]
[[36, 72, 16, 80, 45, 67, 38, 32, 149, 37], [201, 202, 233]]
["[36, 72, 16, 80, 45, 67, 38, 32, 149, 37]", "[201, 202, 233]"]
43
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[52, '_', 99, 42], [56, 67, 49, 68], [88, 23, 33, 26]]
8_puzzle
puzzle
5
[99, 49, 68, 42, 49, 68, 67, 23, 88, 56, 52, 99, 68, 67, 23, 88, 33, 26, 42, 49, 67, 68, 88, 52, 56, 33, 26, 23, 49, 42]
30
0.6710901260375977
30
4
12
[[[52, "_", 99, 42], [56, 67, 49, 68], [88, 23, 33, 26]]]
[[[52, "_", 99, 42], [56, 67, 49, 68], [88, 23, 33, 26]]]
["[[52, '_', 99, 42], [56, 67, 49, 68], [88, 23, 33, 26]]"]
43
In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: dione, palmad, ancona, saltly The initial board: [['a', 'd', 'a', 'o', 'n', 'e'], ['p', 'm', 'l', 'n', 'a', 'i'], ['_', 'n', 'c', 'o', 'd', 'a'], ['s', 'a', 'l', 't', 'l', 'y']]
8_puzzle_words
puzzle
3
["down-right", "up-right", "down-right", "up-right", "up-right", "up-left", "down-left", "down-right", "down-left", "up-left", "up-left", "up-right", "down-right", "up-right", "down-right", "down-left", "up-left", "down-left", "down-left", "up-left", "up-right", "up-left"]
22
0.4346792697906494
22
4
24
[[["a", "d", "a", "o", "n", "e"], ["p", "m", "l", "n", "a", "i"], ["_", "n", "c", "o", "d", "a"], ["s", "a", "l", "t", "l", "y"]]]
[[["a", "d", "a", "o", "n", "e"], ["p", "m", "l", "n", "a", "i"], ["_", "n", "c", "o", "d", "a"], ["s", "a", "l", "t", "l", "y"]], ["dione", "palmad", "ancona", "saltly"]]
["[['a', 'd', 'a', 'o', 'n', 'e'], ['p', 'm', 'l', 'n', 'a', 'i'], ['_', 'n', 'c', 'o', 'd', 'a'], ['s', 'a', 'l', 't', 'l', 'y']]", "['dione', 'palmad', 'ancona', 'saltly']"]
43
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'Y'. Our task is to visit city E and city M excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from M and E, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. Y E L P M C B I G V J T Y 0 0 0 0 0 0 0 0 0 0 1 0 E 0 0 0 1 0 0 1 0 0 0 0 0 L 0 1 0 0 1 1 0 0 0 0 0 1 P 0 0 1 0 0 0 0 0 0 0 0 0 M 0 0 0 1 0 0 0 0 0 0 0 1 C 0 0 0 1 1 0 1 0 0 0 0 0 B 0 1 0 1 0 0 0 0 0 1 0 0 I 1 1 0 0 1 0 1 0 1 0 0 0 G 1 1 0 0 0 0 0 0 0 0 0 0 V 0 0 0 0 1 0 0 0 0 0 0 0 J 0 0 0 1 0 0 1 1 1 0 0 1 T 0 0 0 0 0 1 0 1 1 0 0 0
city_directed_graph
pathfinding
12
["Y", "J", "I", "M", "P", "L", "M", "T", "G", "E", "B", "E"]
12
0.034844398498535156
12
12
15
[[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 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, 1, 0, 0, 1, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0]], ["Y", "E", "L", "P", "M", "C", "B", "I", "G", "V", "J", "T"], "E", "M"]
[[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 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, 1, 0, 0, 1, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0]], ["Y", "E", "L", "P", "M", "C", "B", "I", "G", "V", "J", "T"], "Y", "E", "M"]
["[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 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, 1, 0, 0, 1, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0]]", "['Y', 'E', 'L', 'P', 'M', 'C', 'B', 'I', 'G', 'V', 'J', 'T']", "['Y']", "['E', 'M']"]
43
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [69, 32, 32, 6, 19, 13, 21, 68, 32, 16, 21, 29, 20, 13, 21, 24, 26, 5, 23, 18, 16, 24, 2, 17, 15, 30, 26], such that the sum of the chosen coins adds up to 322. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {30: 3, 20: 11, 24: 15, 26: 6, 68: 2, 29: 5, 13: 2, 2: 1, 17: 2, 32: 11, 18: 4, 15: 9, 5: 3, 21: 11, 69: 19, 6: 3, 16: 4, 23: 17, 19: 15}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
15
[68, 30, 16, 17, 29, 26, 6, 13, 69, 32, 16]
61
0.04106879234313965
11
27
27
[[69, 32, 32, 6, 19, 13, 21, 68, 32, 16, 21, 29, 20, 13, 21, 24, 26, 5, 23, 18, 16, 24, 2, 17, 15, 30, 26]]
[[69, 32, 32, 6, 19, 13, 21, 68, 32, 16, 21, 29, 20, 13, 21, 24, 26, 5, 23, 18, 16, 24, 2, 17, 15, 30, 26], {"30": 3, "20": 11, "24": 15, "26": 6, "68": 2, "29": 5, "13": 2, "2": 1, "17": 2, "32": 11, "18": 4, "15": 9, "5": 3, "21": 11, "69": 19, "6": 3, "16": 4, "23": 17, "19": 15}, 322]
["[69, 32, 32, 6, 19, 13, 21, 68, 32, 16, 21, 29, 20, 13, 21, 24, 26, 5, 23, 18, 16, 24, 2, 17, 15, 30, 26]", "{30: 3, 20: 11, 24: 15, 26: 6, 68: 2, 29: 5, 13: 2, 2: 1, 17: 2, 32: 11, 18: 4, 15: 9, 5: 3, 21: 11, 69: 19, 6: 3, 16: 4, 23: 17, 19: 15}", "322"]
43
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Green', 'Green', 'Blue', 'Red'], ['Red', 'Blue', 'Green', 'Blue'], ['Green', 'Blue', 'Red', 'Red']]
color_sorting
sorting
8
[[0, 2], [0, 2], [0, 1], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [1, 0], [1, 2], [1, 0], [1, 2], [0, 1], [0, 1], [0, 1], [2, 0]]
17
2.007240056991577
17
6
12
[[["Green", "Green", "Blue", "Red"], ["Red", "Blue", "Green", "Blue"], ["Green", "Blue", "Red", "Red"]], 7]
[[["Green", "Green", "Blue", "Red"], ["Red", "Blue", "Green", "Blue"], ["Green", "Blue", "Red", "Red"]], 7]
["[['Green', 'Green', 'Blue', 'Red'], ['Red', 'Blue', 'Green', 'Blue'], ['Green', 'Blue', 'Red', 'Red']]", "7"]
43
We have a 3x3 numerical grid, with numbers ranging from 7 to 60 (7 included in the range but 60 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['13' 'x' 'x'] ['x' 'x' '27'] ['x' '26' 'x']]
consecutive_grid
underdetermined_system
10
[[0, 1, 8], [0, 2, 7], [1, 0, 10], [1, 1, 11], [2, 0, 9], [2, 2, 28]]
142
20.925482749938965
6
53
9
["[['13', '', ''], ['', '', '27'], ['', '26', '']]", 7, 60]
["[['13', '', ''], ['', '', '27'], ['', '26', '']]", 7, 60]
["[['13', '', ''], ['', '', '27'], ['', '26', '']]", "7", "60"]
43
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 35 to 61. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 212, 185, None for columns 1 to 2 respectively, and the sums of rows must be None, 180, 202, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 193. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' '51' '39' 'x'] ['x' 'x' '48' '37'] ['54' 'x' 'x' 'x'] ['x' 'x' 'x' '53']]
magic_square
underdetermined_system
7
[[0, 0, 35], [0, 3, 40], [1, 0, 38], [1, 1, 57], [2, 1, 60], [2, 2, 52], [2, 3, 36], [3, 0, 45], [3, 1, 44], [3, 2, 46]]
735
81.89644312858582
10
44
9
["[['', '51', '39', ''], ['', '', '48', '37'], ['54', '', '', ''], ['', '', '', '53']]", 4, 35, 61]
["[['', '51', '39', ''], ['', '', '48', '37'], ['54', '', '', ''], ['', '', '', '53']]", 35, 61, [1, 3], [1, 3], [212, 185], [180, 202], 193]
["[['', '51', '39', ''], ['', '', '48', '37'], ['54', '', '', ''], ['', '', '', '53']]", "35", "61", "[None, 212, 185, None]", "[None, 180, 202, None]", "193"]
43
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 5, 1: 2, 2: 8, 3: 7, 4: 5, 5: 6, 6: 1, 7: 1}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Green', 'Green', 'Red', 'Blue', 'Red'], ['Black', 'Red', 'Black', 'Red', 'Green'], ['Yellow', 'Green', 'Black', 'Black', 'Blue'], [], ['Blue', 'Yellow', 'Blue', 'Yellow', 'Yellow'], [], [], []]
restricted_sorting
sorting
2
[[1, 5], [4, 7], [4, 3], [1, 6], [1, 5], [4, 7], [2, 4], [1, 6], [2, 1], [2, 5], [2, 5], [3, 4], [0, 1], [0, 1], [0, 6], [0, 7], [0, 6], [2, 7]]
55
19.498444318771362
18
56
20
[[["Green", "Green", "Red", "Blue", "Red"], ["Black", "Red", "Black", "Red", "Green"], ["Yellow", "Green", "Black", "Black", "Blue"], [], ["Blue", "Yellow", "Blue", "Yellow", "Yellow"], [], [], []], 5, {"0": 5, "1": 2, "2": 8, "3": 7, "4": 5, "5": 6, "6": 1, "7": 1}]
[[["Green", "Green", "Red", "Blue", "Red"], ["Black", "Red", "Black", "Red", "Green"], ["Yellow", "Green", "Black", "Black", "Blue"], [], ["Blue", "Yellow", "Blue", "Yellow", "Yellow"], [], [], []], 5, {"0": 5, "1": 2, "2": 8, "3": 7, "4": 5, "5": 6, "6": 1, "7": 1}, 4]
["[['Green', 'Green', 'Red', 'Blue', 'Red'], ['Black', 'Red', 'Black', 'Red', 'Green'], ['Yellow', 'Green', 'Black', 'Black', 'Blue'], [], ['Blue', 'Yellow', 'Blue', 'Yellow', 'Yellow'], [], [], []]", "{0: 5, 1: 2, 2: 8, 3: 7, 4: 5, 5: 6, 6: 1, 7: 1}", "5", "4"]
43
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 10) to his destination workshop at index (6, 2), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 5, and district 3 covering rows 6 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x 10 2 x x x 3 x 4 x 14] [x x 17 16 8 x x x x 1 x] [18 18 16 16 15 x x 17 12 16 15] [x 4 x x 18 9 x 15 x 1 9] [3 2 7 x x 17 2 14 x 4 2] [16 17 6 4 9 2 5 7 x x 7] [x x 12 x x 16 1 11 x x 4] [x x 13 x x 19 16 9 x x x] [x x x 9 7 x 11 5 x x x] [x 2 x x x 4 5 x 10 x x] [x x x 12 16 x 6 16 x 18 7]
traffic
pathfinding
3
[[3, 10], [3, 9], [2, 9], [2, 8], [2, 7], [3, 7], [4, 7], [4, 6], [5, 6], [5, 5], [5, 4], [5, 3], [5, 2], [6, 2]]
115
0.026669740676879883
14
4
4
[[["x", "10", "2", "x", "x", "x", "3", "x", "4", "x", "14"], ["x", "x", "17", "16", "8", "x", "x", "x", "x", "1", "x"], ["18", "18", "16", "16", "15", "x", "x", "17", "12", "16", "15"], ["x", "4", "x", "x", "18", "9", "x", "15", "x", "1", "9"], ["3", "2", "7", "x", "x", "17", "2", "14", "x", "4", "2"], ["16", "17", "6", "4", "9", "2", "5", "7", "x", "x", "7"], ["x", "x", "12", "x", "x", "16", "1", "11", "x", "x", "4"], ["x", "x", "13", "x", "x", "19", "16", "9", "x", "x", "x"], ["x", "x", "x", "9", "7", "x", "11", "5", "x", "x", "x"], ["x", "2", "x", "x", "x", "4", "5", "x", "10", "x", "x"], ["x", "x", "x", "12", "16", "x", "6", "16", "x", "18", "7"]]]
[[["x", "10", "2", "x", "x", "x", "3", "x", "4", "x", "14"], ["x", "x", "17", "16", "8", "x", "x", "x", "x", "1", "x"], ["18", "18", "16", "16", "15", "x", "x", "17", "12", "16", "15"], ["x", "4", "x", "x", "18", "9", "x", "15", "x", "1", "9"], ["3", "2", "7", "x", "x", "17", "2", "14", "x", "4", "2"], ["16", "17", "6", "4", "9", "2", "5", "7", "x", "x", "7"], ["x", "x", "12", "x", "x", "16", "1", "11", "x", "x", "4"], ["x", "x", "13", "x", "x", "19", "16", "9", "x", "x", "x"], ["x", "x", "x", "9", "7", "x", "11", "5", "x", "x", "x"], ["x", "2", "x", "x", "x", "4", "5", "x", "10", "x", "x"], ["x", "x", "x", "12", "16", "x", "6", "16", "x", "18", "7"]], [3, 10], [6, 2], 3, 5]
["[['x', '10', '2', 'x', 'x', 'x', '3', 'x', '4', 'x', '14'], ['x', 'x', '17', '16', '8', 'x', 'x', 'x', 'x', '1', 'x'], ['18', '18', '16', '16', '15', 'x', 'x', '17', '12', '16', '15'], ['x', '4', 'x', 'x', '18', '9', 'x', '15', 'x', '1', '9'], ['3', '2', '7', 'x', 'x', '17', '2', '14', 'x', '4', '2'], ['16', '17', '6', '4', '9', '2', '5', '7', 'x', 'x', '7'], ['x', 'x', '12', 'x', 'x', '16', '1', '11', 'x', 'x', '4'], ['x', 'x', '13', 'x', 'x', '19', '16', '9', 'x', 'x', 'x'], ['x', 'x', 'x', '9', '7', 'x', '11', '5', 'x', 'x', 'x'], ['x', '2', 'x', 'x', 'x', '4', '5', 'x', '10', 'x', 'x'], ['x', 'x', 'x', '12', '16', 'x', '6', '16', 'x', '18', '7']]", "(3, 10)", "(6, 2)", "3", "5"]
43
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (10, 10) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (2, 1). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 0 0 1 1 0 1 0 1 1 1 1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 0 0 1 0 0 0 1 1 1 0 0 1 0 1 1 0 1 1 0 0 0 0 1 0 1 0 0 1 1 0 1 1 0
trampoline_matrix
pathfinding
11
[[10, 10], [9, 9], [8, 9], [7, 8], [6, 7], [5, 7], [5, 6], [5, 5], [4, 5], [3, 5], [3, 4], [3, 3], [3, 2], [2, 2], [2, 1]]
15
0.028983116149902344
15
8
2
["[[1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1], [1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1], [1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1], [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0], [1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0]]", 3]
["[[1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1], [1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1], [1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1], [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0], [1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0]]", [10, 10], [2, 1], 3]
["[[1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1], [1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1], [1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1], [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0], [1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0]]", "(10, 10)", "(2, 1)", "3"]
43
Given 9 labeled water jugs with capacities 104, 14, 83, 46, 128, 34, 137, 15, 19, 126 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 342, 373, 447 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 34, 3], ["+", 126, 3], ["+", 137, 3], ["+", 46, 3], ["+", 104, 3], ["+", 104, 2], ["+", 126, 2], ["+", 15, 2], ["+", 128, 2], ["+", 104, 1], ["+", 126, 1], ["-", 14, 1], ["+", 126, 1]]
13
0.06156110763549805
13
60
3
[[104, 14, 83, 46, 128, 34, 137, 15, 19, 126], [342, 373, 447]]
[[104, 14, 83, 46, 128, 34, 137, 15, 19, 126], [342, 373, 447]]
["[104, 14, 83, 46, 128, 34, 137, 15, 19, 126]", "[342, 373, 447]"]
44
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[81, '_', 58, 10], [85, 22, 23, 54], [100, 21, 27, 12]]
8_puzzle
puzzle
5
[22, 23, 54, 10, 58, 22, 23, 54, 22, 23, 81, 85, 100, 21, 27, 12, 10, 22, 23, 81, 85, 100, 54, 27, 12, 10]
26
0.062206268310546875
26
4
12
[[[81, "_", 58, 10], [85, 22, 23, 54], [100, 21, 27, 12]]]
[[[81, "_", 58, 10], [85, 22, 23, 54], [100, 21, 27, 12]]]
["[[81, '_', 58, 10], [85, 22, 23, 54], [100, 21, 27, 12]]"]
44
In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: besit, thrive, kincob, humate The initial board: [['h', 'b', 'n', 's', 'i', 't'], ['t', 'e', 'r', 'k', 'v', 'e'], ['i', 'i', '_', 'c', 'o', 'b'], ['h', 'u', 'm', 'a', 't', 'e']]
8_puzzle_words
puzzle
3
["up-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "down-right", "down-left", "up-left", "up-right", "down-right", "up-right", "up-left", "down-left", "up-left"]
16
0.3068218231201172
16
4
24
[[["h", "b", "n", "s", "i", "t"], ["t", "e", "r", "k", "v", "e"], ["i", "i", "_", "c", "o", "b"], ["h", "u", "m", "a", "t", "e"]]]
[[["h", "b", "n", "s", "i", "t"], ["t", "e", "r", "k", "v", "e"], ["i", "i", "_", "c", "o", "b"], ["h", "u", "m", "a", "t", "e"]], ["besit", "thrive", "kincob", "humate"]]
["[['h', 'b', 'n', 's', 'i', 't'], ['t', 'e', 'r', 'k', 'v', 'e'], ['i', 'i', '_', 'c', 'o', 'b'], ['h', 'u', 'm', 'a', 't', 'e']]", "['besit', 'thrive', 'kincob', 'humate']"]
44
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'E'. Our task is to visit city D and city T excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from T and D, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. H F C E T V R I M Z L D H 0 0 0 0 1 0 0 0 0 0 0 0 F 0 0 0 0 0 0 1 0 0 0 1 1 C 0 0 0 0 0 0 0 0 0 0 1 0 E 0 0 1 0 0 1 0 0 0 0 0 0 T 1 0 0 0 0 0 0 0 1 1 0 1 V 0 1 1 0 0 0 0 1 0 0 0 0 R 0 0 0 0 0 0 0 1 1 0 0 1 I 0 1 1 1 0 0 0 0 1 0 0 0 M 1 0 1 0 0 0 0 0 0 0 0 0 Z 1 0 0 0 0 0 1 0 1 0 0 0 L 0 0 1 0 1 0 1 0 1 0 0 0 D 1 1 1 0 0 1 0 1 1 1 1 0
city_directed_graph
pathfinding
12
["E", "C", "L", "T", "D", "H", "T", "D"]
8
0.028389930725097656
8
12
15
[[[0, 0, 0, 0, 1, 0, 0, 0, 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, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1], [0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0]], ["H", "F", "C", "E", "T", "V", "R", "I", "M", "Z", "L", "D"], "D", "T"]
[[[0, 0, 0, 0, 1, 0, 0, 0, 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, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1], [0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0]], ["H", "F", "C", "E", "T", "V", "R", "I", "M", "Z", "L", "D"], "E", "D", "T"]
["[[0, 0, 0, 0, 1, 0, 0, 0, 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, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1], [0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0]]", "['H', 'F', 'C', 'E', 'T', 'V', 'R', 'I', 'M', 'Z', 'L', 'D']", "['E']", "['D', 'T']"]
44
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [2, 27, 9, 80, 20, 81, 13, 24, 16, 6, 26, 12, 3, 26, 20, 8, 16, 8, 20, 22, 9, 34, 23, 8, 12, 34, 4, 6, 22, 19], such that the sum of the chosen coins adds up to 346. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {12: 9, 16: 12, 13: 5, 34: 8, 9: 9, 23: 4, 81: 2, 80: 20, 8: 1, 19: 19, 2: 2, 22: 13, 20: 7, 26: 11, 4: 1, 6: 2, 27: 4, 3: 1, 24: 12}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
16
[8, 4, 27, 8, 23, 6, 81, 80, 34, 26, 20, 8, 6, 2, 13]
71
0.03767251968383789
15
30
30
[[2, 27, 9, 80, 20, 81, 13, 24, 16, 6, 26, 12, 3, 26, 20, 8, 16, 8, 20, 22, 9, 34, 23, 8, 12, 34, 4, 6, 22, 19]]
[[2, 27, 9, 80, 20, 81, 13, 24, 16, 6, 26, 12, 3, 26, 20, 8, 16, 8, 20, 22, 9, 34, 23, 8, 12, 34, 4, 6, 22, 19], {"12": 9, "16": 12, "13": 5, "34": 8, "9": 9, "23": 4, "81": 2, "80": 20, "8": 1, "19": 19, "2": 2, "22": 13, "20": 7, "26": 11, "4": 1, "6": 2, "27": 4, "3": 1, "24": 12}, 346]
["[2, 27, 9, 80, 20, 81, 13, 24, 16, 6, 26, 12, 3, 26, 20, 8, 16, 8, 20, 22, 9, 34, 23, 8, 12, 34, 4, 6, 22, 19]", "{12: 9, 16: 12, 13: 5, 34: 8, 9: 9, 23: 4, 81: 2, 80: 20, 8: 1, 19: 19, 2: 2, 22: 13, 20: 7, 26: 11, 4: 1, 6: 2, 27: 4, 3: 1, 24: 12}", "346"]
44
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Red', 'Blue', 'Blue'], ['Red', 'Green', 'Green', 'Green'], ['Red', 'Blue', 'Blue', 'Green']]
color_sorting
sorting
8
[[0, 1], [0, 1], [2, 1], [2, 0], [2, 0], [2, 0], [1, 2], [1, 2], [1, 2], [1, 2], [0, 1]]
11
0.07266616821289062
11
6
12
[[["Red", "Red", "Blue", "Blue"], ["Red", "Green", "Green", "Green"], ["Red", "Blue", "Blue", "Green"]], 7]
[[["Red", "Red", "Blue", "Blue"], ["Red", "Green", "Green", "Green"], ["Red", "Blue", "Blue", "Green"]], 7]
["[['Red', 'Red', 'Blue', 'Blue'], ['Red', 'Green', 'Green', 'Green'], ['Red', 'Blue', 'Blue', 'Green']]", "7"]
44
We have a 3x3 numerical grid, with numbers ranging from 31 to 84 (31 included in the range but 84 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' '58' 'x'] ['42' 'x' '70'] ['x' 'x' 'x']]
consecutive_grid
underdetermined_system
10
[[0, 0, 31], [0, 2, 71], [1, 1, 43], [2, 0, 44], [2, 1, 33], [2, 2, 32]]
439
185.86225056648254
6
53
9
["[['', '58', ''], ['42', '', '70'], ['', '', '']]", 31, 84]
["[['', '58', ''], ['42', '', '70'], ['', '', '']]", 31, 84]
["[['', '58', ''], ['42', '', '70'], ['', '', '']]", "31", "84"]
44
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 35 to 61. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 188, 188, None for columns 1 to 2 respectively, and the sums of rows must be None, 177, 160, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 173. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' 'x' '39' 'x'] ['x' 'x' 'x' '43'] ['x' 'x' 'x' '47'] ['46' '49' 'x' '53']]
magic_square
underdetermined_system
7
[[0, 0, 36], [0, 1, 60], [0, 3, 38], [1, 0, 40], [1, 1, 42], [1, 2, 52], [2, 0, 35], [2, 1, 37], [2, 2, 41], [3, 2, 56]]
714
512.5996880531311
10
44
9
["[['', '', '39', ''], ['', '', '', '43'], ['', '', '', '47'], ['46', '49', '', '53']]", 4, 35, 61]
["[['', '', '39', ''], ['', '', '', '43'], ['', '', '', '47'], ['46', '49', '', '53']]", 35, 61, [1, 3], [1, 3], [188, 188], [177, 160], 173]
["[['', '', '39', ''], ['', '', '', '43'], ['', '', '', '47'], ['46', '49', '', '53']]", "35", "61", "[None, 188, 188, None]", "[None, 177, 160, None]", "173"]
44
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 6, 1: 2, 2: 7, 3: 1, 4: 1, 5: 5, 6: 3, 7: 2}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], [], ['Blue', 'Blue', 'Green', 'Black', 'Red'], [], ['Red', 'Green', 'Red', 'Black', 'Yellow'], [], ['Blue', 'Yellow', 'Green', 'Yellow', 'Black'], ['Yellow', 'Green', 'Black', 'Red', 'Blue']]
restricted_sorting
sorting
2
[[6, 0], [7, 5], [6, 5], [6, 1], [6, 5], [4, 3], [4, 1], [4, 3], [4, 6], [4, 5], [7, 1], [7, 6], [7, 3], [2, 7], [2, 7], [2, 1], [2, 6], [0, 7], [2, 3]]
53
14.416839361190796
19
56
20
[[[], [], ["Blue", "Blue", "Green", "Black", "Red"], [], ["Red", "Green", "Red", "Black", "Yellow"], [], ["Blue", "Yellow", "Green", "Yellow", "Black"], ["Yellow", "Green", "Black", "Red", "Blue"]], 5, {"0": 6, "1": 2, "2": 7, "3": 1, "4": 1, "5": 5, "6": 3, "7": 2}]
[[[], [], ["Blue", "Blue", "Green", "Black", "Red"], [], ["Red", "Green", "Red", "Black", "Yellow"], [], ["Blue", "Yellow", "Green", "Yellow", "Black"], ["Yellow", "Green", "Black", "Red", "Blue"]], 5, {"0": 6, "1": 2, "2": 7, "3": 1, "4": 1, "5": 5, "6": 3, "7": 2}, 4]
["[[], [], ['Blue', 'Blue', 'Green', 'Black', 'Red'], [], ['Red', 'Green', 'Red', 'Black', 'Yellow'], [], ['Blue', 'Yellow', 'Green', 'Yellow', 'Black'], ['Yellow', 'Green', 'Black', 'Red', 'Blue']]", "{0: 6, 1: 2, 2: 7, 3: 1, 4: 1, 5: 5, 6: 3, 7: 2}", "5", "4"]
44
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (8, 10) to his destination workshop at index (3, 4), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 2, district 2 covering rows 3 to 7, and district 3 covering rows 8 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x 16 5 13 x x 2 x 6 x x] [x x 17 x 15 x 10 x 5 17 x] [x x x x 15 3 10 2 4 13 14] [x x x x 17 2 4 x 1 4 5] [2 x x 2 6 17 x x x 4 19] [19 5 x x x x 10 12 1 18 10] [x 3 x 12 x 10 15 11 x 4 15] [2 x 11 9 x 12 11 x 15 10 6] [19 x 16 5 x x x 11 x 11 8] [12 2 x 3 x 4 x x 15 x x] [x x 18 16 x x 4 x 12 13 x]
traffic
pathfinding
3
[[8, 10], [7, 10], [7, 9], [6, 9], [5, 9], [4, 9], [3, 9], [3, 8], [2, 8], [2, 7], [2, 6], [2, 5], [3, 5], [3, 4]]
85
0.02710127830505371
14
4
4
[[["x", "16", "5", "13", "x", "x", "2", "x", "6", "x", "x"], ["x", "x", "17", "x", "15", "x", "10", "x", "5", "17", "x"], ["x", "x", "x", "x", "15", "3", "10", "2", "4", "13", "14"], ["x", "x", "x", "x", "17", "2", "4", "x", "1", "4", "5"], ["2", "x", "x", "2", "6", "17", "x", "x", "x", "4", "19"], ["19", "5", "x", "x", "x", "x", "10", "12", "1", "18", "10"], ["x", "3", "x", "12", "x", "10", "15", "11", "x", "4", "15"], ["2", "x", "11", "9", "x", "12", "11", "x", "15", "10", "6"], ["19", "x", "16", "5", "x", "x", "x", "11", "x", "11", "8"], ["12", "2", "x", "3", "x", "4", "x", "x", "15", "x", "x"], ["x", "x", "18", "16", "x", "x", "4", "x", "12", "13", "x"]]]
[[["x", "16", "5", "13", "x", "x", "2", "x", "6", "x", "x"], ["x", "x", "17", "x", "15", "x", "10", "x", "5", "17", "x"], ["x", "x", "x", "x", "15", "3", "10", "2", "4", "13", "14"], ["x", "x", "x", "x", "17", "2", "4", "x", "1", "4", "5"], ["2", "x", "x", "2", "6", "17", "x", "x", "x", "4", "19"], ["19", "5", "x", "x", "x", "x", "10", "12", "1", "18", "10"], ["x", "3", "x", "12", "x", "10", "15", "11", "x", "4", "15"], ["2", "x", "11", "9", "x", "12", "11", "x", "15", "10", "6"], ["19", "x", "16", "5", "x", "x", "x", "11", "x", "11", "8"], ["12", "2", "x", "3", "x", "4", "x", "x", "15", "x", "x"], ["x", "x", "18", "16", "x", "x", "4", "x", "12", "13", "x"]], [8, 10], [3, 4], 2, 7]
["[['x', '16', '5', '13', 'x', 'x', '2', 'x', '6', 'x', 'x'], ['x', 'x', '17', 'x', '15', 'x', '10', 'x', '5', '17', 'x'], ['x', 'x', 'x', 'x', '15', '3', '10', '2', '4', '13', '14'], ['x', 'x', 'x', 'x', '17', '2', '4', 'x', '1', '4', '5'], ['2', 'x', 'x', '2', '6', '17', 'x', 'x', 'x', '4', '19'], ['19', '5', 'x', 'x', 'x', 'x', '10', '12', '1', '18', '10'], ['x', '3', 'x', '12', 'x', '10', '15', '11', 'x', '4', '15'], ['2', 'x', '11', '9', 'x', '12', '11', 'x', '15', '10', '6'], ['19', 'x', '16', '5', 'x', 'x', 'x', '11', 'x', '11', '8'], ['12', '2', 'x', '3', 'x', '4', 'x', 'x', '15', 'x', 'x'], ['x', 'x', '18', '16', 'x', 'x', '4', 'x', '12', '13', 'x']]", "(8, 10)", "(3, 4)", "2", "7"]
44
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (2, 1) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (10, 9). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 1 1 1 0 1 0 1 1 1 0 0 1 1 1 0 1 0 0 1 1 0 0 0 1 1 1 0 0 1 0 1 1 0 0 1 1 0 0 0 1 0 1 1 0 0 1 0 1 1 0 1 1 0 0 0 0 1 0 0 1 1 0 1 1 0 1 1 0 1 1 1 1 0 1 0 0 0 1 1 0 1 1 1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1
trampoline_matrix
pathfinding
11
[[2, 1], [2, 2], [3, 2], [4, 2], [5, 2], [6, 3], [7, 4], [8, 5], [8, 6], [8, 7], [8, 8], [8, 9], [9, 9], [10, 9]]
14
0.028450727462768555
14
8
2
["[[1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1], [0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1], [0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1], [0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1]]", 3]
["[[1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1], [0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1], [0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1], [0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1]]", [2, 1], [10, 9], 3]
["[[1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1], [0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1], [0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1], [0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1]]", "(2, 1)", "(10, 9)", "3"]
44
Given 9 labeled water jugs with capacities 67, 55, 84, 148, 107, 114, 17, 143, 40, 39 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 192, 247, 479 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 143, 3], ["+", 148, 3], ["+", 40, 3], ["+", 148, 3], ["+", 143, 2], ["-", 39, 2], ["+", 143, 2], ["+", 39, 1], ["+", 39, 1], ["+", 114, 1]]
10
0.030488252639770508
10
60
3
[[67, 55, 84, 148, 107, 114, 17, 143, 40, 39], [192, 247, 479]]
[[67, 55, 84, 148, 107, 114, 17, 143, 40, 39], [192, 247, 479]]
["[67, 55, 84, 148, 107, 114, 17, 143, 40, 39]", "[192, 247, 479]"]
45
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[11, 55, 69, 67], [19, 31, '_', 35], [64, 65, 88, 96]]
8_puzzle
puzzle
5
[31, 19, 64, 65, 19, 31, 88, 96, 35, 67, 69, 88, 96, 19, 31, 96, 88, 55, 11, 64, 96, 11, 55, 88, 11, 55, 64, 96, 65, 31, 19, 11, 55, 64, 88, 69, 67, 35]
38
18.521990299224854
38
4
12
[[[11, 55, 69, 67], [19, 31, "_", 35], [64, 65, 88, 96]]]
[[[11, 55, 69, 67], [19, 31, "_", 35], [64, 65, 88, 96]]]
["[[11, 55, 69, 67], [19, 31, '_', 35], [64, 65, 88, 96]]"]
45
In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: khadi, swarmy, aguish, wheaty The initial board: [['w', 'k', 'u', 'a', 'd', 'i'], ['s', 'a', 'a', 'r', 'm', 'y'], ['h', 'g', '_', 'i', 's', 'h'], ['w', 'h', 'e', 'a', 't', 'y']]
8_puzzle_words
puzzle
3
["up-left", "up-right", "down-right", "down-left", "up-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "down-right", "down-left", "up-left", "up-right", "up-left"]
16
0.26326990127563477
16
4
24
[[["w", "k", "u", "a", "d", "i"], ["s", "a", "a", "r", "m", "y"], ["h", "g", "_", "i", "s", "h"], ["w", "h", "e", "a", "t", "y"]]]
[[["w", "k", "u", "a", "d", "i"], ["s", "a", "a", "r", "m", "y"], ["h", "g", "_", "i", "s", "h"], ["w", "h", "e", "a", "t", "y"]], ["khadi", "swarmy", "aguish", "wheaty"]]
["[['w', 'k', 'u', 'a', 'd', 'i'], ['s', 'a', 'a', 'r', 'm', 'y'], ['h', 'g', '_', 'i', 's', 'h'], ['w', 'h', 'e', 'a', 't', 'y']]", "['khadi', 'swarmy', 'aguish', 'wheaty']"]
45
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'C'. Our task is to visit city Q and city M excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from M and Q, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. Z H M P B I E L Q Y V C Z 0 0 0 1 1 0 0 0 0 1 0 1 H 1 0 0 1 0 0 0 1 1 1 1 1 M 0 1 0 0 0 0 0 0 0 1 1 0 P 0 0 0 0 1 0 1 0 0 0 0 1 B 0 1 0 0 0 1 0 0 0 0 0 0 I 0 1 0 0 1 0 1 0 1 0 0 1 E 1 1 1 0 0 0 0 0 0 0 0 0 L 1 1 1 0 1 1 1 0 1 0 0 0 Q 1 0 1 1 1 0 1 1 0 0 0 0 Y 0 0 0 0 0 0 0 1 0 0 1 0 V 0 0 1 0 0 0 0 0 0 0 0 0 C 0 0 0 0 1 0 0 0 0 1 0 0
city_directed_graph
pathfinding
12
["C", "B", "I", "Q", "M", "H", "Q", "M"]
8
0.029607534408569336
8
12
15
[[[0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 1, 1, 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, 1, 0, 0, 0, 0, 1, 0, 0]], ["Z", "H", "M", "P", "B", "I", "E", "L", "Q", "Y", "V", "C"], "Q", "M"]
[[[0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 1, 1, 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, 1, 0, 0, 0, 0, 1, 0, 0]], ["Z", "H", "M", "P", "B", "I", "E", "L", "Q", "Y", "V", "C"], "C", "Q", "M"]
["[[0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 1, 1, 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, 1, 0, 0, 0, 0, 1, 0, 0]]", "['Z', 'H', 'M', 'P', 'B', 'I', 'E', 'L', 'Q', 'Y', 'V', 'C']", "['C']", "['Q', 'M']"]
45
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [21, 10, 19, 6, 20, 7, 23, 18, 4, 15, 4, 13, 2, 5, 32, 28, 113, 3, 9, 9, 11, 21, 112, 6, 6, 11, 29], such that the sum of the chosen coins adds up to 337. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {10: 7, 5: 3, 11: 3, 23: 2, 21: 13, 19: 3, 18: 18, 29: 20, 3: 2, 9: 7, 20: 18, 6: 2, 112: 20, 2: 1, 4: 4, 7: 4, 32: 1, 15: 8, 13: 10, 28: 17, 113: 18}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
17
[23, 6, 19, 6, 11, 11, 113, 112, 32, 4]
58
0.0367283821105957
10
27
27
[[21, 10, 19, 6, 20, 7, 23, 18, 4, 15, 4, 13, 2, 5, 32, 28, 113, 3, 9, 9, 11, 21, 112, 6, 6, 11, 29]]
[[21, 10, 19, 6, 20, 7, 23, 18, 4, 15, 4, 13, 2, 5, 32, 28, 113, 3, 9, 9, 11, 21, 112, 6, 6, 11, 29], {"10": 7, "5": 3, "11": 3, "23": 2, "21": 13, "19": 3, "18": 18, "29": 20, "3": 2, "9": 7, "20": 18, "6": 2, "112": 20, "2": 1, "4": 4, "7": 4, "32": 1, "15": 8, "13": 10, "28": 17, "113": 18}, 337]
["[21, 10, 19, 6, 20, 7, 23, 18, 4, 15, 4, 13, 2, 5, 32, 28, 113, 3, 9, 9, 11, 21, 112, 6, 6, 11, 29]", "{10: 7, 5: 3, 11: 3, 23: 2, 21: 13, 19: 3, 18: 18, 29: 20, 3: 2, 9: 7, 20: 18, 6: 2, 112: 20, 2: 1, 4: 4, 7: 4, 32: 1, 15: 8, 13: 10, 28: 17, 113: 18}", "337"]
45
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Green', 'Green', 'Green'], ['Blue', 'Red', 'Blue', 'Blue'], ['Green', 'Red', 'Red', 'Blue']]
color_sorting
sorting
8
[[0, 1], [2, 0], [2, 0], [2, 1], [2, 0], [1, 2], [1, 2], [1, 0], [1, 2], [0, 1], [0, 1], [0, 2]]
12
0.17496824264526367
12
6
12
[[["Red", "Green", "Green", "Green"], ["Blue", "Red", "Blue", "Blue"], ["Green", "Red", "Red", "Blue"]], 7]
[[["Red", "Green", "Green", "Green"], ["Blue", "Red", "Blue", "Blue"], ["Green", "Red", "Red", "Blue"]], 7]
["[['Red', 'Green', 'Green', 'Green'], ['Blue', 'Red', 'Blue', 'Blue'], ['Green', 'Red', 'Red', 'Blue']]", "7"]
45
We have a 3x3 numerical grid, with numbers ranging from 22 to 75 (22 included in the range but 75 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' '51' 'x'] ['48' '50' 'x'] ['x' 'x' 'x']]
consecutive_grid
underdetermined_system
10
[[0, 0, 22], [0, 2, 53], [1, 2, 52], [2, 0, 49], [2, 1, 24], [2, 2, 23]]
349
2.575047731399536
6
53
9
["[['', '51', ''], ['48', '50', ''], ['', '', '']]", 22, 75]
["[['', '51', ''], ['48', '50', ''], ['', '', '']]", 22, 75]
["[['', '51', ''], ['48', '50', ''], ['', '', '']]", "22", "75"]
45
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 35 to 61. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 177, 196, None for columns 1 to 2 respectively, and the sums of rows must be None, 183, 190, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 188. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' '50' 'x' 'x'] ['58' 'x' 'x' 'x'] ['x' '49' 'x' '59'] ['39' '41' 'x' 'x']]
magic_square
underdetermined_system
8
[[0, 0, 36], [0, 2, 42], [0, 3, 47], [1, 1, 37], [1, 2, 53], [1, 3, 35], [2, 0, 38], [2, 2, 44], [3, 2, 57], [3, 3, 40]]
725
2.623443365097046
10
44
9
["[['', '50', '', ''], ['58', '', '', ''], ['', '49', '', '59'], ['39', '41', '', '']]", 4, 35, 61]
["[['', '50', '', ''], ['58', '', '', ''], ['', '49', '', '59'], ['39', '41', '', '']]", 35, 61, [1, 3], [1, 3], [177, 196], [183, 190], 188]
["[['', '50', '', ''], ['58', '', '', ''], ['', '49', '', '59'], ['39', '41', '', '']]", "35", "61", "[None, 177, 196, None]", "[None, 183, 190, None]", "188"]
45
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 2, 1: 3, 2: 5, 3: 9, 4: 8, 5: 5, 6: 8, 7: 1}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Red', 'Yellow', 'Red', 'Yellow', 'Black'], ['Black', 'Blue', 'Green', 'Green', 'Blue'], [], [], [], [], ['Black', 'Blue', 'Green', 'Black', 'Yellow'], ['Blue', 'Green', 'Yellow', 'Red', 'Red']]
restricted_sorting
sorting
2
[[1, 3], [0, 4], [1, 2], [1, 5], [1, 5], [7, 2], [7, 5], [1, 2], [7, 1], [0, 1], [0, 7], [0, 1], [6, 0], [6, 2], [6, 5], [6, 0], [6, 1], [3, 0], [4, 7]]
77
4.278231382369995
19
56
20
[[["Red", "Yellow", "Red", "Yellow", "Black"], ["Black", "Blue", "Green", "Green", "Blue"], [], [], [], [], ["Black", "Blue", "Green", "Black", "Yellow"], ["Blue", "Green", "Yellow", "Red", "Red"]], 5, {"0": 2, "1": 3, "2": 5, "3": 9, "4": 8, "5": 5, "6": 8, "7": 1}]
[[["Red", "Yellow", "Red", "Yellow", "Black"], ["Black", "Blue", "Green", "Green", "Blue"], [], [], [], [], ["Black", "Blue", "Green", "Black", "Yellow"], ["Blue", "Green", "Yellow", "Red", "Red"]], 5, {"0": 2, "1": 3, "2": 5, "3": 9, "4": 8, "5": 5, "6": 8, "7": 1}, 4]
["[['Red', 'Yellow', 'Red', 'Yellow', 'Black'], ['Black', 'Blue', 'Green', 'Green', 'Blue'], [], [], [], [], ['Black', 'Blue', 'Green', 'Black', 'Yellow'], ['Blue', 'Green', 'Yellow', 'Red', 'Red']]", "{0: 2, 1: 3, 2: 5, 3: 9, 4: 8, 5: 5, 6: 8, 7: 1}", "5", "4"]
45
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 10) to his destination workshop at index (6, 1), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 5, and district 3 covering rows 6 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x x 17 12 12 10 9 9 18 x 1] [x 8 x 9 x x 18 5 1 12 14] [2 19 4 x x x x x x 15 x] [17 8 6 x x 10 15 x x x 13] [x x x 9 17 x x x x 12 17] [x 20 3 1 14 8 9 20 10 8 8] [18 19 4 12 3 1 x x 20 6 3] [4 6 9 x 8 10 x x 6 9 6] [15 x x x x x 16 x 15 4 x] [x x x 4 x x x 13 x x x] [x 3 x x x x 1 x x 5 13]
traffic
pathfinding
3
[[3, 10], [4, 10], [5, 10], [5, 9], [5, 8], [5, 7], [5, 6], [5, 5], [6, 5], [6, 4], [6, 3], [6, 2], [6, 1]]
119
0.02744436264038086
13
4
4
[[["x", "x", "17", "12", "12", "10", "9", "9", "18", "x", "1"], ["x", "8", "x", "9", "x", "x", "18", "5", "1", "12", "14"], ["2", "19", "4", "x", "x", "x", "x", "x", "x", "15", "x"], ["17", "8", "6", "x", "x", "10", "15", "x", "x", "x", "13"], ["x", "x", "x", "9", "17", "x", "x", "x", "x", "12", "17"], ["x", "20", "3", "1", "14", "8", "9", "20", "10", "8", "8"], ["18", "19", "4", "12", "3", "1", "x", "x", "20", "6", "3"], ["4", "6", "9", "x", "8", "10", "x", "x", "6", "9", "6"], ["15", "x", "x", "x", "x", "x", "16", "x", "15", "4", "x"], ["x", "x", "x", "4", "x", "x", "x", "13", "x", "x", "x"], ["x", "3", "x", "x", "x", "x", "1", "x", "x", "5", "13"]]]
[[["x", "x", "17", "12", "12", "10", "9", "9", "18", "x", "1"], ["x", "8", "x", "9", "x", "x", "18", "5", "1", "12", "14"], ["2", "19", "4", "x", "x", "x", "x", "x", "x", "15", "x"], ["17", "8", "6", "x", "x", "10", "15", "x", "x", "x", "13"], ["x", "x", "x", "9", "17", "x", "x", "x", "x", "12", "17"], ["x", "20", "3", "1", "14", "8", "9", "20", "10", "8", "8"], ["18", "19", "4", "12", "3", "1", "x", "x", "20", "6", "3"], ["4", "6", "9", "x", "8", "10", "x", "x", "6", "9", "6"], ["15", "x", "x", "x", "x", "x", "16", "x", "15", "4", "x"], ["x", "x", "x", "4", "x", "x", "x", "13", "x", "x", "x"], ["x", "3", "x", "x", "x", "x", "1", "x", "x", "5", "13"]], [3, 10], [6, 1], 3, 5]
["[['x', 'x', '17', '12', '12', '10', '9', '9', '18', 'x', '1'], ['x', '8', 'x', '9', 'x', 'x', '18', '5', '1', '12', '14'], ['2', '19', '4', 'x', 'x', 'x', 'x', 'x', 'x', '15', 'x'], ['17', '8', '6', 'x', 'x', '10', '15', 'x', 'x', 'x', '13'], ['x', 'x', 'x', '9', '17', 'x', 'x', 'x', 'x', '12', '17'], ['x', '20', '3', '1', '14', '8', '9', '20', '10', '8', '8'], ['18', '19', '4', '12', '3', '1', 'x', 'x', '20', '6', '3'], ['4', '6', '9', 'x', '8', '10', 'x', 'x', '6', '9', '6'], ['15', 'x', 'x', 'x', 'x', 'x', '16', 'x', '15', '4', 'x'], ['x', 'x', 'x', '4', 'x', 'x', 'x', '13', 'x', 'x', 'x'], ['x', '3', 'x', 'x', 'x', 'x', '1', 'x', 'x', '5', '13']]", "(3, 10)", "(6, 1)", "3", "5"]
45
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (1, 0) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (8, 9). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 1 0 0 1 0 1 1 1 0 0 0 1 1 0 1 1 0 1 0 0 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 0 0 1 0 1 0 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 1 1 0 0 1 0 0 1 0 0 1 0 0 1 0 1 1 1 1 0 1 0 1 1 1 1 1 1 1
trampoline_matrix
pathfinding
11
[[1, 0], [1, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [1, 8], [1, 9], [2, 9], [3, 9], [4, 9], [5, 10], [6, 10], [7, 10], [8, 9]]
18
0.029386281967163086
18
8
2
["[[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1], [0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1], [1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1]]", 3]
["[[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1], [0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1], [1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1]]", [1, 0], [8, 9], 3]
["[[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1], [0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1], [1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1]]", "(1, 0)", "(8, 9)", "3"]
45
Given 9 labeled water jugs with capacities 116, 16, 79, 75, 30, 87, 28, 96, 15, 134 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 155, 208, 295 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 30, 3], ["+", 116, 3], ["+", 134, 3], ["+", 15, 3], ["+", 96, 2], ["+", 96, 2], ["+", 16, 2], ["+", 75, 1], ["-", 16, 1], ["+", 96, 1]]
10
0.038698434829711914
10
60
3
[[116, 16, 79, 75, 30, 87, 28, 96, 15, 134], [155, 208, 295]]
[[116, 16, 79, 75, 30, 87, 28, 96, 15, 134], [155, 208, 295]]
["[116, 16, 79, 75, 30, 87, 28, 96, 15, 134]", "[155, 208, 295]"]
46
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[85, '_', 61, 100], [45, 77, 10, 91], [83, 57, 95, 39]]
8_puzzle
puzzle
5
[85, 45, 77, 85, 61, 100, 91, 10, 85, 57, 95, 39, 10, 85, 57, 61, 100, 91, 85, 57, 61, 95, 83, 77, 45, 100, 95, 83, 77, 45, 83, 77, 39, 10]
34
2.4867141246795654
34
4
12
[[[85, "_", 61, 100], [45, 77, 10, 91], [83, 57, 95, 39]]]
[[[85, "_", 61, 100], [45, 77, 10, 91], [83, 57, 95, 39]]]
["[[85, '_', 61, 100], [45, 77, 10, 91], [83, 57, 95, 39]]"]
46
In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: akule, mesode, callid, gyrous The initial board: [['e', 'a', 'y', 'u', 'i', 'e'], ['m', 'k', 's', 'o', 'd', 'l'], ['c', 'a', '_', 'l', 'e', 'd'], ['g', 'l', 'r', 'o', 'u', 's']]
8_puzzle_words
puzzle
3
["down-left", "up-left", "up-right", "up-right", "down-right", "up-right", "down-right", "down-left", "up-left", "down-left", "up-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left"]
18
0.27361011505126953
18
4
24
[[["e", "a", "y", "u", "i", "e"], ["m", "k", "s", "o", "d", "l"], ["c", "a", "_", "l", "e", "d"], ["g", "l", "r", "o", "u", "s"]]]
[[["e", "a", "y", "u", "i", "e"], ["m", "k", "s", "o", "d", "l"], ["c", "a", "_", "l", "e", "d"], ["g", "l", "r", "o", "u", "s"]], ["akule", "mesode", "callid", "gyrous"]]
["[['e', 'a', 'y', 'u', 'i', 'e'], ['m', 'k', 's', 'o', 'd', 'l'], ['c', 'a', '_', 'l', 'e', 'd'], ['g', 'l', 'r', 'o', 'u', 's']]", "['akule', 'mesode', 'callid', 'gyrous']"]
46
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'O'. Our task is to visit city M and city K excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from K and M, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. O T F C K U X G A M W Y O 0 0 0 0 0 0 0 0 0 0 0 1 T 1 0 0 0 0 0 0 1 0 1 0 0 F 0 1 0 1 0 0 0 0 0 0 0 0 C 0 0 0 0 1 0 1 0 0 0 0 1 K 1 0 1 0 0 0 0 0 1 1 0 0 U 0 0 0 0 0 0 0 1 0 0 1 0 X 0 0 1 0 0 1 0 0 1 0 0 0 G 0 0 0 0 1 1 0 0 0 0 0 1 A 0 1 0 1 0 0 0 0 0 0 0 0 M 0 1 0 0 0 1 1 0 1 0 0 0 W 1 0 0 0 1 0 0 0 0 1 0 0 Y 0 1 1 0 0 0 0 0 0 0 1 0
city_directed_graph
pathfinding
12
["O", "Y", "W", "K", "M", "A", "C", "K", "M"]
9
0.027652263641357422
9
12
15
[[[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, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0]], ["O", "T", "F", "C", "K", "U", "X", "G", "A", "M", "W", "Y"], "M", "K"]
[[[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, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0]], ["O", "T", "F", "C", "K", "U", "X", "G", "A", "M", "W", "Y"], "O", "M", "K"]
["[[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, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0]]", "['O', 'T', 'F', 'C', 'K', 'U', 'X', 'G', 'A', 'M', 'W', 'Y']", "['O']", "['M', 'K']"]
46
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [11, 6, 147, 6, 19, 29, 28, 32, 18, 20, 12, 22, 4, 20, 27, 3, 3, 18, 19, 9, 2, 28, 31, 20, 2, 27, 22, 30, 3], such that the sum of the chosen coins adds up to 324. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {27: 18, 6: 2, 22: 12, 18: 11, 4: 3, 12: 4, 28: 6, 147: 10, 32: 6, 19: 3, 29: 12, 31: 19, 20: 4, 2: 2, 30: 17, 3: 2, 11: 10, 9: 2}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
18
[32, 28, 12, 19, 19, 147, 28, 20, 6, 9, 4]
49
0.04179191589355469
11
29
29
[[11, 6, 147, 6, 19, 29, 28, 32, 18, 20, 12, 22, 4, 20, 27, 3, 3, 18, 19, 9, 2, 28, 31, 20, 2, 27, 22, 30, 3]]
[[11, 6, 147, 6, 19, 29, 28, 32, 18, 20, 12, 22, 4, 20, 27, 3, 3, 18, 19, 9, 2, 28, 31, 20, 2, 27, 22, 30, 3], {"27": 18, "6": 2, "22": 12, "18": 11, "4": 3, "12": 4, "28": 6, "147": 10, "32": 6, "19": 3, "29": 12, "31": 19, "20": 4, "2": 2, "30": 17, "3": 2, "11": 10, "9": 2}, 324]
["[11, 6, 147, 6, 19, 29, 28, 32, 18, 20, 12, 22, 4, 20, 27, 3, 3, 18, 19, 9, 2, 28, 31, 20, 2, 27, 22, 30, 3]", "{27: 18, 6: 2, 22: 12, 18: 11, 4: 3, 12: 4, 28: 6, 147: 10, 32: 6, 19: 3, 29: 12, 31: 19, 20: 4, 2: 2, 30: 17, 3: 2, 11: 10, 9: 2}", "324"]
46
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Blue', 'Red', 'Red'], ['Blue', 'Green', 'Green', 'Blue'], ['Green', 'Blue', 'Green', 'Red']]
color_sorting
sorting
8
[[2, 1], [2, 0], [2, 1], [2, 0], [1, 2], [1, 2], [1, 0], [1, 2], [1, 2], [0, 1], [0, 2], [0, 1], [0, 2], [0, 1], [2, 0], [2, 0]]
16
1.27297043800354
16
6
12
[[["Red", "Blue", "Red", "Red"], ["Blue", "Green", "Green", "Blue"], ["Green", "Blue", "Green", "Red"]], 7]
[[["Red", "Blue", "Red", "Red"], ["Blue", "Green", "Green", "Blue"], ["Green", "Blue", "Green", "Red"]], 7]
["[['Red', 'Blue', 'Red', 'Red'], ['Blue', 'Green', 'Green', 'Blue'], ['Green', 'Blue', 'Green', 'Red']]", "7"]