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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10 | 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: kex, turd, wabi, test The initial board: [['u', 'k', 'd', 'x'], ['t', 'e', 'r', 'b'], ['w', 'a', '_', 'i'], ['t', 'e', 's', 't']] | 8_puzzle_words | puzzle | 1 | ["up-right", "up-left", "down-left", "up-left"] | 4 | 0.1708054542541504 | 4 | 4 | 16 | [[["u", "k", "d", "x"], ["t", "e", "r", "b"], ["w", "a", "_", "i"], ["t", "e", "s", "t"]]] | [[["u", "k", "d", "x"], ["t", "e", "r", "b"], ["w", "a", "_", "i"], ["t", "e", "s", "t"]], ["kex", "turd", "wabi", "test"]] | ["[['u', 'k', 'd', 'x'], ['t', 'e', 'r', 'b'], ['w', 'a', '_', 'i'], ['t', 'e', 's', 't']]", "['kex', 'turd', 'wabi', 'test']"] |
10 | 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 P and city E 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 E and P, 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.
Q O P T W E X M D V
Q 0 0 0 0 0 0 0 1 0 0
O 0 0 0 0 0 1 0 0 0 0
P 0 0 0 1 1 0 0 1 1 1
T 0 0 0 0 1 0 0 1 0 0
W 0 1 0 0 0 1 0 0 0 1
E 0 0 0 0 0 0 1 0 0 0
X 0 0 1 0 0 0 0 0 0 1
M 0 1 0 0 0 0 1 0 0 1
D 0 1 0 1 0 0 1 1 0 1
V 1 1 1 0 0 1 0 0 0 0
| city_directed_graph | pathfinding | 10 | ["Q", "M", "O", "E", "X", "P", "V", "P", "W", "E"] | 10 | 0.03560161590576172 | 10 | 10 | 13 | [[[0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 1, 0, 0, 1, 1, 0, 1], [1, 1, 1, 0, 0, 1, 0, 0, 0, 0]], ["Q", "O", "P", "T", "W", "E", "X", "M", "D", "V"], "P", "E"] | [[[0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 1, 0, 0, 1, 1, 0, 1], [1, 1, 1, 0, 0, 1, 0, 0, 0, 0]], ["Q", "O", "P", "T", "W", "E", "X", "M", "D", "V"], "Q", "P", "E"] | ["[[0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 1, 0, 0, 1, 1, 0, 1], [1, 1, 1, 0, 0, 1, 0, 0, 0, 0]]", "['Q', 'O', 'P', 'T', 'W', 'E', 'X', 'M', 'D', 'V']", "['Q']", "['P', 'E']"] |
10 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [6, 20, 15, 14, 23, 6, 8, 15, 11, 2, 16, 21, 17, 10, 23, 20, 21, 16, 13, 3, 7, 4, 9, 21, 7, 13, 10, 18, 11, 9, 13, 12, 15, 17, 2, 8, 18, 3, 16, 9, 3, 14, 23, 16], such that the sum of the chosen coins adds up to 236. 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 {21: 11, 18: 16, 16: 6, 12: 5, 14: 11, 11: 8, 15: 11, 4: 3, 9: 2, 23: 14, 7: 5, 20: 12, 6: 2, 8: 3, 17: 6, 13: 3, 3: 3, 2: 1, 10: 5}, 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 | 24 | [9, 9, 13, 13, 8, 6, 13, 8, 9, 17, 16, 17, 16, 6, 21, 16, 21, 16, 2] | 84 | 0.0525660514831543 | 19 | 44 | 44 | [[6, 20, 15, 14, 23, 6, 8, 15, 11, 2, 16, 21, 17, 10, 23, 20, 21, 16, 13, 3, 7, 4, 9, 21, 7, 13, 10, 18, 11, 9, 13, 12, 15, 17, 2, 8, 18, 3, 16, 9, 3, 14, 23, 16]] | [[6, 20, 15, 14, 23, 6, 8, 15, 11, 2, 16, 21, 17, 10, 23, 20, 21, 16, 13, 3, 7, 4, 9, 21, 7, 13, 10, 18, 11, 9, 13, 12, 15, 17, 2, 8, 18, 3, 16, 9, 3, 14, 23, 16], {"21": 11, "18": 16, "16": 6, "12": 5, "14": 11, "11": 8, "15": 11, "4": 3, "9": 2, "23": 14, "7": 5, "20": 12, "6": 2, "8": 3, "17": 6, "13": 3, "3": 3, "2": 1, "10": 5}, 236] | ["[6, 20, 15, 14, 23, 6, 8, 15, 11, 2, 16, 21, 17, 10, 23, 20, 21, 16, 13, 3, 7, 4, 9, 21, 7, 13, 10, 18, 11, 9, 13, 12, 15, 17, 2, 8, 18, 3, 16, 9, 3, 14, 23, 16]", "{21: 11, 18: 16, 16: 6, 12: 5, 14: 11, 11: 8, 15: 11, 4: 3, 9: 2, 23: 14, 7: 5, 20: 12, 6: 2, 8: 3, 17: 6, 13: 3, 3: 3, 2: 1, 10: 5}", "236"] |
10 | 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 6 balls. It is not allowed to place a ball in a tube that already has 6 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', 'Red'], ['Red', 'Red', 'Green', 'Blue'], ['Green', 'Blue', 'Blue', 'Red']] | color_sorting | sorting | 7 | [[0, 1], [0, 2], [0, 2], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [1, 0], [1, 2], [1, 2], [1, 2], [0, 1], [0, 1], [0, 1], [2, 0]] | 18 | 1.260277509689331 | 18 | 6 | 12 | [[["Blue", "Green", "Green", "Red"], ["Red", "Red", "Green", "Blue"], ["Green", "Blue", "Blue", "Red"]], 6] | [[["Blue", "Green", "Green", "Red"], ["Red", "Red", "Green", "Blue"], ["Green", "Blue", "Blue", "Red"]], 6] | ["[['Blue', 'Green', 'Green', 'Red'], ['Red', 'Red', 'Green', 'Blue'], ['Green', 'Blue', 'Blue', 'Red']]", "6"] |
10 | We have a 3x3 numerical grid, with numbers ranging from 41 to 79 (41 included in the range but 79 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' '59' 'x']
['47' 'x' '62']
['x' '50' '63']] | consecutive_grid | underdetermined_system | 7 | [[0, 0, 41], [0, 2, 60], [1, 1, 51], [2, 0, 48]] | 500 | 0.1792917251586914 | 4 | 38 | 9 | ["[['', '59', ''], ['47', '', '62'], ['', '50', '63']]", 41, 79] | ["[['', '59', ''], ['47', '', '62'], ['', '50', '63']]", 41, 79] | ["[['', '59', ''], ['47', '', '62'], ['', '50', '63']]", "41", "79"] |
10 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 35 to 59. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 154, and sum of row 1 must be 151. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 133. 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' 'x']
['x' 'x' 'x']
['x' 'x' '57']] | magic_square | underdetermined_system | 6 | [[0, 0, 35], [0, 1, 40], [0, 2, 36], [1, 0, 38], [1, 1, 58], [1, 2, 55], [2, 0, 39], [2, 1, 56]] | 414 | 232.39282536506653 | 8 | 24 | 9 | ["[['', '', ''], ['', '', ''], ['', '', '57']]", 3, 35, 59] | ["[['', '', ''], ['', '', ''], ['', '', '57']]", 35, 59, [1, 2], [1, 2], [154], [151], 133] | ["[['', '', ''], ['', '', ''], ['', '', '57']]", "35", "59", "[None, 154, None]", "[None, 151, None]", "133"] |
10 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 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 3 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: 1, 1: 7, 2: 2, 3: 4, 4: 6, 5: 5}, 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', 'Blue', 'Blue'], ['Yellow', 'Red', 'Yellow', 'Red'], ['Green', 'Red', 'Green', 'Yellow'], []] | restricted_sorting | sorting | 1 | [[3, 0], [3, 1], [2, 5], [4, 5], [3, 0], [4, 3], [4, 5], [1, 3], [4, 0]] | 33 | 0.05746722221374512 | 9 | 30 | 12 | [[[], [], ["Green", "Blue", "Blue", "Blue"], ["Yellow", "Red", "Yellow", "Red"], ["Green", "Red", "Green", "Yellow"], []], 4, {"0": 1, "1": 7, "2": 2, "3": 4, "4": 6, "5": 5}] | [[[], [], ["Green", "Blue", "Blue", "Blue"], ["Yellow", "Red", "Yellow", "Red"], ["Green", "Red", "Green", "Yellow"], []], 4, {"0": 1, "1": 7, "2": 2, "3": 4, "4": 6, "5": 5}, 3] | ["[[], [], ['Green', 'Blue', 'Blue', 'Blue'], ['Yellow', 'Red', 'Yellow', 'Red'], ['Green', 'Red', 'Green', 'Yellow'], []]", "{0: 1, 1: 7, 2: 2, 3: 4, 4: 6, 5: 5}", "4", "3"] |
10 | 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, 0) to his destination workshop at index (6, 6), 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 6, and district 3 covering rows 7 to 8. 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 6 x 7 x 9 4 11]
[x 3 x 6 5 3 15 x 3]
[x x x 4 x 9 1 8 x]
[15 18 1 6 5 10 6 14 8]
[18 10 7 18 2 x x x 7]
[11 9 16 x 11 x 11 x 17]
[7 x 18 x 8 10 20 6 x]
[15 4 17 x 16 2 12 16 x]
[9 10 18 17 9 6 7 x 15] | traffic | pathfinding | 1 | [[3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [4, 4], [5, 4], [6, 4], [6, 5], [7, 5], [6, 5], [6, 6]] | 93 | 0.021834135055541992 | 12 | 4 | 4 | [[["x", "x", "6", "x", "7", "x", "9", "4", "11"], ["x", "3", "x", "6", "5", "3", "15", "x", "3"], ["x", "x", "x", "4", "x", "9", "1", "8", "x"], ["15", "18", "1", "6", "5", "10", "6", "14", "8"], ["18", "10", "7", "18", "2", "x", "x", "x", "7"], ["11", "9", "16", "x", "11", "x", "11", "x", "17"], ["7", "x", "18", "x", "8", "10", "20", "6", "x"], ["15", "4", "17", "x", "16", "2", "12", "16", "x"], ["9", "10", "18", "17", "9", "6", "7", "x", "15"]]] | [[["x", "x", "6", "x", "7", "x", "9", "4", "11"], ["x", "3", "x", "6", "5", "3", "15", "x", "3"], ["x", "x", "x", "4", "x", "9", "1", "8", "x"], ["15", "18", "1", "6", "5", "10", "6", "14", "8"], ["18", "10", "7", "18", "2", "x", "x", "x", "7"], ["11", "9", "16", "x", "11", "x", "11", "x", "17"], ["7", "x", "18", "x", "8", "10", "20", "6", "x"], ["15", "4", "17", "x", "16", "2", "12", "16", "x"], ["9", "10", "18", "17", "9", "6", "7", "x", "15"]], [3, 0], [6, 6], 3, 6] | ["[['x', 'x', '6', 'x', '7', 'x', '9', '4', '11'], ['x', '3', 'x', '6', '5', '3', '15', 'x', '3'], ['x', 'x', 'x', '4', 'x', '9', '1', '8', 'x'], ['15', '18', '1', '6', '5', '10', '6', '14', '8'], ['18', '10', '7', '18', '2', 'x', 'x', 'x', '7'], ['11', '9', '16', 'x', '11', 'x', '11', 'x', '17'], ['7', 'x', '18', 'x', '8', '10', '20', '6', 'x'], ['15', '4', '17', 'x', '16', '2', '12', '16', 'x'], ['9', '10', '18', '17', '9', '6', '7', 'x', '15']]", "(3, 0)", "(6, 6)", "3", "6"] |
10 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 9x9. 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 (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.
0 1 0 1 0 1 1 1 0
1 0 1 0 0 0 1 0 0
0 0 0 1 1 1 0 1 1
1 0 0 0 0 1 1 0 1
0 0 0 0 1 0 0 1 0
1 0 0 0 1 1 1 0 1
0 1 0 0 1 0 1 1 0
0 1 0 0 1 0 0 0 1
1 1 0 0 0 0 0 1 0 | trampoline_matrix | pathfinding | 9 | [[8, 8], [7, 7], [7, 6], [7, 5], [8, 4], [7, 3], [6, 3], [5, 3], [4, 3], [3, 3], [3, 2], [2, 2], [2, 1]] | 13 | 0.029077768325805664 | 13 | 8 | 2 | ["[[0, 1, 0, 1, 0, 1, 1, 1, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 0, 1, 1, 1, 0, 1], [0, 1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 1, 0]]", 3] | ["[[0, 1, 0, 1, 0, 1, 1, 1, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 0, 1, 1, 1, 0, 1], [0, 1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 1, 0]]", [8, 8], [2, 1], 3] | ["[[0, 1, 0, 1, 0, 1, 1, 1, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 0, 1, 1, 1, 0, 1], [0, 1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 1, 0]]", "(8, 8)", "(2, 1)", "3"] |
10 | Given 5 labeled water jugs with capacities 14, 119, 62, 18, 133, 13 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 218, 272, 314 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 | 4 | [["+", 119, 3], ["+", 119, 3], ["+", 62, 3], ["+", 14, 3], ["+", 133, 2], ["+", 133, 2], ["-", 13, 2], ["+", 14, 2], ["-", 13, 2], ["+", 18, 2], ["+", 14, 1], ["+", 133, 1], ["-", 62, 1], ["+", 133, 1]] | 14 | 0.029827594757080078 | 14 | 36 | 3 | [[14, 119, 62, 18, 133, 13], [218, 272, 314]] | [[14, 119, 62, 18, 133, 13], [218, 272, 314]] | ["[14, 119, 62, 18, 133, 13]", "[218, 272, 314]"] |
11 | 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: [[59, 76, 55], [54, '_', 85], [50, 95, 53]] | 8_puzzle | puzzle | 3 | [54, 50, 95, 53, 85, 54, 53, 95, 50, 53, 95, 85, 54, 55, 76, 95, 85, 50, 53, 59, 95, 85, 55, 54] | 24 | 0.10947823524475098 | 24 | 4 | 9 | [[[59, 76, 55], [54, "_", 85], [50, 95, 53]]] | [[[59, 76, 55], [54, "_", 85], [50, 95, 53]]] | ["[[59, 76, 55], [54, '_', 85], [50, 95, 53]]"] |
11 | 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: bud, codo, waup, yelp The initial board: [['o', 'b', 'e', 'd'], ['c', 'o', 'd', 'u'], ['w', 'a', '_', 'p'], ['y', 'u', 'l', 'p']] | 8_puzzle_words | puzzle | 1 | ["down-left", "up-left", "up-right", "up-right", "down-right", "down-left", "up-left", "down-left", "down-right", "up-right", "up-left", "up-right", "down-right", "down-left", "up-left", "up-left"] | 16 | 0.2195606231689453 | 16 | 4 | 16 | [[["o", "b", "e", "d"], ["c", "o", "d", "u"], ["w", "a", "_", "p"], ["y", "u", "l", "p"]]] | [[["o", "b", "e", "d"], ["c", "o", "d", "u"], ["w", "a", "_", "p"], ["y", "u", "l", "p"]], ["bud", "codo", "waup", "yelp"]] | ["[['o', 'b', 'e', 'd'], ['c', 'o', 'd', 'u'], ['w', 'a', '_', 'p'], ['y', 'u', 'l', 'p']]", "['bud', 'codo', 'waup', 'yelp']"] |
11 | 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 T and city E 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 E and T, 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.
Q T A X M Y Z B S E
Q 0 0 0 0 0 0 1 0 0 0
T 1 0 1 1 0 0 0 0 0 0
A 0 0 0 0 1 0 0 0 0 0
X 0 0 0 0 1 0 1 1 1 0
M 1 0 0 0 0 0 0 1 0 1
Y 0 1 1 1 0 0 0 0 0 0
Z 0 0 0 0 1 1 0 1 0 0
B 1 1 1 0 0 0 0 0 0 0
S 0 1 0 0 0 1 0 0 0 1
E 0 0 1 1 1 0 0 1 1 0
| city_directed_graph | pathfinding | 10 | ["Q", "Z", "Y", "T", "A", "M", "E", "S", "E", "B", "T"] | 11 | 0.028751611709594727 | 11 | 10 | 13 | [[[0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 1, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 0, 1, 1, 0]], ["Q", "T", "A", "X", "M", "Y", "Z", "B", "S", "E"], "T", "E"] | [[[0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 1, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 0, 1, 1, 0]], ["Q", "T", "A", "X", "M", "Y", "Z", "B", "S", "E"], "Q", "T", "E"] | ["[[0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 1, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 0, 1, 1, 0]]", "['Q', 'T', 'A', 'X', 'M', 'Y', 'Z', 'B', 'S', 'E']", "['Q']", "['T', 'E']"] |
11 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [21, 20, 21, 11, 23, 16, 16, 16, 3, 20, 2, 19, 16, 21, 18, 7, 20, 3, 16, 18, 7, 22, 3, 22, 7, 21, 12, 22, 5, 6, 17, 16, 8, 8, 14, 4, 18, 9, 4, 20, 2], such that the sum of the chosen coins adds up to 228. 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 {6: 1, 7: 3, 9: 1, 18: 1, 2: 1, 11: 7, 5: 3, 12: 2, 3: 3, 22: 6, 14: 3, 20: 15, 4: 3, 17: 4, 16: 8, 23: 18, 21: 16, 19: 2, 8: 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 | 25 | [18, 6, 9, 19, 18, 14, 12, 2, 7, 7, 17, 23, 22, 18, 16, 2, 7, 11] | 66 | 0.04258108139038086 | 18 | 41 | 41 | [[21, 20, 21, 11, 23, 16, 16, 16, 3, 20, 2, 19, 16, 21, 18, 7, 20, 3, 16, 18, 7, 22, 3, 22, 7, 21, 12, 22, 5, 6, 17, 16, 8, 8, 14, 4, 18, 9, 4, 20, 2]] | [[21, 20, 21, 11, 23, 16, 16, 16, 3, 20, 2, 19, 16, 21, 18, 7, 20, 3, 16, 18, 7, 22, 3, 22, 7, 21, 12, 22, 5, 6, 17, 16, 8, 8, 14, 4, 18, 9, 4, 20, 2], {"6": 1, "7": 3, "9": 1, "18": 1, "2": 1, "11": 7, "5": 3, "12": 2, "3": 3, "22": 6, "14": 3, "20": 15, "4": 3, "17": 4, "16": 8, "23": 18, "21": 16, "19": 2, "8": 6}, 228] | ["[21, 20, 21, 11, 23, 16, 16, 16, 3, 20, 2, 19, 16, 21, 18, 7, 20, 3, 16, 18, 7, 22, 3, 22, 7, 21, 12, 22, 5, 6, 17, 16, 8, 8, 14, 4, 18, 9, 4, 20, 2]", "{6: 1, 7: 3, 9: 1, 18: 1, 2: 1, 11: 7, 5: 3, 12: 2, 3: 3, 22: 6, 14: 3, 20: 15, 4: 3, 17: 4, 16: 8, 23: 18, 21: 16, 19: 2, 8: 6}", "228"] |
11 | 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 6 balls. It is not allowed to place a ball in a tube that already has 6 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', 'Red', 'Red', 'Green'], ['Blue', 'Red', 'Green', 'Blue'], ['Green', 'Blue', 'Blue', 'Red']] | color_sorting | sorting | 7 | [[0, 2], [0, 1], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [1, 2], [1, 0], [1, 2], [1, 2], [0, 1], [0, 1], [0, 1], [2, 0]] | 16 | 0.6104025840759277 | 16 | 6 | 12 | [[["Green", "Red", "Red", "Green"], ["Blue", "Red", "Green", "Blue"], ["Green", "Blue", "Blue", "Red"]], 6] | [[["Green", "Red", "Red", "Green"], ["Blue", "Red", "Green", "Blue"], ["Green", "Blue", "Blue", "Red"]], 6] | ["[['Green', 'Red', 'Red', 'Green'], ['Blue', 'Red', 'Green', 'Blue'], ['Green', 'Blue', 'Blue', 'Red']]", "6"] |
11 | We have a 3x3 numerical grid, with numbers ranging from 33 to 71 (33 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' 'x' '55']
['50' 'x' '56']
['40' '43' 'x']] | consecutive_grid | underdetermined_system | 7 | [[0, 0, 51], [0, 1, 53], [1, 1, 52], [2, 2, 57]] | 487 | 0.27827906608581543 | 4 | 38 | 9 | ["[['', '', '55'], ['50', '', '56'], ['40', '43', '']]", 33, 71] | ["[['', '', '55'], ['50', '', '56'], ['40', '43', '']]", 33, 71] | ["[['', '', '55'], ['50', '', '56'], ['40', '43', '']]", "33", "71"] |
11 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 35 to 59. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 127, and sum of row 1 must be 144. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 141. 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' '48']
['x' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 6 | [[0, 0, 35], [0, 1, 36], [1, 0, 40], [1, 1, 54], [1, 2, 50], [2, 0, 39], [2, 1, 37], [2, 2, 38]] | 377 | 1.0946576595306396 | 8 | 24 | 9 | ["[['', '', '48'], ['', '', ''], ['', '', '']]", 3, 35, 59] | ["[['', '', '48'], ['', '', ''], ['', '', '']]", 35, 59, [1, 2], [1, 2], [127], [144], 141] | ["[['', '', '48'], ['', '', ''], ['', '', '']]", "35", "59", "[None, 127, None]", "[None, 144, None]", "141"] |
11 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 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 3 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: 5, 2: 1, 3: 6, 4: 7, 5: 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', 'Blue', 'Green', 'Red'], [], ['Green', 'Red', 'Yellow', 'Yellow'], [], ['Green', 'Red', 'Blue', 'Yellow']] | restricted_sorting | sorting | 1 | [[1, 0], [1, 0], [1, 2], [3, 2], [3, 1], [5, 2], [5, 1], [5, 0], [3, 5], [3, 5]] | 30 | 0.07445669174194336 | 10 | 30 | 12 | [[[], ["Blue", "Blue", "Green", "Red"], [], ["Green", "Red", "Yellow", "Yellow"], [], ["Green", "Red", "Blue", "Yellow"]], 4, {"0": 3, "1": 5, "2": 1, "3": 6, "4": 7, "5": 4}] | [[[], ["Blue", "Blue", "Green", "Red"], [], ["Green", "Red", "Yellow", "Yellow"], [], ["Green", "Red", "Blue", "Yellow"]], 4, {"0": 3, "1": 5, "2": 1, "3": 6, "4": 7, "5": 4}, 3] | ["[[], ['Blue', 'Blue', 'Green', 'Red'], [], ['Green', 'Red', 'Yellow', 'Yellow'], [], ['Green', 'Red', 'Blue', 'Yellow']]", "{0: 3, 1: 5, 2: 1, 3: 6, 4: 7, 5: 4}", "4", "3"] |
11 | 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, 0) to his destination workshop at index (4, 8), 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 8. 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 15 x 18 8 6 11 x 7]
[9 10 18 9 2 16 9 8 x]
[14 x x 10 18 x 13 12 14]
[11 18 4 11 14 2 20 x 15]
[12 x x 8 10 x x 10 11]
[5 19 20 15 11 x 14 x 18]
[x 5 x x x x x 9 x]
[x x 18 x x 4 x 17 13]
[x 7 17 x x x x 7 19] | traffic | pathfinding | 1 | [[3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [2, 6], [2, 7], [2, 8], [3, 8], [4, 8], [5, 8], [4, 8]] | 163 | 0.0204925537109375 | 14 | 4 | 4 | [[["x", "15", "x", "18", "8", "6", "11", "x", "7"], ["9", "10", "18", "9", "2", "16", "9", "8", "x"], ["14", "x", "x", "10", "18", "x", "13", "12", "14"], ["11", "18", "4", "11", "14", "2", "20", "x", "15"], ["12", "x", "x", "8", "10", "x", "x", "10", "11"], ["5", "19", "20", "15", "11", "x", "14", "x", "18"], ["x", "5", "x", "x", "x", "x", "x", "9", "x"], ["x", "x", "18", "x", "x", "4", "x", "17", "13"], ["x", "7", "17", "x", "x", "x", "x", "7", "19"]]] | [[["x", "15", "x", "18", "8", "6", "11", "x", "7"], ["9", "10", "18", "9", "2", "16", "9", "8", "x"], ["14", "x", "x", "10", "18", "x", "13", "12", "14"], ["11", "18", "4", "11", "14", "2", "20", "x", "15"], ["12", "x", "x", "8", "10", "x", "x", "10", "11"], ["5", "19", "20", "15", "11", "x", "14", "x", "18"], ["x", "5", "x", "x", "x", "x", "x", "9", "x"], ["x", "x", "18", "x", "x", "4", "x", "17", "13"], ["x", "7", "17", "x", "x", "x", "x", "7", "19"]], [3, 0], [4, 8], 2, 4] | ["[['x', '15', 'x', '18', '8', '6', '11', 'x', '7'], ['9', '10', '18', '9', '2', '16', '9', '8', 'x'], ['14', 'x', 'x', '10', '18', 'x', '13', '12', '14'], ['11', '18', '4', '11', '14', '2', '20', 'x', '15'], ['12', 'x', 'x', '8', '10', 'x', 'x', '10', '11'], ['5', '19', '20', '15', '11', 'x', '14', 'x', '18'], ['x', '5', 'x', 'x', 'x', 'x', 'x', '9', 'x'], ['x', 'x', '18', 'x', 'x', '4', 'x', '17', '13'], ['x', '7', '17', 'x', 'x', 'x', 'x', '7', '19']]", "(3, 0)", "(4, 8)", "2", "4"] |
11 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 9x9. 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, 7) (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.
1 1 1 0 0 0 0 1 1
0 1 1 0 0 0 0 0 0
1 1 1 1 0 1 0 0 1
0 0 0 1 0 0 0 0 0
0 0 1 1 0 1 1 0 1
1 1 1 1 1 0 0 0 0
0 1 1 1 0 1 1 0 0
1 1 1 0 0 0 0 0 0
1 1 1 0 0 0 1 0 0 | trampoline_matrix | pathfinding | 9 | [[8, 7], [7, 7], [6, 7], [5, 6], [5, 5], [4, 4], [3, 4], [2, 4], [1, 3], [0, 3]] | 10 | 0.03075408935546875 | 10 | 8 | 2 | ["[[1, 1, 1, 0, 0, 0, 0, 1, 1], [0, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 1, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 1, 0, 0]]", 3] | ["[[1, 1, 1, 0, 0, 0, 0, 1, 1], [0, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 1, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 1, 0, 0]]", [8, 7], [0, 3], 3] | ["[[1, 1, 1, 0, 0, 0, 0, 1, 1], [0, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 1, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 1, 0, 0]]", "(8, 7)", "(0, 3)", "3"] |
11 | Given 5 labeled water jugs with capacities 140, 58, 129, 130, 125 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 391, 401, 431 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 | 4 | [["+", 140, 3], ["+", 140, 3], ["+", 140, 3], ["-", 129, 3], ["+", 140, 3], ["+", 125, 2], ["+", 125, 2], ["+", 140, 2], ["-", 129, 2], ["+", 140, 2], ["+", 125, 1], ["+", 125, 1], ["+", 130, 1], ["-", 129, 1], ["+", 140, 1]] | 15 | 0.04181361198425293 | 15 | 30 | 3 | [[140, 58, 129, 130, 125], [391, 401, 431]] | [[140, 58, 129, 130, 125], [391, 401, 431]] | ["[140, 58, 129, 130, 125]", "[391, 401, 431]"] |
12 | 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: [[66, 35, 51], [76, '_', 73], [90, 54, 22]] | 8_puzzle | puzzle | 3 | [35, 51, 73, 22, 54, 35, 51, 66, 76, 90, 35, 54, 22, 51, 66, 76, 90, 66, 54, 22] | 20 | 0.061293601989746094 | 20 | 4 | 9 | [[[66, 35, 51], [76, "_", 73], [90, 54, 22]]] | [[[66, 35, 51], [76, "_", 73], [90, 54, 22]]] | ["[[66, 35, 51], [76, '_', 73], [90, 54, 22]]"] |
12 | 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: hat, skag, alit, mand The initial board: [['k', 'h', 'a', 't'], ['s', 'a', 'a', 'a'], ['i', 'l', '_', 't'], ['m', 'g', 'n', 'd']] | 8_puzzle_words | puzzle | 1 | ["down-left", "up-left", "up-right", "up-right", "down-right", "down-left", "down-left", "up-left", "up-right", "up-left"] | 10 | 0.185685396194458 | 10 | 4 | 16 | [[["k", "h", "a", "t"], ["s", "a", "a", "a"], ["i", "l", "_", "t"], ["m", "g", "n", "d"]]] | [[["k", "h", "a", "t"], ["s", "a", "a", "a"], ["i", "l", "_", "t"], ["m", "g", "n", "d"]], ["hat", "skag", "alit", "mand"]] | ["[['k', 'h', 'a', 't'], ['s', 'a', 'a', 'a'], ['i', 'l', '_', 't'], ['m', 'g', 'n', 'd']]", "['hat', 'skag', 'alit', 'mand']"] |
12 | 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 'B'. Our task is to visit city V and city L 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 L 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 T R A L B V I P N
S 0 1 0 0 0 1 0 0 1 0
T 0 0 0 0 0 0 1 0 0 0
R 1 1 0 0 0 0 0 0 1 1
A 1 0 1 0 0 0 1 0 0 1
L 0 0 0 1 0 0 1 1 0 1
B 1 0 0 0 0 0 0 1 0 0
V 1 1 1 1 0 1 0 0 1 1
I 0 0 0 0 1 0 0 0 0 0
P 0 0 0 0 0 0 0 1 0 0
N 0 0 0 0 1 1 0 0 0 0
| city_directed_graph | pathfinding | 10 | ["B", "I", "L", "V", "N", "L", "V"] | 7 | 0.027237892150878906 | 7 | 10 | 13 | [[[0, 1, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0]], ["S", "T", "R", "A", "L", "B", "V", "I", "P", "N"], "V", "L"] | [[[0, 1, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0]], ["S", "T", "R", "A", "L", "B", "V", "I", "P", "N"], "B", "V", "L"] | ["[[0, 1, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0]]", "['S', 'T', 'R', 'A', 'L', 'B', 'V', 'I', 'P', 'N']", "['B']", "['V', 'L']"] |
12 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [9, 2, 23, 20, 13, 4, 15, 16, 12, 21, 13, 9, 2, 14, 13, 14, 4, 19, 12, 6, 21, 23, 4, 18, 2, 23, 23, 6, 18, 23, 3, 16, 7, 2, 22, 16, 8, 10, 23, 17, 3, 18, 8], such that the sum of the chosen coins adds up to 230. 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 {9: 1, 17: 6, 2: 2, 22: 9, 13: 13, 16: 8, 12: 4, 4: 1, 21: 14, 14: 10, 19: 9, 10: 7, 7: 6, 8: 7, 6: 2, 23: 16, 18: 3, 20: 2, 3: 1, 15: 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 | 26 | [20, 18, 4, 9, 4, 15, 12, 6, 19, 18, 12, 6, 4, 9, 17, 23, 18, 16] | 69 | 0.04821968078613281 | 18 | 43 | 43 | [[9, 2, 23, 20, 13, 4, 15, 16, 12, 21, 13, 9, 2, 14, 13, 14, 4, 19, 12, 6, 21, 23, 4, 18, 2, 23, 23, 6, 18, 23, 3, 16, 7, 2, 22, 16, 8, 10, 23, 17, 3, 18, 8]] | [[9, 2, 23, 20, 13, 4, 15, 16, 12, 21, 13, 9, 2, 14, 13, 14, 4, 19, 12, 6, 21, 23, 4, 18, 2, 23, 23, 6, 18, 23, 3, 16, 7, 2, 22, 16, 8, 10, 23, 17, 3, 18, 8], {"9": 1, "17": 6, "2": 2, "22": 9, "13": 13, "16": 8, "12": 4, "4": 1, "21": 14, "14": 10, "19": 9, "10": 7, "7": 6, "8": 7, "6": 2, "23": 16, "18": 3, "20": 2, "3": 1, "15": 2}, 230] | ["[9, 2, 23, 20, 13, 4, 15, 16, 12, 21, 13, 9, 2, 14, 13, 14, 4, 19, 12, 6, 21, 23, 4, 18, 2, 23, 23, 6, 18, 23, 3, 16, 7, 2, 22, 16, 8, 10, 23, 17, 3, 18, 8]", "{9: 1, 17: 6, 2: 2, 22: 9, 13: 13, 16: 8, 12: 4, 4: 1, 21: 14, 14: 10, 19: 9, 10: 7, 7: 6, 8: 7, 6: 2, 23: 16, 18: 3, 20: 2, 3: 1, 15: 2}", "230"] |
12 | 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 6 balls. It is not allowed to place a ball in a tube that already has 6 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', 'Blue', 'Red', 'Blue'], ['Red', 'Green', 'Green', 'Green'], ['Red', 'Red', 'Blue', 'Green']] | color_sorting | sorting | 7 | [[0, 2], [0, 2], [0, 1], [2, 0], [2, 0], [2, 0], [2, 1], [2, 0], [2, 0], [1, 2], [1, 2], [1, 2], [0, 1], [0, 1], [0, 2], [1, 0]] | 16 | 0.49949169158935547 | 16 | 6 | 12 | [[["Blue", "Blue", "Red", "Blue"], ["Red", "Green", "Green", "Green"], ["Red", "Red", "Blue", "Green"]], 6] | [[["Blue", "Blue", "Red", "Blue"], ["Red", "Green", "Green", "Green"], ["Red", "Red", "Blue", "Green"]], 6] | ["[['Blue', 'Blue', 'Red', 'Blue'], ['Red', 'Green', 'Green', 'Green'], ['Red', 'Red', 'Blue', 'Green']]", "6"] |
12 | We have a 3x3 numerical grid, with numbers ranging from 35 to 73 (35 included in the range but 73 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' 'x']
['x' '50' '63']
['x' '69' '71']] | consecutive_grid | underdetermined_system | 7 | [[0, 1, 36], [0, 2, 35], [1, 0, 38], [2, 0, 37]] | 475 | 0.1643369197845459 | 4 | 38 | 9 | ["[['57', '', ''], ['', '50', '63'], ['', '69', '71']]", 35, 73] | ["[['57', '', ''], ['', '50', '63'], ['', '69', '71']]", 35, 73] | ["[['57', '', ''], ['', '50', '63'], ['', '69', '71']]", "35", "73"] |
12 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 28 to 57. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 126, and sum of row 1 must be 124. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 136. 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' '46' 'x']
['39' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 6 | [[0, 0, 29], [0, 2, 31], [1, 1, 52], [1, 2, 33], [2, 0, 53], [2, 1, 28], [2, 2, 30]] | 341 | 1.8470244407653809 | 7 | 24 | 9 | ["[['', '46', ''], ['39', '', ''], ['', '', '']]", 3, 28, 57] | ["[['', '46', ''], ['39', '', ''], ['', '', '']]", 28, 57, [1, 2], [1, 2], [126], [124], 136] | ["[['', '46', ''], ['39', '', ''], ['', '', '']]", "28", "57", "[None, 126, None]", "[None, 124, None]", "136"] |
12 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 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 3 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: 2, 2: 3, 3: 7, 4: 1, 5: 7}, 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', 'Yellow', 'Green'], ['Red', 'Red', 'Blue', 'Yellow'], [], [], ['Blue', 'Red', 'Blue', 'Green'], []] | restricted_sorting | sorting | 1 | [[1, 3], [1, 3], [4, 2], [4, 3], [1, 2], [4, 2], [0, 4], [0, 1], [0, 1], [0, 4]] | 36 | 0.08908510208129883 | 10 | 30 | 12 | [[["Green", "Yellow", "Yellow", "Green"], ["Red", "Red", "Blue", "Yellow"], [], [], ["Blue", "Red", "Blue", "Green"], []], 4, {"0": 2, "1": 2, "2": 3, "3": 7, "4": 1, "5": 7}] | [[["Green", "Yellow", "Yellow", "Green"], ["Red", "Red", "Blue", "Yellow"], [], [], ["Blue", "Red", "Blue", "Green"], []], 4, {"0": 2, "1": 2, "2": 3, "3": 7, "4": 1, "5": 7}, 3] | ["[['Green', 'Yellow', 'Yellow', 'Green'], ['Red', 'Red', 'Blue', 'Yellow'], [], [], ['Blue', 'Red', 'Blue', 'Green'], []]", "{0: 2, 1: 2, 2: 3, 3: 7, 4: 1, 5: 7}", "4", "3"] |
12 | 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, 8), 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 8. 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 x 17 14 3 x 10 5 2]
[x x 1 x x x 19 7 1]
[16 12 x 3 19 2 14 1 14]
[x 1 16 x 12 3 13 x 3]
[x x 7 19 10 x 5 x 19]
[5 x x 6 14 x x 10 12]
[x x x x 18 x x 15 12]
[x x 16 8 x 3 4 x x]
[x x x 16 x x 8 14 7] | traffic | pathfinding | 1 | [[3, 1], [3, 2], [4, 2], [4, 3], [4, 4], [3, 4], [3, 5], [2, 5], [2, 6], [2, 7], [2, 8], [3, 8], [4, 8], [5, 8]] | 132 | 0.020636796951293945 | 14 | 4 | 4 | [[["19", "x", "17", "14", "3", "x", "10", "5", "2"], ["x", "x", "1", "x", "x", "x", "19", "7", "1"], ["16", "12", "x", "3", "19", "2", "14", "1", "14"], ["x", "1", "16", "x", "12", "3", "13", "x", "3"], ["x", "x", "7", "19", "10", "x", "5", "x", "19"], ["5", "x", "x", "6", "14", "x", "x", "10", "12"], ["x", "x", "x", "x", "18", "x", "x", "15", "12"], ["x", "x", "16", "8", "x", "3", "4", "x", "x"], ["x", "x", "x", "16", "x", "x", "8", "14", "7"]]] | [[["19", "x", "17", "14", "3", "x", "10", "5", "2"], ["x", "x", "1", "x", "x", "x", "19", "7", "1"], ["16", "12", "x", "3", "19", "2", "14", "1", "14"], ["x", "1", "16", "x", "12", "3", "13", "x", "3"], ["x", "x", "7", "19", "10", "x", "5", "x", "19"], ["5", "x", "x", "6", "14", "x", "x", "10", "12"], ["x", "x", "x", "x", "18", "x", "x", "15", "12"], ["x", "x", "16", "8", "x", "3", "4", "x", "x"], ["x", "x", "x", "16", "x", "x", "8", "14", "7"]], [3, 1], [5, 8], 3, 4] | ["[['19', 'x', '17', '14', '3', 'x', '10', '5', '2'], ['x', 'x', '1', 'x', 'x', 'x', '19', '7', '1'], ['16', '12', 'x', '3', '19', '2', '14', '1', '14'], ['x', '1', '16', 'x', '12', '3', '13', 'x', '3'], ['x', 'x', '7', '19', '10', 'x', '5', 'x', '19'], ['5', 'x', 'x', '6', '14', 'x', 'x', '10', '12'], ['x', 'x', 'x', 'x', '18', 'x', 'x', '15', '12'], ['x', 'x', '16', '8', 'x', '3', '4', 'x', 'x'], ['x', 'x', 'x', '16', 'x', 'x', '8', '14', '7']]", "(3, 1)", "(5, 8)", "3", "4"] |
12 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 9x9. 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 (3, 7) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (8, 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 1 0 0 0 0 1
0 0 1 1 1 0 1 1 1
1 1 1 0 1 0 1 1 1
1 0 0 0 0 1 1 0 1
1 0 0 0 1 1 0 0 1
0 0 1 1 0 0 0 0 0
0 0 0 0 1 0 0 1 0
0 0 0 1 0 1 1 1 1
0 0 0 0 0 0 1 1 1 | trampoline_matrix | pathfinding | 9 | [[3, 7], [4, 6], [5, 5], [5, 4], [6, 3], [6, 2], [6, 1], [7, 1], [7, 0], [8, 0]] | 10 | 0.029245376586914062 | 10 | 8 | 2 | ["[[1, 1, 1, 1, 0, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 0, 1, 0, 1, 1, 1], [1, 0, 0, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 1]]", 3] | ["[[1, 1, 1, 1, 0, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 0, 1, 0, 1, 1, 1], [1, 0, 0, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 1]]", [3, 7], [8, 0], 3] | ["[[1, 1, 1, 1, 0, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 0, 1, 0, 1, 1, 1], [1, 0, 0, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 1]]", "(3, 7)", "(8, 0)", "3"] |
12 | Given 5 labeled water jugs with capacities 46, 99, 145, 131, 78, 100 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 247, 340, 368 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 | 4 | [["+", 78, 3], ["+", 145, 3], ["+", 145, 3], ["+", 78, 2], ["+", 131, 2], ["+", 131, 2], ["+", 131, 1], ["-", 46, 1], ["+", 131, 1], ["-", 100, 1], ["+", 131, 1]] | 11 | 0.027457475662231445 | 11 | 36 | 3 | [[46, 99, 145, 131, 78, 100], [247, 340, 368]] | [[46, 99, 145, 131, 78, 100], [247, 340, 368]] | ["[46, 99, 145, 131, 78, 100]", "[247, 340, 368]"] |
13 | 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: [[41, 36, 82], [29, 97, 43], ['_', 51, 61]] | 8_puzzle | puzzle | 4 | [29, 97, 36, 41, 97, 36, 51, 29, 36, 51, 43, 61, 29, 43, 41, 82, 61, 41, 43, 29] | 20 | 0.04056262969970703 | 20 | 4 | 9 | [[[41, 36, 82], [29, 97, 43], ["_", 51, 61]]] | [[[41, 36, 82], [29, 97, 43], ["_", 51, 61]]] | ["[[41, 36, 82], [29, 97, 43], ['_', 51, 61]]"] |
13 | 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: lag, abas, numa, sham The initial board: [['b', 'l', '_', 'g'], ['a', 'n', 'a', 's'], ['m', 'u', 'a', 'a'], ['s', 'h', 'a', 'm']] | 8_puzzle_words | puzzle | 1 | ["down-left", "down-left", "down-right", "up-right", "up-left", "up-right", "down-right", "down-left", "down-left", "up-left", "up-right", "down-right", "up-right", "up-left", "down-left", "up-left"] | 16 | 0.17847561836242676 | 16 | 4 | 16 | [[["b", "l", "_", "g"], ["a", "n", "a", "s"], ["m", "u", "a", "a"], ["s", "h", "a", "m"]]] | [[["b", "l", "_", "g"], ["a", "n", "a", "s"], ["m", "u", "a", "a"], ["s", "h", "a", "m"]], ["lag", "abas", "numa", "sham"]] | ["[['b', 'l', '_', 'g'], ['a', 'n', 'a', 's'], ['m', 'u', 'a', 'a'], ['s', 'h', 'a', 'm']]", "['lag', 'abas', 'numa', 'sham']"] |
13 | 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 'H'. Our task is to visit city E and city X 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 X 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.
G X R L Y E V T B H
G 0 1 0 0 0 0 0 1 0 0
X 0 0 0 1 1 0 0 0 1 0
R 0 0 0 0 1 1 0 0 1 0
L 0 0 0 0 0 1 0 0 0 0
Y 0 1 0 0 0 0 0 0 0 0
E 0 0 0 0 1 0 0 1 1 0
V 0 0 1 0 1 1 0 0 1 1
T 1 1 1 1 0 1 0 0 0 0
B 0 0 0 0 1 0 0 1 0 1
H 0 0 0 0 1 0 1 0 0 0
| city_directed_graph | pathfinding | 10 | ["H", "V", "E", "T", "X", "Y", "X", "L", "E"] | 9 | 0.02870488166809082 | 9 | 10 | 13 | [[[0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [0, 0, 1, 0, 1, 1, 0, 0, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0]], ["G", "X", "R", "L", "Y", "E", "V", "T", "B", "H"], "E", "X"] | [[[0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [0, 0, 1, 0, 1, 1, 0, 0, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0]], ["G", "X", "R", "L", "Y", "E", "V", "T", "B", "H"], "H", "E", "X"] | ["[[0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [0, 0, 1, 0, 1, 1, 0, 0, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0]]", "['G', 'X', 'R', 'L', 'Y', 'E', 'V', 'T', 'B', 'H']", "['H']", "['E', 'X']"] |
13 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [20, 19, 2, 12, 23, 18, 15, 13, 10, 6, 9, 4, 9, 16, 5, 8, 19, 6, 7, 2, 6, 15, 10, 9, 4, 6, 19, 10, 10, 16, 21, 17, 21, 16, 13, 6, 16, 8, 7, 11, 13, 7, 21, 15, 15, 6, 11, 19, 7], such that the sum of the chosen coins adds up to 216. 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 {6: 6, 8: 6, 16: 4, 15: 11, 12: 3, 10: 5, 20: 14, 9: 3, 17: 8, 7: 5, 5: 5, 2: 1, 11: 4, 23: 18, 19: 3, 13: 13, 18: 6, 4: 3, 21: 20}, 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 | 27 | [16, 2, 9, 19, 19, 19, 16, 19, 16, 12, 2, 9, 9, 11, 11, 10, 17] | 59 | 0.04360342025756836 | 17 | 49 | 49 | [[20, 19, 2, 12, 23, 18, 15, 13, 10, 6, 9, 4, 9, 16, 5, 8, 19, 6, 7, 2, 6, 15, 10, 9, 4, 6, 19, 10, 10, 16, 21, 17, 21, 16, 13, 6, 16, 8, 7, 11, 13, 7, 21, 15, 15, 6, 11, 19, 7]] | [[20, 19, 2, 12, 23, 18, 15, 13, 10, 6, 9, 4, 9, 16, 5, 8, 19, 6, 7, 2, 6, 15, 10, 9, 4, 6, 19, 10, 10, 16, 21, 17, 21, 16, 13, 6, 16, 8, 7, 11, 13, 7, 21, 15, 15, 6, 11, 19, 7], {"6": 6, "8": 6, "16": 4, "15": 11, "12": 3, "10": 5, "20": 14, "9": 3, "17": 8, "7": 5, "5": 5, "2": 1, "11": 4, "23": 18, "19": 3, "13": 13, "18": 6, "4": 3, "21": 20}, 216] | ["[20, 19, 2, 12, 23, 18, 15, 13, 10, 6, 9, 4, 9, 16, 5, 8, 19, 6, 7, 2, 6, 15, 10, 9, 4, 6, 19, 10, 10, 16, 21, 17, 21, 16, 13, 6, 16, 8, 7, 11, 13, 7, 21, 15, 15, 6, 11, 19, 7]", "{6: 6, 8: 6, 16: 4, 15: 11, 12: 3, 10: 5, 20: 14, 9: 3, 17: 8, 7: 5, 5: 5, 2: 1, 11: 4, 23: 18, 19: 3, 13: 13, 18: 6, 4: 3, 21: 20}", "216"] |
13 | 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 6 balls. It is not allowed to place a ball in a tube that already has 6 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', 'Blue', 'Green'], ['Red', 'Green', 'Red', 'Blue'], ['Red', 'Green', 'Blue', 'Red']] | color_sorting | sorting | 7 | [[1, 0], [2, 0], [2, 1], [2, 1], [0, 2], [0, 2], [0, 1], [0, 2], [0, 2], [1, 0], [1, 2], [1, 0], [1, 0], [1, 0], [2, 1], [2, 1], [2, 1], [0, 2]] | 18 | 1.4882152080535889 | 18 | 6 | 12 | [[["Green", "Blue", "Blue", "Green"], ["Red", "Green", "Red", "Blue"], ["Red", "Green", "Blue", "Red"]], 6] | [[["Green", "Blue", "Blue", "Green"], ["Red", "Green", "Red", "Blue"], ["Red", "Green", "Blue", "Red"]], 6] | ["[['Green', 'Blue', 'Blue', 'Green'], ['Red', 'Green', 'Red', 'Blue'], ['Red', 'Green', 'Blue', 'Red']]", "6"] |
13 | We have a 3x3 numerical grid, with numbers ranging from 21 to 59 (21 included in the range but 59 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:
[['29' '45' 'x']
['x' 'x' 'x']
['x' '43' '34']] | consecutive_grid | underdetermined_system | 8 | [[0, 2, 46], [1, 0, 47], [1, 1, 44], [1, 2, 35], [2, 0, 48]] | 342 | 0.32321739196777344 | 5 | 38 | 9 | ["[['29', '45', ''], ['', '', ''], ['', '43', '34']]", 21, 59] | ["[['29', '45', ''], ['', '', ''], ['', '43', '34']]", 21, 59] | ["[['29', '45', ''], ['', '', ''], ['', '43', '34']]", "21", "59"] |
13 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 28 to 57. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 129, and sum of row 1 must be 133. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 136. 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:
[['41' 'x' 'x']
['34' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 7 | [[0, 1, 29], [0, 2, 30], [1, 1, 56], [1, 2, 43], [2, 0, 50], [2, 1, 44], [2, 2, 28]] | 355 | 2.4692792892456055 | 7 | 24 | 9 | ["[['41', '', ''], ['34', '', ''], ['', '', '']]", 3, 28, 57] | ["[['41', '', ''], ['34', '', ''], ['', '', '']]", 28, 57, [1, 2], [1, 2], [129], [133], 136] | ["[['41', '', ''], ['34', '', ''], ['', '', '']]", "28", "57", "[None, 129, None]", "[None, 133, None]", "136"] |
13 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 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 3 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: 4, 1: 2, 2: 2, 3: 7, 4: 4, 5: 5}, 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', 'Red', 'Blue', 'Blue'], [], ['Yellow', 'Red', 'Green', 'Green'], [], [], ['Red', 'Yellow', 'Blue', 'Yellow']] | restricted_sorting | sorting | 1 | [[2, 1], [2, 4], [0, 2], [0, 4], [5, 4], [5, 1], [5, 0], [5, 1]] | 24 | 0.023777484893798828 | 8 | 30 | 12 | [[["Green", "Red", "Blue", "Blue"], [], ["Yellow", "Red", "Green", "Green"], [], [], ["Red", "Yellow", "Blue", "Yellow"]], 4, {"0": 4, "1": 2, "2": 2, "3": 7, "4": 4, "5": 5}] | [[["Green", "Red", "Blue", "Blue"], [], ["Yellow", "Red", "Green", "Green"], [], [], ["Red", "Yellow", "Blue", "Yellow"]], 4, {"0": 4, "1": 2, "2": 2, "3": 7, "4": 4, "5": 5}, 3] | ["[['Green', 'Red', 'Blue', 'Blue'], [], ['Yellow', 'Red', 'Green', 'Green'], [], [], ['Red', 'Yellow', 'Blue', 'Yellow']]", "{0: 4, 1: 2, 2: 2, 3: 7, 4: 4, 5: 5}", "4", "3"] |
13 | 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, 7) to his destination workshop at index (5, 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 8. 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 x 9 x 20 3 9]
[17 11 17 x 9 2 7 x 15]
[x 4 2 19 12 6 x 4 17]
[15 x x 15 11 19 x 9 5]
[3 9 19 15 2 x x 18 x]
[19 5 9 11 9 x x 3 x]
[x x 2 8 8 x x x 19]
[x x 14 x x x 18 x 18]
[x 14 18 7 8 x 10 15 x] | traffic | pathfinding | 1 | [[3, 7], [2, 7], [2, 8], [1, 8], [0, 8], [0, 7], [0, 6], [1, 6], [1, 5], [2, 5], [2, 4], [3, 4], [4, 4], [5, 4], [5, 3], [5, 2], [5, 1], [5, 0]] | 161 | 0.020489215850830078 | 18 | 4 | 4 | [[["x", "x", "x", "x", "9", "x", "20", "3", "9"], ["17", "11", "17", "x", "9", "2", "7", "x", "15"], ["x", "4", "2", "19", "12", "6", "x", "4", "17"], ["15", "x", "x", "15", "11", "19", "x", "9", "5"], ["3", "9", "19", "15", "2", "x", "x", "18", "x"], ["19", "5", "9", "11", "9", "x", "x", "3", "x"], ["x", "x", "2", "8", "8", "x", "x", "x", "19"], ["x", "x", "14", "x", "x", "x", "18", "x", "18"], ["x", "14", "18", "7", "8", "x", "10", "15", "x"]]] | [[["x", "x", "x", "x", "9", "x", "20", "3", "9"], ["17", "11", "17", "x", "9", "2", "7", "x", "15"], ["x", "4", "2", "19", "12", "6", "x", "4", "17"], ["15", "x", "x", "15", "11", "19", "x", "9", "5"], ["3", "9", "19", "15", "2", "x", "x", "18", "x"], ["19", "5", "9", "11", "9", "x", "x", "3", "x"], ["x", "x", "2", "8", "8", "x", "x", "x", "19"], ["x", "x", "14", "x", "x", "x", "18", "x", "18"], ["x", "14", "18", "7", "8", "x", "10", "15", "x"]], [3, 7], [5, 0], 3, 4] | ["[['x', 'x', 'x', 'x', '9', 'x', '20', '3', '9'], ['17', '11', '17', 'x', '9', '2', '7', 'x', '15'], ['x', '4', '2', '19', '12', '6', 'x', '4', '17'], ['15', 'x', 'x', '15', '11', '19', 'x', '9', '5'], ['3', '9', '19', '15', '2', 'x', 'x', '18', 'x'], ['19', '5', '9', '11', '9', 'x', 'x', '3', 'x'], ['x', 'x', '2', '8', '8', 'x', 'x', 'x', '19'], ['x', 'x', '14', 'x', 'x', 'x', '18', 'x', '18'], ['x', '14', '18', '7', '8', 'x', '10', '15', 'x']]", "(3, 7)", "(5, 0)", "3", "4"] |
13 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 9x9. 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 (5, 8). 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 1 1 0 0 0
0 0 0 1 1 1 0 1 1
0 1 0 0 0 0 1 0 1
0 1 1 1 0 0 1 1 0
0 1 1 1 1 0 0 1 1
1 0 1 1 0 1 0 0 0
0 1 1 1 1 0 0 0 0
1 1 0 1 1 0 1 0 0
0 1 1 1 1 1 0 0 0 | trampoline_matrix | pathfinding | 9 | [[1, 0], [1, 1], [1, 2], [2, 3], [2, 4], [2, 5], [3, 5], [4, 6], [5, 7], [5, 8]] | 10 | 0.029414653778076172 | 10 | 8 | 2 | ["[[0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1], [0, 1, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 1, 0, 0, 1, 1, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 0, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 1, 1, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 0, 0, 0]]", 3] | ["[[0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1], [0, 1, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 1, 0, 0, 1, 1, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 0, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 1, 1, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 0, 0, 0]]", [1, 0], [5, 8], 3] | ["[[0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1], [0, 1, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 1, 0, 0, 1, 1, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 0, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 1, 1, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 0, 0, 0]]", "(1, 0)", "(5, 8)", "3"] |
13 | Given 5 labeled water jugs with capacities 57, 84, 47, 76, 85, 69 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 203, 217, 334 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 | 4 | [["+", 47, 3], ["+", 76, 3], ["+", 85, 3], ["+", 57, 3], ["+", 69, 3], ["+", 85, 2], ["+", 85, 2], ["+", 47, 2], ["+", 47, 1], ["+", 57, 1], ["+", 84, 1], ["-", 69, 1], ["+", 84, 1]] | 13 | 0.028015613555908203 | 13 | 36 | 3 | [[57, 84, 47, 76, 85, 69], [203, 217, 334]] | [[57, 84, 47, 76, 85, 69], [203, 217, 334]] | ["[57, 84, 47, 76, 85, 69]", "[203, 217, 334]"] |
14 | 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, 51, 19], [89, '_', 21], [43, 39, 45]] | 8_puzzle | puzzle | 4 | [21, 45, 39, 21, 45, 19, 51, 28, 89, 43, 21, 39, 19, 45, 28, 51, 45, 28, 39, 19] | 20 | 0.045632362365722656 | 20 | 4 | 9 | [[[28, 51, 19], [89, "_", 21], [43, 39, 45]]] | [[[28, 51, 19], [89, "_", 21], [43, 39, 45]]] | ["[[28, 51, 19], [89, '_', 21], [43, 39, 45]]"] |
14 | 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: ann, birk, trey, bali The initial board: [['_', 'a', 't', 'n'], ['b', 'i', 'r', 'n'], ['k', 'r', 'e', 'y'], ['b', 'a', 'l', 'i']] | 8_puzzle_words | puzzle | 1 | ["down-right", "down-left", "down-right", "up-right", "up-left", "up-right", "down-right", "down-left", "down-left", "up-left", "up-right", "up-left"] | 12 | 0.1393892765045166 | 12 | 4 | 16 | [[["_", "a", "t", "n"], ["b", "i", "r", "n"], ["k", "r", "e", "y"], ["b", "a", "l", "i"]]] | [[["_", "a", "t", "n"], ["b", "i", "r", "n"], ["k", "r", "e", "y"], ["b", "a", "l", "i"]], ["ann", "birk", "trey", "bali"]] | ["[['_', 'a', 't', 'n'], ['b', 'i', 'r', 'n'], ['k', 'r', 'e', 'y'], ['b', 'a', 'l', 'i']]", "['ann', 'birk', 'trey', 'bali']"] |
14 | 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 'N'. Our task is to visit city H 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 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.
M U B F V Z P N E H
M 0 0 0 0 0 1 0 0 0 0
U 1 0 0 1 0 0 1 0 0 0
B 1 1 0 0 1 0 0 0 1 0
F 0 0 1 0 0 0 0 0 0 1
V 0 0 0 1 0 0 1 0 0 0
Z 0 1 1 0 1 0 0 0 0 1
P 1 0 0 0 1 1 0 0 0 0
N 0 1 1 0 0 1 0 0 1 0
E 1 0 0 0 0 1 0 0 0 0
H 1 0 1 0 1 1 0 0 0 0
| city_directed_graph | pathfinding | 10 | ["N", "U", "F", "H", "M", "Z", "H", "M"] | 8 | 0.027659177780151367 | 8 | 10 | 13 | [[[0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 1, 1, 0, 0, 0, 0]], ["M", "U", "B", "F", "V", "Z", "P", "N", "E", "H"], "H", "M"] | [[[0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 1, 1, 0, 0, 0, 0]], ["M", "U", "B", "F", "V", "Z", "P", "N", "E", "H"], "N", "H", "M"] | ["[[0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 1, 1, 0, 0, 0, 0]]", "['M', 'U', 'B', 'F', 'V', 'Z', 'P', 'N', 'E', 'H']", "['N']", "['H', 'M']"] |
14 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [9, 18, 7, 20, 4, 12, 5, 5, 18, 5, 2, 11, 5, 16, 19, 8, 10, 9, 12, 14, 17, 6, 14, 16, 20, 10, 10, 13, 4, 13, 7, 14, 14, 10, 2, 7, 14, 11, 16, 10, 10, 5, 14, 20, 4, 17], such that the sum of the chosen coins adds up to 206. 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 {17: 16, 8: 8, 6: 6, 16: 12, 5: 4, 14: 12, 18: 9, 12: 1, 19: 12, 4: 2, 7: 3, 10: 7, 11: 7, 13: 6, 2: 1, 9: 1, 20: 10}, 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 | 28 | [12, 2, 9, 9, 4, 7, 13, 13, 12, 4, 7, 4, 7, 19, 18, 10, 11, 10, 2, 5, 11, 17] | 102 | 0.040293216705322266 | 22 | 46 | 46 | [[9, 18, 7, 20, 4, 12, 5, 5, 18, 5, 2, 11, 5, 16, 19, 8, 10, 9, 12, 14, 17, 6, 14, 16, 20, 10, 10, 13, 4, 13, 7, 14, 14, 10, 2, 7, 14, 11, 16, 10, 10, 5, 14, 20, 4, 17]] | [[9, 18, 7, 20, 4, 12, 5, 5, 18, 5, 2, 11, 5, 16, 19, 8, 10, 9, 12, 14, 17, 6, 14, 16, 20, 10, 10, 13, 4, 13, 7, 14, 14, 10, 2, 7, 14, 11, 16, 10, 10, 5, 14, 20, 4, 17], {"17": 16, "8": 8, "6": 6, "16": 12, "5": 4, "14": 12, "18": 9, "12": 1, "19": 12, "4": 2, "7": 3, "10": 7, "11": 7, "13": 6, "2": 1, "9": 1, "20": 10}, 206] | ["[9, 18, 7, 20, 4, 12, 5, 5, 18, 5, 2, 11, 5, 16, 19, 8, 10, 9, 12, 14, 17, 6, 14, 16, 20, 10, 10, 13, 4, 13, 7, 14, 14, 10, 2, 7, 14, 11, 16, 10, 10, 5, 14, 20, 4, 17]", "{17: 16, 8: 8, 6: 6, 16: 12, 5: 4, 14: 12, 18: 9, 12: 1, 19: 12, 4: 2, 7: 3, 10: 7, 11: 7, 13: 6, 2: 1, 9: 1, 20: 10}", "206"] |
14 | 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 6 balls. It is not allowed to place a ball in a tube that already has 6 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', 'Green', 'Blue'], ['Red', 'Green', 'Red', 'Red'], ['Green', 'Blue', 'Red', 'Blue']] | color_sorting | sorting | 7 | [[0, 2], [0, 1], [0, 2], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [1, 2], [0, 1], [0, 2], [1, 2], [1, 2], [1, 0], [2, 1], [2, 1]] | 18 | 1.1862623691558838 | 18 | 6 | 12 | [[["Green", "Blue", "Green", "Blue"], ["Red", "Green", "Red", "Red"], ["Green", "Blue", "Red", "Blue"]], 6] | [[["Green", "Blue", "Green", "Blue"], ["Red", "Green", "Red", "Red"], ["Green", "Blue", "Red", "Blue"]], 6] | ["[['Green', 'Blue', 'Green', 'Blue'], ['Red', 'Green', 'Red', 'Red'], ['Green', 'Blue', 'Red', 'Blue']]", "6"] |
14 | We have a 3x3 numerical grid, with numbers ranging from 11 to 49 (11 included in the range but 49 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:
[['41' 'x' '21']
['x' 'x' 'x']
['12' 'x' '42']] | consecutive_grid | underdetermined_system | 8 | [[0, 1, 22], [1, 0, 13], [1, 1, 15], [1, 2, 23], [2, 1, 14]] | 268 | 0.8595123291015625 | 5 | 38 | 9 | ["[['41', '', '21'], ['', '', ''], ['12', '', '42']]", 11, 49] | ["[['41', '', '21'], ['', '', ''], ['12', '', '42']]", 11, 49] | ["[['41', '', '21'], ['', '', ''], ['12', '', '42']]", "11", "49"] |
14 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 28 to 57. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 143, and sum of row 1 must be 134. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 131. 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' '32' 'x']
['38' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 7 | [[0, 0, 28], [0, 2, 30], [1, 1, 56], [1, 2, 40], [2, 0, 45], [2, 1, 55], [2, 2, 29]] | 353 | 3.0488429069519043 | 7 | 24 | 9 | ["[['', '32', ''], ['38', '', ''], ['', '', '']]", 3, 28, 57] | ["[['', '32', ''], ['38', '', ''], ['', '', '']]", 28, 57, [1, 2], [1, 2], [143], [134], 131] | ["[['', '32', ''], ['38', '', ''], ['', '', '']]", "28", "57", "[None, 143, None]", "[None, 134, None]", "131"] |
14 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 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 3 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: 6, 2: 5, 3: 5, 4: 3, 5: 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', 'Yellow', 'Red', 'Yellow'], [], ['Blue', 'Blue', 'Blue', 'Red'], [], ['Green', 'Green', 'Red', 'Yellow'], []] | restricted_sorting | sorting | 1 | [[0, 1], [4, 1], [4, 1], [2, 3], [2, 3], [2, 3], [4, 5], [0, 4], [0, 5], [0, 4], [2, 5]] | 42 | 0.16206979751586914 | 11 | 30 | 12 | [[["Green", "Yellow", "Red", "Yellow"], [], ["Blue", "Blue", "Blue", "Red"], [], ["Green", "Green", "Red", "Yellow"], []], 4, {"0": 3, "1": 6, "2": 5, "3": 5, "4": 3, "5": 1}] | [[["Green", "Yellow", "Red", "Yellow"], [], ["Blue", "Blue", "Blue", "Red"], [], ["Green", "Green", "Red", "Yellow"], []], 4, {"0": 3, "1": 6, "2": 5, "3": 5, "4": 3, "5": 1}, 3] | ["[['Green', 'Yellow', 'Red', 'Yellow'], [], ['Blue', 'Blue', 'Blue', 'Red'], [], ['Green', 'Green', 'Red', 'Yellow'], []]", "{0: 3, 1: 6, 2: 5, 3: 5, 4: 3, 5: 1}", "4", "3"] |
14 | 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 (7, 8), 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 6, and district 3 covering rows 7 to 8. 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 3 13 18 x x 3 x x]
[x 3 x x 18 1 13 x x]
[x x x 6 x 13 x 11 1]
[4 3 x x x x 6 6 11]
[14 16 x x x x x 18 11]
[14 x 11 x x 4 x 1 x]
[18 7 1 x 8 x x x x]
[4 9 6 12 13 19 x 14 4]
[x x 17 12 7 7 9 3 1] | traffic | pathfinding | 1 | [[3, 1], [3, 0], [4, 0], [5, 0], [6, 0], [6, 1], [6, 2], [7, 2], [7, 3], [8, 3], [8, 4], [8, 5], [8, 6], [8, 7], [8, 8], [7, 8]] | 119 | 0.02022695541381836 | 16 | 4 | 4 | [[["x", "3", "13", "18", "x", "x", "3", "x", "x"], ["x", "3", "x", "x", "18", "1", "13", "x", "x"], ["x", "x", "x", "6", "x", "13", "x", "11", "1"], ["4", "3", "x", "x", "x", "x", "6", "6", "11"], ["14", "16", "x", "x", "x", "x", "x", "18", "11"], ["14", "x", "11", "x", "x", "4", "x", "1", "x"], ["18", "7", "1", "x", "8", "x", "x", "x", "x"], ["4", "9", "6", "12", "13", "19", "x", "14", "4"], ["x", "x", "17", "12", "7", "7", "9", "3", "1"]]] | [[["x", "3", "13", "18", "x", "x", "3", "x", "x"], ["x", "3", "x", "x", "18", "1", "13", "x", "x"], ["x", "x", "x", "6", "x", "13", "x", "11", "1"], ["4", "3", "x", "x", "x", "x", "6", "6", "11"], ["14", "16", "x", "x", "x", "x", "x", "18", "11"], ["14", "x", "11", "x", "x", "4", "x", "1", "x"], ["18", "7", "1", "x", "8", "x", "x", "x", "x"], ["4", "9", "6", "12", "13", "19", "x", "14", "4"], ["x", "x", "17", "12", "7", "7", "9", "3", "1"]], [3, 1], [7, 8], 3, 6] | ["[['x', '3', '13', '18', 'x', 'x', '3', 'x', 'x'], ['x', '3', 'x', 'x', '18', '1', '13', 'x', 'x'], ['x', 'x', 'x', '6', 'x', '13', 'x', '11', '1'], ['4', '3', 'x', 'x', 'x', 'x', '6', '6', '11'], ['14', '16', 'x', 'x', 'x', 'x', 'x', '18', '11'], ['14', 'x', '11', 'x', 'x', '4', 'x', '1', 'x'], ['18', '7', '1', 'x', '8', 'x', 'x', 'x', 'x'], ['4', '9', '6', '12', '13', '19', 'x', '14', '4'], ['x', 'x', '17', '12', '7', '7', '9', '3', '1']]", "(3, 1)", "(7, 8)", "3", "6"] |
14 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 9x9. 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, 7) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (7, 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 0 0 0 0 1 1 0 0
1 0 0 1 0 1 1 0 0
0 0 1 0 1 0 0 0 1
1 0 0 1 1 0 0 0 0
0 0 0 0 1 1 1 0 1
0 0 0 1 1 0 1 1 0
0 1 1 0 1 1 0 1 0
0 1 0 0 1 0 0 0 0
0 0 0 0 1 0 1 1 0 | trampoline_matrix | pathfinding | 9 | [[0, 7], [1, 7], [2, 7], [2, 6], [2, 5], [1, 4], [2, 3], [3, 2], [4, 2], [5, 2], [5, 1], [5, 0], [6, 0], [7, 0]] | 14 | 0.03127884864807129 | 14 | 8 | 2 | ["[[1, 0, 0, 0, 0, 1, 1, 0, 0], [1, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 1], [0, 0, 0, 1, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 1, 0]]", 3] | ["[[1, 0, 0, 0, 0, 1, 1, 0, 0], [1, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 1], [0, 0, 0, 1, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 1, 0]]", [0, 7], [7, 0], 3] | ["[[1, 0, 0, 0, 0, 1, 1, 0, 0], [1, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 1], [0, 0, 0, 1, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 1, 0]]", "(0, 7)", "(7, 0)", "3"] |
14 | Given 5 labeled water jugs with capacities 144, 37, 73, 79, 75, 74 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 236, 333, 386 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 | 4 | [["+", 74, 3], ["+", 75, 3], ["+", 79, 3], ["+", 79, 3], ["+", 79, 3], ["+", 73, 2], ["+", 79, 2], ["+", 144, 2], ["+", 37, 2], ["+", 73, 1], ["+", 79, 1], ["+", 79, 1], ["-", 74, 1], ["+", 79, 1]] | 14 | 0.03917884826660156 | 14 | 36 | 3 | [[144, 37, 73, 79, 75, 74], [236, 333, 386]] | [[144, 37, 73, 79, 75, 74], [236, 333, 386]] | ["[144, 37, 73, 79, 75, 74]", "[236, 333, 386]"] |
15 | 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: [[80, 62, 76], [47, 67, 82], [24, 73, '_']] | 8_puzzle | puzzle | 4 | [73, 67, 82, 73, 67, 24, 47, 82, 62, 80, 82, 47, 24, 62, 73, 67, 62, 24, 47, 73, 67, 62] | 22 | 0.08130145072937012 | 22 | 4 | 9 | [[[80, 62, 76], [47, 67, 82], [24, 73, "_"]]] | [[[80, 62, 76], [47, 67, 82], [24, 73, "_"]]] | ["[[80, 62, 76], [47, 67, 82], [24, 73, '_']]"] |
15 | 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: ric, have, sgad, batz The initial board: [['a', 'r', '_', 'c'], ['h', 'a', 'v', 'e'], ['a', 'g', 's', 'd'], ['b', 'i', 't', 'z']] | 8_puzzle_words | puzzle | 1 | ["down-right", "down-left", "down-left", "up-left", "up-right", "down-right", "up-right", "up-left", "down-left", "down-right", "down-left", "up-left", "up-right", "up-left"] | 14 | 0.1922132968902588 | 14 | 4 | 16 | [[["a", "r", "_", "c"], ["h", "a", "v", "e"], ["a", "g", "s", "d"], ["b", "i", "t", "z"]]] | [[["a", "r", "_", "c"], ["h", "a", "v", "e"], ["a", "g", "s", "d"], ["b", "i", "t", "z"]], ["ric", "have", "sgad", "batz"]] | ["[['a', 'r', '_', 'c'], ['h', 'a', 'v', 'e'], ['a', 'g', 's', 'd'], ['b', 'i', 't', 'z']]", "['ric', 'have', 'sgad', 'batz']"] |
15 | 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 W and city X 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 X and W, 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.
U W A J K H E X R T
U 0 0 0 0 1 0 0 0 0 1
W 1 0 0 1 0 0 0 0 0 0
A 0 0 0 0 0 0 0 1 1 0
J 1 0 1 0 0 0 1 0 0 0
K 0 1 0 1 0 0 0 0 0 1
H 0 1 0 0 0 0 1 0 0 0
E 0 0 0 0 0 0 0 0 1 0
X 0 1 0 0 0 1 0 0 0 0
R 1 0 0 0 1 1 1 0 0 1
T 1 1 1 0 0 1 0 1 0 0
| city_directed_graph | pathfinding | 10 | ["E", "R", "T", "X", "W", "J", "A", "X", "W"] | 9 | 0.02704644203186035 | 9 | 10 | 13 | [[[0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 1, 0, 1, 0, 0]], ["U", "W", "A", "J", "K", "H", "E", "X", "R", "T"], "W", "X"] | [[[0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 1, 0, 1, 0, 0]], ["U", "W", "A", "J", "K", "H", "E", "X", "R", "T"], "E", "W", "X"] | ["[[0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 1, 0, 1, 0, 0]]", "['U', 'W', 'A', 'J', 'K', 'H', 'E', 'X', 'R', 'T']", "['E']", "['W', 'X']"] |
15 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [1, 2, 17, 12, 7, 17, 2, 20, 4, 4, 17, 19, 15, 16, 18, 21, 18, 10, 3, 9, 12, 13, 8, 16, 9, 14, 13, 5, 13, 6, 20, 6, 13, 12, 8, 14, 15, 7, 10, 3, 16, 16, 9, 3, 2, 6, 9, 14, 16, 20, 11, 4, 17], such that the sum of the chosen coins adds up to 213. 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 {8: 5, 5: 2, 19: 2, 4: 4, 9: 2, 3: 1, 2: 2, 12: 1, 13: 6, 6: 5, 11: 1, 17: 14, 7: 4, 16: 13, 21: 10, 14: 13, 1: 1, 18: 12, 10: 10, 15: 11, 20: 20}, 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 | 29 | [3, 3, 11, 19, 12, 2, 9, 9, 9, 9, 13, 12, 13, 13, 13, 21, 12, 15, 15] | 74 | 0.046939849853515625 | 19 | 53 | 53 | [[1, 2, 17, 12, 7, 17, 2, 20, 4, 4, 17, 19, 15, 16, 18, 21, 18, 10, 3, 9, 12, 13, 8, 16, 9, 14, 13, 5, 13, 6, 20, 6, 13, 12, 8, 14, 15, 7, 10, 3, 16, 16, 9, 3, 2, 6, 9, 14, 16, 20, 11, 4, 17]] | [[1, 2, 17, 12, 7, 17, 2, 20, 4, 4, 17, 19, 15, 16, 18, 21, 18, 10, 3, 9, 12, 13, 8, 16, 9, 14, 13, 5, 13, 6, 20, 6, 13, 12, 8, 14, 15, 7, 10, 3, 16, 16, 9, 3, 2, 6, 9, 14, 16, 20, 11, 4, 17], {"8": 5, "5": 2, "19": 2, "4": 4, "9": 2, "3": 1, "2": 2, "12": 1, "13": 6, "6": 5, "11": 1, "17": 14, "7": 4, "16": 13, "21": 10, "14": 13, "1": 1, "18": 12, "10": 10, "15": 11, "20": 20}, 213] | ["[1, 2, 17, 12, 7, 17, 2, 20, 4, 4, 17, 19, 15, 16, 18, 21, 18, 10, 3, 9, 12, 13, 8, 16, 9, 14, 13, 5, 13, 6, 20, 6, 13, 12, 8, 14, 15, 7, 10, 3, 16, 16, 9, 3, 2, 6, 9, 14, 16, 20, 11, 4, 17]", "{8: 5, 5: 2, 19: 2, 4: 4, 9: 2, 3: 1, 2: 2, 12: 1, 13: 6, 6: 5, 11: 1, 17: 14, 7: 4, 16: 13, 21: 10, 14: 13, 1: 1, 18: 12, 10: 10, 15: 11, 20: 20}", "213"] |
15 | 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 6 balls. It is not allowed to place a ball in a tube that already has 6 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', 'Red', 'Red', 'Blue'], ['Green', 'Green', 'Red', 'Red'], ['Green', 'Green', 'Blue', 'Blue']] | color_sorting | sorting | 7 | [[2, 1], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [2, 0], [2, 1], [2, 1], [0, 2]] | 14 | 0.14858675003051758 | 14 | 6 | 12 | [[["Blue", "Red", "Red", "Blue"], ["Green", "Green", "Red", "Red"], ["Green", "Green", "Blue", "Blue"]], 6] | [[["Blue", "Red", "Red", "Blue"], ["Green", "Green", "Red", "Red"], ["Green", "Green", "Blue", "Blue"]], 6] | ["[['Blue', 'Red', 'Red', 'Blue'], ['Green', 'Green', 'Red', 'Red'], ['Green', 'Green', 'Blue', 'Blue']]", "6"] |
15 | We have a 3x3 numerical grid, with numbers ranging from 18 to 56 (18 included in the range but 56 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' '23']
['31' 'x' 'x']
['x' '42' '51']] | consecutive_grid | underdetermined_system | 8 | [[0, 0, 18], [0, 1, 19], [1, 1, 25], [1, 2, 24], [2, 0, 32]] | 252 | 0.17498183250427246 | 5 | 38 | 9 | ["[['', '', '23'], ['31', '', ''], ['', '42', '51']]", 18, 56] | ["[['', '', '23'], ['31', '', ''], ['', '42', '51']]", 18, 56] | ["[['', '', '23'], ['31', '', ''], ['', '42', '51']]", "18", "56"] |
15 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 48 to 77. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 190, and sum of row 1 must be 167. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 172. 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' 'x']
['x' 'x' '55']
['x' 'x' 'x']] | magic_square | underdetermined_system | 7 | [[0, 0, 49], [0, 1, 51], [0, 2, 52], [1, 0, 48], [1, 1, 64], [2, 0, 56], [2, 1, 75], [2, 2, 50]] | 500 | 37.735610485076904 | 8 | 24 | 9 | ["[['', '', ''], ['', '', '55'], ['', '', '']]", 3, 48, 77] | ["[['', '', ''], ['', '', '55'], ['', '', '']]", 48, 77, [1, 2], [1, 2], [190], [167], 172] | ["[['', '', ''], ['', '', '55'], ['', '', '']]", "48", "77", "[None, 190, None]", "[None, 167, None]", "172"] |
15 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 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 3 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: 4, 1: 5, 2: 5, 3: 2, 4: 5, 5: 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? [[], [], [], ['Red', 'Green', 'Green', 'Red'], ['Yellow', 'Blue', 'Yellow', 'Blue'], ['Yellow', 'Green', 'Red', 'Blue']] | restricted_sorting | sorting | 1 | [[4, 0], [5, 0], [3, 1], [5, 2], [5, 1], [3, 2], [3, 2], [4, 5], [4, 0], [1, 3], [1, 3], [4, 5]] | 45 | 0.027285099029541016 | 12 | 30 | 12 | [[[], [], [], ["Red", "Green", "Green", "Red"], ["Yellow", "Blue", "Yellow", "Blue"], ["Yellow", "Green", "Red", "Blue"]], 4, {"0": 4, "1": 5, "2": 5, "3": 2, "4": 5, "5": 2}] | [[[], [], [], ["Red", "Green", "Green", "Red"], ["Yellow", "Blue", "Yellow", "Blue"], ["Yellow", "Green", "Red", "Blue"]], 4, {"0": 4, "1": 5, "2": 5, "3": 2, "4": 5, "5": 2}, 3] | ["[[], [], [], ['Red', 'Green', 'Green', 'Red'], ['Yellow', 'Blue', 'Yellow', 'Blue'], ['Yellow', 'Green', 'Red', 'Blue']]", "{0: 4, 1: 5, 2: 5, 3: 2, 4: 5, 5: 2}", "4", "3"] |
15 | 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, 8), 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 8. 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.
[4 13 x 9 x x x x x]
[1 11 x 16 5 7 12 16 x]
[12 11 x 14 x x 12 x 3]
[9 11 x 9 10 x 8 x x]
[20 2 x 1 16 12 18 17 10]
[10 13 4 15 13 2 20 3 15]
[x 6 13 1 8 20 14 11 3]
[14 x 9 x x 13 19 10 x]
[12 x 18 1 x x 9 x x] | traffic | pathfinding | 1 | [[3, 1], [2, 1], [3, 1], [4, 1], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8]] | 109 | 0.020708322525024414 | 12 | 4 | 4 | [[["4", "13", "x", "9", "x", "x", "x", "x", "x"], ["1", "11", "x", "16", "5", "7", "12", "16", "x"], ["12", "11", "x", "14", "x", "x", "12", "x", "3"], ["9", "11", "x", "9", "10", "x", "8", "x", "x"], ["20", "2", "x", "1", "16", "12", "18", "17", "10"], ["10", "13", "4", "15", "13", "2", "20", "3", "15"], ["x", "6", "13", "1", "8", "20", "14", "11", "3"], ["14", "x", "9", "x", "x", "13", "19", "10", "x"], ["12", "x", "18", "1", "x", "x", "9", "x", "x"]]] | [[["4", "13", "x", "9", "x", "x", "x", "x", "x"], ["1", "11", "x", "16", "5", "7", "12", "16", "x"], ["12", "11", "x", "14", "x", "x", "12", "x", "3"], ["9", "11", "x", "9", "10", "x", "8", "x", "x"], ["20", "2", "x", "1", "16", "12", "18", "17", "10"], ["10", "13", "4", "15", "13", "2", "20", "3", "15"], ["x", "6", "13", "1", "8", "20", "14", "11", "3"], ["14", "x", "9", "x", "x", "13", "19", "10", "x"], ["12", "x", "18", "1", "x", "x", "9", "x", "x"]], [3, 1], [5, 8], 2, 4] | ["[['4', '13', 'x', '9', 'x', 'x', 'x', 'x', 'x'], ['1', '11', 'x', '16', '5', '7', '12', '16', 'x'], ['12', '11', 'x', '14', 'x', 'x', '12', 'x', '3'], ['9', '11', 'x', '9', '10', 'x', '8', 'x', 'x'], ['20', '2', 'x', '1', '16', '12', '18', '17', '10'], ['10', '13', '4', '15', '13', '2', '20', '3', '15'], ['x', '6', '13', '1', '8', '20', '14', '11', '3'], ['14', 'x', '9', 'x', 'x', '13', '19', '10', 'x'], ['12', 'x', '18', '1', 'x', 'x', '9', 'x', 'x']]", "(3, 1)", "(5, 8)", "2", "4"] |
15 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 9x9. 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, 7) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (7, 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 1 0 0 0 0 0 0
1 1 0 0 1 0 0 1 1
0 0 0 0 0 0 0 1 1
0 0 1 0 0 0 1 1 0
1 0 0 0 1 1 0 0 1
0 0 0 0 1 0 0 0 0
1 0 0 0 1 0 0 0 1
0 0 1 1 1 1 1 1 0
1 1 0 1 0 0 1 0 0 | trampoline_matrix | pathfinding | 9 | [[0, 7], [0, 6], [1, 6], [2, 6], [2, 5], [3, 5], [3, 4], [4, 3], [5, 3], [6, 2], [7, 1]] | 11 | 0.029547452926635742 | 11 | 8 | 2 | ["[[1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 1, 0, 0, 0, 1, 1, 0], [1, 0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 1, 0, 0, 1, 0, 0]]", 3] | ["[[1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 1, 0, 0, 0, 1, 1, 0], [1, 0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 1, 0, 0, 1, 0, 0]]", [0, 7], [7, 1], 3] | ["[[1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 1, 0, 0, 0, 1, 1, 0], [1, 0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 1, 0, 0, 1, 0, 0]]", "(0, 7)", "(7, 1)", "3"] |
15 | Given 5 labeled water jugs with capacities 19, 50, 12, 63, 143, 13 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 160, 170, 330 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 | 4 | [["+", 63, 3], ["+", 143, 3], ["-", 19, 3], ["+", 143, 3], ["+", 63, 2], ["+", 63, 2], ["-", 19, 2], ["+", 63, 2], ["+", 143, 1], ["-", 63, 1], ["-", 63, 1], ["+", 143, 1]] | 12 | 0.03795623779296875 | 12 | 36 | 3 | [[19, 50, 12, 63, 143, 13], [160, 170, 330]] | [[19, 50, 12, 63, 143, 13], [160, 170, 330]] | ["[19, 50, 12, 63, 143, 13]", "[160, 170, 330]"] |
16 | 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: [[77, 81, 74], [93, 85, 98], [59, 53, '_']] | 8_puzzle | puzzle | 4 | [53, 59, 93, 77, 81, 85, 98, 74, 85, 98, 77, 93, 59, 77, 93, 81, 98, 93, 77, 53] | 20 | 0.028780221939086914 | 20 | 4 | 9 | [[[77, 81, 74], [93, 85, 98], [59, 53, "_"]]] | [[[77, 81, 74], [93, 85, 98], [59, 53, "_"]]] | ["[[77, 81, 74], [93, 85, 98], [59, 53, '_']]"] |
16 | 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: goa, yodh, wall, acle The initial board: [['o', 'g', 'h', 'a'], ['y', 'c', 'd', 'l'], ['o', 'a', '_', 'l'], ['a', 'w', 'l', 'e']] | 8_puzzle_words | puzzle | 1 | ["up-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left"] | 8 | 0.13991522789001465 | 8 | 4 | 16 | [[["o", "g", "h", "a"], ["y", "c", "d", "l"], ["o", "a", "_", "l"], ["a", "w", "l", "e"]]] | [[["o", "g", "h", "a"], ["y", "c", "d", "l"], ["o", "a", "_", "l"], ["a", "w", "l", "e"]], ["goa", "yodh", "wall", "acle"]] | ["[['o', 'g', 'h', 'a'], ['y', 'c', 'd', 'l'], ['o', 'a', '_', 'l'], ['a', 'w', 'l', 'e']]", "['goa', 'yodh', 'wall', 'acle']"] |
16 | 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 'S'. Our task is to visit city P and city G 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 G and P, 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.
C V A G Y P Z S J I
C 0 0 0 1 0 1 1 1 0 0
V 0 0 0 0 0 1 0 0 0 0
A 0 1 0 0 0 0 1 0 1 0
G 0 1 0 0 1 0 0 0 0 0
Y 0 0 0 1 0 0 1 0 0 0
P 0 1 0 0 1 0 1 0 0 1
Z 0 0 0 0 1 1 0 1 1 0
S 0 0 1 0 0 0 0 0 0 0
J 0 0 0 0 0 1 0 1 0 0
I 1 0 0 0 1 1 1 0 0 0
| city_directed_graph | pathfinding | 10 | ["S", "A", "J", "P", "I", "C", "G", "V", "P", "Y", "G"] | 11 | 0.030188560485839844 | 11 | 10 | 13 | [[[0, 0, 0, 1, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 1, 0, 1, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 0, 1, 1, 1, 0, 0, 0]], ["C", "V", "A", "G", "Y", "P", "Z", "S", "J", "I"], "P", "G"] | [[[0, 0, 0, 1, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 1, 0, 1, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 0, 1, 1, 1, 0, 0, 0]], ["C", "V", "A", "G", "Y", "P", "Z", "S", "J", "I"], "S", "P", "G"] | ["[[0, 0, 0, 1, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 1, 0, 1, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 0, 1, 1, 1, 0, 0, 0]]", "['C', 'V', 'A', 'G', 'Y', 'P', 'Z', 'S', 'J', 'I']", "['S']", "['P', 'G']"] |
16 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [11, 13, 22, 11, 16, 20, 10, 10, 17, 21, 6, 6, 15, 15, 21, 6, 4, 16, 9, 11, 3, 13, 2, 9, 11, 1, 7, 2, 2, 12, 5, 2, 11, 16, 20, 9, 2, 4, 10, 17, 11, 22, 11, 2, 18, 23, 15, 22, 11, 15, 20, 9], such that the sum of the chosen coins adds up to 223. 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 {6: 2, 11: 9, 3: 3, 15: 2, 9: 1, 18: 13, 22: 13, 16: 5, 21: 2, 5: 2, 12: 4, 7: 5, 4: 3, 13: 2, 1: 1, 20: 14, 2: 1, 10: 4, 23: 15, 17: 9}, 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 | 30 | [9, 9, 9, 21, 2, 13, 13, 15, 15, 15, 15, 21, 16, 12, 6, 9, 6, 17] | 43 | 0.04377126693725586 | 18 | 52 | 52 | [[11, 13, 22, 11, 16, 20, 10, 10, 17, 21, 6, 6, 15, 15, 21, 6, 4, 16, 9, 11, 3, 13, 2, 9, 11, 1, 7, 2, 2, 12, 5, 2, 11, 16, 20, 9, 2, 4, 10, 17, 11, 22, 11, 2, 18, 23, 15, 22, 11, 15, 20, 9]] | [[11, 13, 22, 11, 16, 20, 10, 10, 17, 21, 6, 6, 15, 15, 21, 6, 4, 16, 9, 11, 3, 13, 2, 9, 11, 1, 7, 2, 2, 12, 5, 2, 11, 16, 20, 9, 2, 4, 10, 17, 11, 22, 11, 2, 18, 23, 15, 22, 11, 15, 20, 9], {"6": 2, "11": 9, "3": 3, "15": 2, "9": 1, "18": 13, "22": 13, "16": 5, "21": 2, "5": 2, "12": 4, "7": 5, "4": 3, "13": 2, "1": 1, "20": 14, "2": 1, "10": 4, "23": 15, "17": 9}, 223] | ["[11, 13, 22, 11, 16, 20, 10, 10, 17, 21, 6, 6, 15, 15, 21, 6, 4, 16, 9, 11, 3, 13, 2, 9, 11, 1, 7, 2, 2, 12, 5, 2, 11, 16, 20, 9, 2, 4, 10, 17, 11, 22, 11, 2, 18, 23, 15, 22, 11, 15, 20, 9]", "{6: 2, 11: 9, 3: 3, 15: 2, 9: 1, 18: 13, 22: 13, 16: 5, 21: 2, 5: 2, 12: 4, 7: 5, 4: 3, 13: 2, 1: 1, 20: 14, 2: 1, 10: 4, 23: 15, 17: 9}", "223"] |
16 | 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 6 balls. It is not allowed to place a ball in a tube that already has 6 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', 'Blue'], ['Red', 'Green', 'Red', 'Blue'], ['Blue', 'Red', 'Green', 'Blue']] | color_sorting | sorting | 7 | [[0, 2], [1, 2], [0, 1], [0, 1], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [1, 0], [2, 1], [2, 0], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [0, 1], [0, 1], [0, 2], [0, 1], [2, 0], [2, 0]] | 23 | 8.691032648086548 | 23 | 6 | 12 | [[["Red", "Green", "Green", "Blue"], ["Red", "Green", "Red", "Blue"], ["Blue", "Red", "Green", "Blue"]], 6] | [[["Red", "Green", "Green", "Blue"], ["Red", "Green", "Red", "Blue"], ["Blue", "Red", "Green", "Blue"]], 6] | ["[['Red', 'Green', 'Green', 'Blue'], ['Red', 'Green', 'Red', 'Blue'], ['Blue', 'Red', 'Green', 'Blue']]", "6"] |
16 | We have a 3x3 numerical grid, with numbers ranging from 28 to 66 (28 included in the range but 66 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:
[['37' 'x' 'x']
['x' 'x' 'x']
['44' 'x' '61']] | consecutive_grid | underdetermined_system | 9 | [[0, 1, 29], [0, 2, 28], [1, 0, 38], [1, 1, 31], [1, 2, 30], [2, 1, 45]] | 342 | 0.1785869598388672 | 6 | 38 | 9 | ["[['37', '', ''], ['', '', ''], ['44', '', '61']]", 28, 66] | ["[['37', '', ''], ['', '', ''], ['44', '', '61']]", 28, 66] | ["[['37', '', ''], ['', '', ''], ['44', '', '61']]", "28", "66"] |
16 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 48 to 77. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 200, and sum of row 1 must be 191. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 201. 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' 'x']
['x' 'x' '66']
['x' 'x' 'x']] | magic_square | underdetermined_system | 7 | [[0, 0, 48], [0, 1, 51], [0, 2, 53], [1, 0, 49], [1, 1, 76], [2, 0, 72], [2, 1, 73], [2, 2, 50]] | 538 | 89.56194949150085 | 8 | 24 | 9 | ["[['', '', ''], ['', '', '66'], ['', '', '']]", 3, 48, 77] | ["[['', '', ''], ['', '', '66'], ['', '', '']]", 48, 77, [1, 2], [1, 2], [200], [191], 201] | ["[['', '', ''], ['', '', '66'], ['', '', '']]", "48", "77", "[None, 200, None]", "[None, 191, None]", "201"] |
16 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 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 3 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: 5, 2: 2, 3: 3, 4: 3, 5: 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', 'Green', 'Blue', 'Green'], [], ['Yellow', 'Red', 'Red', 'Blue'], [], [], ['Yellow', 'Yellow', 'Blue', 'Red']] | restricted_sorting | sorting | 1 | [[2, 3], [5, 3], [5, 3], [5, 4], [2, 1], [2, 1], [5, 1], [2, 4], [0, 2], [0, 2], [0, 4], [0, 2]] | 39 | 0.09036970138549805 | 12 | 30 | 12 | [[["Green", "Green", "Blue", "Green"], [], ["Yellow", "Red", "Red", "Blue"], [], [], ["Yellow", "Yellow", "Blue", "Red"]], 4, {"0": 6, "1": 5, "2": 2, "3": 3, "4": 3, "5": 6}] | [[["Green", "Green", "Blue", "Green"], [], ["Yellow", "Red", "Red", "Blue"], [], [], ["Yellow", "Yellow", "Blue", "Red"]], 4, {"0": 6, "1": 5, "2": 2, "3": 3, "4": 3, "5": 6}, 3] | ["[['Green', 'Green', 'Blue', 'Green'], [], ['Yellow', 'Red', 'Red', 'Blue'], [], [], ['Yellow', 'Yellow', 'Blue', 'Red']]", "{0: 6, 1: 5, 2: 2, 3: 3, 4: 3, 5: 6}", "4", "3"] |
16 | 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, 1) to his destination workshop at index (3, 9), 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 9. 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 16 1 13 17 7 14 x]
[x 10 x 12 x 13 x 8 19 4]
[9 13 x 13 x x 15 x x 16]
[3 8 x 16 12 x x x x 13]
[13 x 1 15 18 8 x 10 x x]
[8 1 2 14 x 8 x 4 x 11]
[14 13 15 x 16 x 13 2 x 19]
[x 4 10 x x 16 x 11 x x]
[x 14 x x x x x 18 6 18]
[x 3 2 6 7 x x 9 8 5] | traffic | pathfinding | 2 | [[5, 1], [6, 1], [5, 1], [5, 2], [4, 2], [4, 3], [3, 3], [2, 3], [1, 3], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [1, 7], [1, 8], [1, 9], [2, 9], [3, 9]] | 187 | 0.020601749420166016 | 19 | 4 | 4 | [[["x", "x", "x", "16", "1", "13", "17", "7", "14", "x"], ["x", "10", "x", "12", "x", "13", "x", "8", "19", "4"], ["9", "13", "x", "13", "x", "x", "15", "x", "x", "16"], ["3", "8", "x", "16", "12", "x", "x", "x", "x", "13"], ["13", "x", "1", "15", "18", "8", "x", "10", "x", "x"], ["8", "1", "2", "14", "x", "8", "x", "4", "x", "11"], ["14", "13", "15", "x", "16", "x", "13", "2", "x", "19"], ["x", "4", "10", "x", "x", "16", "x", "11", "x", "x"], ["x", "14", "x", "x", "x", "x", "x", "18", "6", "18"], ["x", "3", "2", "6", "7", "x", "x", "9", "8", "5"]]] | [[["x", "x", "x", "16", "1", "13", "17", "7", "14", "x"], ["x", "10", "x", "12", "x", "13", "x", "8", "19", "4"], ["9", "13", "x", "13", "x", "x", "15", "x", "x", "16"], ["3", "8", "x", "16", "12", "x", "x", "x", "x", "13"], ["13", "x", "1", "15", "18", "8", "x", "10", "x", "x"], ["8", "1", "2", "14", "x", "8", "x", "4", "x", "11"], ["14", "13", "15", "x", "16", "x", "13", "2", "x", "19"], ["x", "4", "10", "x", "x", "16", "x", "11", "x", "x"], ["x", "14", "x", "x", "x", "x", "x", "18", "6", "18"], ["x", "3", "2", "6", "7", "x", "x", "9", "8", "5"]], [5, 1], [3, 9], 3, 5] | ["[['x', 'x', 'x', '16', '1', '13', '17', '7', '14', 'x'], ['x', '10', 'x', '12', 'x', '13', 'x', '8', '19', '4'], ['9', '13', 'x', '13', 'x', 'x', '15', 'x', 'x', '16'], ['3', '8', 'x', '16', '12', 'x', 'x', 'x', 'x', '13'], ['13', 'x', '1', '15', '18', '8', 'x', '10', 'x', 'x'], ['8', '1', '2', '14', 'x', '8', 'x', '4', 'x', '11'], ['14', '13', '15', 'x', '16', 'x', '13', '2', 'x', '19'], ['x', '4', '10', 'x', 'x', '16', 'x', '11', 'x', 'x'], ['x', '14', 'x', 'x', 'x', 'x', 'x', '18', '6', '18'], ['x', '3', '2', '6', '7', 'x', 'x', '9', '8', '5']]", "(5, 1)", "(3, 9)", "3", "5"] |
16 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. 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, 1) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (6, 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 0 0 0 1 1 1 1 0 0
1 1 1 0 0 1 0 1 0 1
1 0 0 0 1 0 0 0 0 0
1 1 1 1 0 1 0 0 0 0
1 0 1 0 0 1 1 0 0 0
1 1 1 1 1 1 0 0 0 0
0 1 1 1 1 0 1 1 1 0
1 0 1 1 0 0 1 1 0 0
1 1 1 0 1 1 0 1 0 1
1 1 1 0 0 1 1 0 0 1 | trampoline_matrix | pathfinding | 10 | [[0, 1], [0, 2], [0, 3], [1, 3], [1, 4], [2, 5], [2, 6], [3, 6], [3, 7], [4, 7], [5, 8], [6, 9]] | 12 | 0.03220367431640625 | 12 | 8 | 2 | ["[[1, 0, 0, 0, 1, 1, 1, 1, 0, 0], [1, 1, 1, 0, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1, 1, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 0, 1], [1, 1, 1, 0, 0, 1, 1, 0, 0, 1]]", 3] | ["[[1, 0, 0, 0, 1, 1, 1, 1, 0, 0], [1, 1, 1, 0, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1, 1, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 0, 1], [1, 1, 1, 0, 0, 1, 1, 0, 0, 1]]", [0, 1], [6, 9], 3] | ["[[1, 0, 0, 0, 1, 1, 1, 1, 0, 0], [1, 1, 1, 0, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1, 1, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 0, 1], [1, 1, 1, 0, 0, 1, 1, 0, 0, 1]]", "(0, 1)", "(6, 9)", "3"] |
16 | Given 5 labeled water jugs with capacities 102, 130, 82, 131, 133, 116 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 265, 368, 378 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 | 4 | [["+", 116, 3], ["+", 131, 3], ["+", 131, 3], ["+", 102, 2], ["+", 133, 2], ["+", 133, 2], ["+", 130, 1], ["+", 133, 1], ["-", 131, 1], ["+", 133, 1]] | 10 | 0.033504486083984375 | 10 | 36 | 3 | [[102, 130, 82, 131, 133, 116], [265, 368, 378]] | [[102, 130, 82, 131, 133, 116], [265, 368, 378]] | ["[102, 130, 82, 131, 133, 116]", "[265, 368, 378]"] |
17 | 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: [[27, 18, 79], [22, 99, 9], [49, 53, '_']] | 8_puzzle | puzzle | 4 | [53, 49, 22, 99, 18, 27, 99, 18, 49, 22, 18, 49, 9, 53, 22, 9, 27, 79, 53, 22] | 20 | 0.027205705642700195 | 20 | 4 | 9 | [[[27, 18, 79], [22, 99, 9], [49, 53, "_"]]] | [[[27, 18, 79], [22, 99, 9], [49, 53, "_"]]] | ["[[27, 18, 79], [22, 99, 9], [49, 53, '_']]"] |
17 | 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: hay, werf, rudd, frib The initial board: [['e', 'h', 'r', 'y'], ['w', 'f', 'r', 'r'], ['_', 'u', 'd', 'd'], ['f', 'a', 'i', 'b']] | 8_puzzle_words | puzzle | 1 | ["down-right", "up-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-left", "up-left"] | 16 | 0.18766021728515625 | 16 | 4 | 16 | [[["e", "h", "r", "y"], ["w", "f", "r", "r"], ["_", "u", "d", "d"], ["f", "a", "i", "b"]]] | [[["e", "h", "r", "y"], ["w", "f", "r", "r"], ["_", "u", "d", "d"], ["f", "a", "i", "b"]], ["hay", "werf", "rudd", "frib"]] | ["[['e', 'h', 'r', 'y'], ['w', 'f', 'r', 'r'], ['_', 'u', 'd', 'd'], ['f', 'a', 'i', 'b']]", "['hay', 'werf', 'rudd', 'frib']"] |
17 | 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 'V'. Our task is to visit city Y and city I 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 I 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.
I V F E Y A Z T H Q
I 0 0 0 1 0 0 1 0 0 1
V 0 0 0 0 0 0 0 0 1 0
F 1 0 0 1 0 1 0 0 0 0
E 1 0 0 0 1 0 0 0 0 0
Y 1 0 1 0 0 0 1 0 0 1
A 1 1 0 0 0 0 0 0 0 0
Z 1 0 1 1 0 0 0 0 0 1
T 0 1 1 1 1 1 1 0 0 0
H 1 0 0 0 0 0 0 1 0 0
Q 0 0 0 0 0 0 1 1 1 0
| city_directed_graph | pathfinding | 10 | ["V", "H", "T", "Y", "I", "E", "Y", "I"] | 8 | 0.026442289352416992 | 8 | 10 | 13 | [[[0, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 1, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0]], ["I", "V", "F", "E", "Y", "A", "Z", "T", "H", "Q"], "Y", "I"] | [[[0, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 1, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0]], ["I", "V", "F", "E", "Y", "A", "Z", "T", "H", "Q"], "V", "Y", "I"] | ["[[0, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 1, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1, 0]]", "['I', 'V', 'F', 'E', 'Y', 'A', 'Z', 'T', 'H', 'Q']", "['V']", "['Y', 'I']"] |
17 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [4, 2, 18, 5, 18, 13, 22, 15, 5, 14, 15, 21, 23, 13, 19, 22, 6, 12, 19, 8, 15, 8, 12, 15, 11, 17, 7, 19, 23, 9, 3, 4, 12, 10, 11, 2, 22, 19, 19, 11, 18, 6, 10, 23, 20, 1, 6, 23, 8, 6], such that the sum of the chosen coins adds up to 233. 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 {21: 18, 1: 1, 13: 3, 20: 2, 19: 7, 5: 4, 18: 4, 4: 1, 15: 5, 12: 7, 17: 5, 22: 10, 8: 3, 7: 5, 23: 11, 9: 7, 10: 8, 3: 2, 14: 4, 6: 1, 2: 2, 11: 10}, 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 | [20, 18, 6, 4, 13, 6, 4, 13, 6, 19, 18, 19, 18, 8, 15, 14, 15, 17] | 61 | 0.06324076652526855 | 18 | 50 | 50 | [[4, 2, 18, 5, 18, 13, 22, 15, 5, 14, 15, 21, 23, 13, 19, 22, 6, 12, 19, 8, 15, 8, 12, 15, 11, 17, 7, 19, 23, 9, 3, 4, 12, 10, 11, 2, 22, 19, 19, 11, 18, 6, 10, 23, 20, 1, 6, 23, 8, 6]] | [[4, 2, 18, 5, 18, 13, 22, 15, 5, 14, 15, 21, 23, 13, 19, 22, 6, 12, 19, 8, 15, 8, 12, 15, 11, 17, 7, 19, 23, 9, 3, 4, 12, 10, 11, 2, 22, 19, 19, 11, 18, 6, 10, 23, 20, 1, 6, 23, 8, 6], {"21": 18, "1": 1, "13": 3, "20": 2, "19": 7, "5": 4, "18": 4, "4": 1, "15": 5, "12": 7, "17": 5, "22": 10, "8": 3, "7": 5, "23": 11, "9": 7, "10": 8, "3": 2, "14": 4, "6": 1, "2": 2, "11": 10}, 233] | ["[4, 2, 18, 5, 18, 13, 22, 15, 5, 14, 15, 21, 23, 13, 19, 22, 6, 12, 19, 8, 15, 8, 12, 15, 11, 17, 7, 19, 23, 9, 3, 4, 12, 10, 11, 2, 22, 19, 19, 11, 18, 6, 10, 23, 20, 1, 6, 23, 8, 6]", "{21: 18, 1: 1, 13: 3, 20: 2, 19: 7, 5: 4, 18: 4, 4: 1, 15: 5, 12: 7, 17: 5, 22: 10, 8: 3, 7: 5, 23: 11, 9: 7, 10: 8, 3: 2, 14: 4, 6: 1, 2: 2, 11: 10}", "233"] |
17 | 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 6 balls. It is not allowed to place a ball in a tube that already has 6 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', 'Red', 'Blue', 'Red'], ['Green', 'Red', 'Green', 'Green'], ['Blue', 'Green', 'Blue', 'Red']] | color_sorting | sorting | 7 | [[0, 2], [0, 1], [0, 2], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [1, 2], [1, 0], [1, 2], [0, 1], [0, 2], [0, 1], [2, 0]] | 17 | 0.8329384326934814 | 17 | 6 | 12 | [[["Blue", "Red", "Blue", "Red"], ["Green", "Red", "Green", "Green"], ["Blue", "Green", "Blue", "Red"]], 6] | [[["Blue", "Red", "Blue", "Red"], ["Green", "Red", "Green", "Green"], ["Blue", "Green", "Blue", "Red"]], 6] | ["[['Blue', 'Red', 'Blue', 'Red'], ['Green', 'Red', 'Green', 'Green'], ['Blue', 'Green', 'Blue', 'Red']]", "6"] |
17 | We have a 3x3 numerical grid, with numbers ranging from 38 to 76 (38 included in the range but 76 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' '42' '38']
['x' 'x' 'x']
['x' '63' 'x']] | consecutive_grid | underdetermined_system | 9 | [[0, 0, 43], [1, 0, 45], [1, 1, 44], [1, 2, 39], [2, 0, 64], [2, 2, 40]] | 367 | 0.9439022541046143 | 6 | 38 | 9 | ["[['', '42', '38'], ['', '', ''], ['', '63', '']]", 38, 76] | ["[['', '42', '38'], ['', '', ''], ['', '63', '']]", 38, 76] | ["[['', '42', '38'], ['', '', ''], ['', '63', '']]", "38", "76"] |
17 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 48 to 77. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 166, and sum of row 1 must be 192. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 184. 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' '52' 'x']
['x' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 6 | [[0, 0, 49], [0, 2, 51], [1, 0, 53], [1, 1, 66], [1, 2, 73], [2, 0, 67], [2, 1, 48], [2, 2, 50]] | 509 | 26.031718254089355 | 8 | 29 | 9 | ["[['', '52', ''], ['', '', ''], ['', '', '']]", 3, 48, 77] | ["[['', '52', ''], ['', '', ''], ['', '', '']]", 48, 77, [1, 2], [1, 2], [166], [192], 184] | ["[['', '52', ''], ['', '', ''], ['', '', '']]", "48", "77", "[None, 166, None]", "[None, 192, None]", "184"] |
17 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 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 3 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: 3, 3: 6, 4: 1, 5: 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? [['Blue', 'Red', 'Green', 'Yellow'], [], ['Red', 'Yellow', 'Yellow', 'Green'], [], ['Blue', 'Blue', 'Green', 'Red'], []] | restricted_sorting | sorting | 1 | [[0, 1], [0, 3], [0, 5], [2, 3], [4, 1], [4, 1], [2, 0], [2, 0], [4, 2], [5, 2], [3, 4], [3, 4]] | 39 | 0.03980541229248047 | 12 | 30 | 12 | [[["Blue", "Red", "Green", "Yellow"], [], ["Red", "Yellow", "Yellow", "Green"], [], ["Blue", "Blue", "Green", "Red"], []], 4, {"0": 2, "1": 3, "2": 3, "3": 6, "4": 1, "5": 6}] | [[["Blue", "Red", "Green", "Yellow"], [], ["Red", "Yellow", "Yellow", "Green"], [], ["Blue", "Blue", "Green", "Red"], []], 4, {"0": 2, "1": 3, "2": 3, "3": 6, "4": 1, "5": 6}, 3] | ["[['Blue', 'Red', 'Green', 'Yellow'], [], ['Red', 'Yellow', 'Yellow', 'Green'], [], ['Blue', 'Blue', 'Green', 'Red'], []]", "{0: 2, 1: 3, 2: 3, 3: 6, 4: 1, 5: 6}", "4", "3"] |
17 | 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, 9) 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 6, and district 3 covering rows 7 to 9. 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.
[16 2 16 x 4 x x 1 16 x]
[x x 19 x 3 x 5 x x x]
[x x x 3 x x 2 x 10 x]
[11 5 20 x 1 3 1 x 9 x]
[x x 8 19 x 16 9 x 16 15]
[x 3 5 10 x x x 4 1 x]
[9 18 10 17 5 6 x x x 5]
[x x 14 5 18 x x 1 15 1]
[13 x 13 13 14 2 19 12 x 1]
[9 6 x 4 12 1 13 8 2 13] | traffic | pathfinding | 2 | [[7, 9], [8, 9], [9, 9], [9, 8], [9, 7], [9, 6], [9, 5], [8, 5], [8, 4], [8, 3], [7, 3], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2]] | 129 | 0.028354406356811523 | 16 | 4 | 4 | [[["16", "2", "16", "x", "4", "x", "x", "1", "16", "x"], ["x", "x", "19", "x", "3", "x", "5", "x", "x", "x"], ["x", "x", "x", "3", "x", "x", "2", "x", "10", "x"], ["11", "5", "20", "x", "1", "3", "1", "x", "9", "x"], ["x", "x", "8", "19", "x", "16", "9", "x", "16", "15"], ["x", "3", "5", "10", "x", "x", "x", "4", "1", "x"], ["9", "18", "10", "17", "5", "6", "x", "x", "x", "5"], ["x", "x", "14", "5", "18", "x", "x", "1", "15", "1"], ["13", "x", "13", "13", "14", "2", "19", "12", "x", "1"], ["9", "6", "x", "4", "12", "1", "13", "8", "2", "13"]]] | [[["16", "2", "16", "x", "4", "x", "x", "1", "16", "x"], ["x", "x", "19", "x", "3", "x", "5", "x", "x", "x"], ["x", "x", "x", "3", "x", "x", "2", "x", "10", "x"], ["11", "5", "20", "x", "1", "3", "1", "x", "9", "x"], ["x", "x", "8", "19", "x", "16", "9", "x", "16", "15"], ["x", "3", "5", "10", "x", "x", "x", "4", "1", "x"], ["9", "18", "10", "17", "5", "6", "x", "x", "x", "5"], ["x", "x", "14", "5", "18", "x", "x", "1", "15", "1"], ["13", "x", "13", "13", "14", "2", "19", "12", "x", "1"], ["9", "6", "x", "4", "12", "1", "13", "8", "2", "13"]], [7, 9], [3, 2], 3, 6] | ["[['16', '2', '16', 'x', '4', 'x', 'x', '1', '16', 'x'], ['x', 'x', '19', 'x', '3', 'x', '5', 'x', 'x', 'x'], ['x', 'x', 'x', '3', 'x', 'x', '2', 'x', '10', 'x'], ['11', '5', '20', 'x', '1', '3', '1', 'x', '9', 'x'], ['x', 'x', '8', '19', 'x', '16', '9', 'x', '16', '15'], ['x', '3', '5', '10', 'x', 'x', 'x', '4', '1', 'x'], ['9', '18', '10', '17', '5', '6', 'x', 'x', 'x', '5'], ['x', 'x', '14', '5', '18', 'x', 'x', '1', '15', '1'], ['13', 'x', '13', '13', '14', '2', '19', '12', 'x', '1'], ['9', '6', 'x', '4', '12', '1', '13', '8', '2', '13']]", "(7, 9)", "(3, 2)", "3", "6"] |
17 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. 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, 4) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (9, 8). 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 1 0 0 1 0 0 1
1 0 0 0 0 0 0 0 1 1
1 1 0 0 0 0 0 0 1 1
0 1 0 1 1 1 1 0 1 1
0 0 1 0 1 1 1 0 0 0
1 1 0 1 1 0 1 0 0 0
1 0 1 0 0 0 1 0 0 0
0 0 0 0 0 1 1 0 0 0
0 1 0 0 1 1 1 1 0 0
1 0 0 0 1 1 1 1 0 0 | trampoline_matrix | pathfinding | 10 | [[0, 4], [1, 4], [2, 5], [2, 6], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7], [8, 8], [9, 8]] | 11 | 0.0298614501953125 | 11 | 8 | 2 | ["[[0, 1, 1, 1, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 0, 0, 0, 1, 1], [0, 1, 0, 1, 1, 1, 1, 0, 1, 1], [0, 0, 1, 0, 1, 1, 1, 0, 0, 0], [1, 1, 0, 1, 1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1, 1, 1, 0, 0]]", 3] | ["[[0, 1, 1, 1, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 0, 0, 0, 1, 1], [0, 1, 0, 1, 1, 1, 1, 0, 1, 1], [0, 0, 1, 0, 1, 1, 1, 0, 0, 0], [1, 1, 0, 1, 1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1, 1, 1, 0, 0]]", [0, 4], [9, 8], 3] | ["[[0, 1, 1, 1, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 0, 0, 0, 1, 1], [0, 1, 0, 1, 1, 1, 1, 0, 1, 1], [0, 0, 1, 0, 1, 1, 1, 0, 0, 0], [1, 1, 0, 1, 1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1, 1, 1, 0, 0]]", "(0, 4)", "(9, 8)", "3"] |
17 | Given 5 labeled water jugs with capacities 143, 117, 116, 103, 84, 87 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 398, 440, 440 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 | 4 | [["+", 103, 3], ["+", 117, 3], ["+", 117, 3], ["+", 103, 3], ["+", 103, 2], ["+", 117, 2], ["+", 117, 2], ["+", 103, 2], ["+", 84, 1], ["+", 87, 1], ["+", 143, 1], ["+", 84, 1]] | 12 | 0.03967571258544922 | 12 | 36 | 3 | [[143, 117, 116, 103, 84, 87], [398, 440, 440]] | [[143, 117, 116, 103, 84, 87], [398, 440, 440]] | ["[143, 117, 116, 103, 84, 87]", "[398, 440, 440]"] |
18 | 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: [[88, 52, 85], [98, 96, 83], [50, 80, '_']] | 8_puzzle | puzzle | 4 | [83, 96, 52, 88, 98, 52, 96, 85, 88, 96, 85, 83, 80, 50, 52, 85, 83, 80] | 18 | 0.027386188507080078 | 18 | 4 | 9 | [[[88, 52, 85], [98, 96, 83], [50, 80, "_"]]] | [[[88, 52, 85], [98, 96, 83], [50, 80, "_"]]] | ["[[88, 52, 85], [98, 96, 83], [50, 80, '_']]"] |
18 | 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: moi, good, boyd, peck The initial board: [['o', 'm', 'y', 'i'], ['g', 'd', 'o', 'e'], ['_', 'o', 'b', 'd'], ['p', 'o', 'c', 'k']] | 8_puzzle_words | puzzle | 1 | ["down-right", "up-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left"] | 12 | 0.20071721076965332 | 12 | 4 | 16 | [[["o", "m", "y", "i"], ["g", "d", "o", "e"], ["_", "o", "b", "d"], ["p", "o", "c", "k"]]] | [[["o", "m", "y", "i"], ["g", "d", "o", "e"], ["_", "o", "b", "d"], ["p", "o", "c", "k"]], ["moi", "good", "boyd", "peck"]] | ["[['o', 'm', 'y', 'i'], ['g', 'd', 'o', 'e'], ['_', 'o', 'b', 'd'], ['p', 'o', 'c', 'k']]", "['moi', 'good', 'boyd', 'peck']"] |
18 | 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 K and city Y 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 Y and K, 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.
G J Y Q C D R F K H N
G 0 0 0 0 0 0 1 0 0 1 0
J 1 0 1 1 0 0 0 0 1 0 0
Y 1 0 0 0 0 0 1 1 0 0 1
Q 0 0 0 0 0 0 0 1 0 1 0
C 1 1 0 0 0 0 0 0 1 0 0
D 1 0 1 1 0 0 0 1 0 0 0
R 0 1 1 1 0 1 0 0 0 1 0
F 0 0 0 0 0 1 1 0 0 0 0
K 1 0 0 0 0 0 1 1 0 1 1
H 0 1 1 1 1 0 0 0 0 0 0
N 0 1 1 0 1 1 0 1 0 0 0
| city_directed_graph | pathfinding | 11 | ["Q", "F", "D", "Y", "N", "C", "K", "H", "Y", "R", "J", "K"] | 12 | 0.049555063247680664 | 12 | 11 | 14 | [[[0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0]], ["G", "J", "Y", "Q", "C", "D", "R", "F", "K", "H", "N"], "K", "Y"] | [[[0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0]], ["G", "J", "Y", "Q", "C", "D", "R", "F", "K", "H", "N"], "Q", "K", "Y"] | ["[[0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0]]", "['G', 'J', 'Y', 'Q', 'C', 'D', 'R', 'F', 'K', 'H', 'N']", "['Q']", "['K', 'Y']"] |
18 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [10, 5, 6, 2, 16, 19, 18, 5, 11, 12, 11, 7, 13, 19, 11, 12, 8, 17, 5, 18, 3, 12, 10, 14, 20, 18, 10, 11, 20, 13, 8, 8, 2, 7, 17, 10, 7, 21, 9, 20, 17, 1, 8, 19, 17, 16, 17, 10, 20, 8, 16, 14, 9], such that the sum of the chosen coins adds up to 211. 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 {7: 2, 3: 2, 18: 1, 13: 3, 2: 2, 19: 17, 16: 6, 10: 1, 9: 9, 12: 7, 8: 7, 6: 3, 21: 18, 11: 10, 14: 13, 1: 1, 5: 5, 20: 18, 17: 14}, 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 | [18, 10, 13, 10, 13, 10, 6, 7, 7, 7, 19, 18, 16, 10, 19, 18, 10] | 63 | 0.049751996994018555 | 17 | 53 | 53 | [[10, 5, 6, 2, 16, 19, 18, 5, 11, 12, 11, 7, 13, 19, 11, 12, 8, 17, 5, 18, 3, 12, 10, 14, 20, 18, 10, 11, 20, 13, 8, 8, 2, 7, 17, 10, 7, 21, 9, 20, 17, 1, 8, 19, 17, 16, 17, 10, 20, 8, 16, 14, 9]] | [[10, 5, 6, 2, 16, 19, 18, 5, 11, 12, 11, 7, 13, 19, 11, 12, 8, 17, 5, 18, 3, 12, 10, 14, 20, 18, 10, 11, 20, 13, 8, 8, 2, 7, 17, 10, 7, 21, 9, 20, 17, 1, 8, 19, 17, 16, 17, 10, 20, 8, 16, 14, 9], {"7": 2, "3": 2, "18": 1, "13": 3, "2": 2, "19": 17, "16": 6, "10": 1, "9": 9, "12": 7, "8": 7, "6": 3, "21": 18, "11": 10, "14": 13, "1": 1, "5": 5, "20": 18, "17": 14}, 211] | ["[10, 5, 6, 2, 16, 19, 18, 5, 11, 12, 11, 7, 13, 19, 11, 12, 8, 17, 5, 18, 3, 12, 10, 14, 20, 18, 10, 11, 20, 13, 8, 8, 2, 7, 17, 10, 7, 21, 9, 20, 17, 1, 8, 19, 17, 16, 17, 10, 20, 8, 16, 14, 9]", "{7: 2, 3: 2, 18: 1, 13: 3, 2: 2, 19: 17, 16: 6, 10: 1, 9: 9, 12: 7, 8: 7, 6: 3, 21: 18, 11: 10, 14: 13, 1: 1, 5: 5, 20: 18, 17: 14}", "211"] |
18 | 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 6 balls. It is not allowed to place a ball in a tube that already has 6 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', 'Red', 'Blue'], ['Red', 'Red', 'Blue', 'Green'], ['Red', 'Green', 'Blue', 'Blue']] | color_sorting | sorting | 7 | [[2, 1], [0, 2], [0, 2], [0, 1], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [2, 0], [2, 1], [2, 1], [2, 1], [0, 2], [0, 2]] | 16 | 0.4702601432800293 | 16 | 6 | 12 | [[["Green", "Green", "Red", "Blue"], ["Red", "Red", "Blue", "Green"], ["Red", "Green", "Blue", "Blue"]], 6] | [[["Green", "Green", "Red", "Blue"], ["Red", "Red", "Blue", "Green"], ["Red", "Green", "Blue", "Blue"]], 6] | ["[['Green', 'Green', 'Red', 'Blue'], ['Red', 'Red', 'Blue', 'Green'], ['Red', 'Green', 'Blue', 'Blue']]", "6"] |
18 | We have a 3x3 numerical grid, with numbers ranging from 16 to 54 (16 included in the range but 54 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:
[['16' '17' 'x']
['x' 'x' 'x']
['x' '44' 'x']] | consecutive_grid | underdetermined_system | 9 | [[0, 2, 18], [1, 0, 22], [1, 1, 21], [1, 2, 19], [2, 0, 45], [2, 2, 20]] | 165 | 1.0585572719573975 | 6 | 38 | 9 | ["[['16', '17', ''], ['', '', ''], ['', '44', '']]", 16, 54] | ["[['16', '17', ''], ['', '', ''], ['', '44', '']]", 16, 54] | ["[['16', '17', ''], ['', '', ''], ['', '44', '']]", "16", "54"] |
18 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 48 to 77. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 191, and sum of row 1 must be 194. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 186. 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' 'x']
['x' 'x' 'x']
['x' '70' 'x']] | magic_square | underdetermined_system | 6 | [[0, 0, 49], [0, 1, 48], [0, 2, 51], [1, 0, 52], [1, 1, 73], [1, 2, 69], [2, 0, 62], [2, 2, 50]] | 524 | 7.050852060317993 | 8 | 29 | 9 | ["[['', '', ''], ['', '', ''], ['', '70', '']]", 3, 48, 77] | ["[['', '', ''], ['', '', ''], ['', '70', '']]", 48, 77, [1, 2], [1, 2], [191], [194], 186] | ["[['', '', ''], ['', '', ''], ['', '70', '']]", "48", "77", "[None, 191, None]", "[None, 194, None]", "186"] |
18 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 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 3 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: 6, 2: 2, 3: 7, 4: 7, 5: 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', 'Green', 'Yellow', 'Green'], ['Red', 'Yellow', 'Yellow', 'Green'], [], ['Red', 'Blue', 'Red', 'Blue']] | restricted_sorting | sorting | 1 | [[2, 1], [3, 0], [5, 0], [3, 4], [3, 4], [2, 3], [2, 4], [5, 1], [5, 0], [1, 5], [1, 5], [3, 2], [3, 2]] | 73 | 0.037363290786743164 | 13 | 30 | 12 | [[[], [], ["Blue", "Green", "Yellow", "Green"], ["Red", "Yellow", "Yellow", "Green"], [], ["Red", "Blue", "Red", "Blue"]], 4, {"0": 7, "1": 6, "2": 2, "3": 7, "4": 7, "5": 4}] | [[[], [], ["Blue", "Green", "Yellow", "Green"], ["Red", "Yellow", "Yellow", "Green"], [], ["Red", "Blue", "Red", "Blue"]], 4, {"0": 7, "1": 6, "2": 2, "3": 7, "4": 7, "5": 4}, 3] | ["[[], [], ['Blue', 'Green', 'Yellow', 'Green'], ['Red', 'Yellow', 'Yellow', 'Green'], [], ['Red', 'Blue', 'Red', 'Blue']]", "{0: 7, 1: 6, 2: 2, 3: 7, 4: 7, 5: 4}", "4", "3"] |
18 | 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 (1, 8) to his destination workshop at index (4, 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 9. 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.
[13 x x x x x 8 x x 6]
[x x x 8 10 x 17 x 15 14]
[x 6 x x x 16 12 7 8 11]
[x 15 x 1 11 19 9 17 x x]
[18 20 16 19 12 1 x x x 5]
[11 x 18 14 x 2 x 9 8 1]
[x 2 5 16 3 9 2 18 x x]
[x 8 15 17 16 6 x 3 x 10]
[3 x x x 8 9 10 x 6 x]
[6 x 9 16 1 3 16 18 x x] | traffic | pathfinding | 2 | [[1, 8], [2, 8], [2, 7], [2, 6], [3, 6], [3, 5], [4, 5], [5, 5], [4, 5], [4, 4], [4, 3], [4, 2], [4, 1]] | 126 | 0.026239633560180664 | 13 | 4 | 4 | [[["13", "x", "x", "x", "x", "x", "8", "x", "x", "6"], ["x", "x", "x", "8", "10", "x", "17", "x", "15", "14"], ["x", "6", "x", "x", "x", "16", "12", "7", "8", "11"], ["x", "15", "x", "1", "11", "19", "9", "17", "x", "x"], ["18", "20", "16", "19", "12", "1", "x", "x", "x", "5"], ["11", "x", "18", "14", "x", "2", "x", "9", "8", "1"], ["x", "2", "5", "16", "3", "9", "2", "18", "x", "x"], ["x", "8", "15", "17", "16", "6", "x", "3", "x", "10"], ["3", "x", "x", "x", "8", "9", "10", "x", "6", "x"], ["6", "x", "9", "16", "1", "3", "16", "18", "x", "x"]]] | [[["13", "x", "x", "x", "x", "x", "8", "x", "x", "6"], ["x", "x", "x", "8", "10", "x", "17", "x", "15", "14"], ["x", "6", "x", "x", "x", "16", "12", "7", "8", "11"], ["x", "15", "x", "1", "11", "19", "9", "17", "x", "x"], ["18", "20", "16", "19", "12", "1", "x", "x", "x", "5"], ["11", "x", "18", "14", "x", "2", "x", "9", "8", "1"], ["x", "2", "5", "16", "3", "9", "2", "18", "x", "x"], ["x", "8", "15", "17", "16", "6", "x", "3", "x", "10"], ["3", "x", "x", "x", "8", "9", "10", "x", "6", "x"], ["6", "x", "9", "16", "1", "3", "16", "18", "x", "x"]], [1, 8], [4, 1], 1, 4] | ["[['13', 'x', 'x', 'x', 'x', 'x', '8', 'x', 'x', '6'], ['x', 'x', 'x', '8', '10', 'x', '17', 'x', '15', '14'], ['x', '6', 'x', 'x', 'x', '16', '12', '7', '8', '11'], ['x', '15', 'x', '1', '11', '19', '9', '17', 'x', 'x'], ['18', '20', '16', '19', '12', '1', 'x', 'x', 'x', '5'], ['11', 'x', '18', '14', 'x', '2', 'x', '9', '8', '1'], ['x', '2', '5', '16', '3', '9', '2', '18', 'x', 'x'], ['x', '8', '15', '17', '16', '6', 'x', '3', 'x', '10'], ['3', 'x', 'x', 'x', '8', '9', '10', 'x', '6', 'x'], ['6', 'x', '9', '16', '1', '3', '16', '18', 'x', 'x']]", "(1, 8)", "(4, 1)", "1", "4"] |
18 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. 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, 2) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (1, 8). 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 1 1 0 0 0
0 0 1 1 0 0 1 1 0 0
0 0 1 0 0 1 1 1 1 0
0 0 1 0 0 0 0 0 0 0
1 0 0 1 1 0 1 1 0 0
1 0 1 0 0 1 0 1 0 0
0 1 0 1 0 0 1 0 0 0
0 1 1 0 0 0 0 0 0 0
1 1 0 0 0 0 0 1 1 0
1 1 1 1 1 1 1 1 0 1 | trampoline_matrix | pathfinding | 10 | [[8, 2], [7, 3], [6, 4], [5, 4], [4, 5], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [2, 9], [1, 9], [1, 8]] | 13 | 0.031194448471069336 | 13 | 8 | 2 | ["[[0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 1, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 1, 0, 1, 1, 0, 0], [1, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0, 1]]", 3] | ["[[0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 1, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 1, 0, 1, 1, 0, 0], [1, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0, 1]]", [8, 2], [1, 8], 3] | ["[[0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 1, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 1, 0, 1, 1, 0, 0], [1, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0, 1]]", "(8, 2)", "(1, 8)", "3"] |
18 | Given 5 labeled water jugs with capacities 71, 124, 95, 42, 56, 41 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 291, 292, 326 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 | 4 | [["+", 95, 3], ["+", 95, 3], ["+", 95, 3], ["+", 41, 3], ["+", 56, 2], ["+", 71, 2], ["+", 124, 2], ["+", 41, 2], ["+", 42, 1], ["+", 95, 1], ["+", 124, 1], ["-", 41, 1], ["+", 71, 1]] | 13 | 0.03421187400817871 | 13 | 36 | 3 | [[71, 124, 95, 42, 56, 41], [291, 292, 326]] | [[71, 124, 95, 42, 56, 41], [291, 292, 326]] | ["[71, 124, 95, 42, 56, 41]", "[291, 292, 326]"] |
19 | 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: [[89, 69, 35], [16, 14, 64], ['_', 23, 32]] | 8_puzzle | puzzle | 5 | [16, 89, 69, 35, 64, 32, 23, 14, 35, 69, 89, 35, 32, 23] | 14 | 0.030463218688964844 | 14 | 4 | 9 | [[[89, 69, 35], [16, 14, 64], ["_", 23, 32]]] | [[[89, 69, 35], [16, 14, 64], ["_", 23, 32]]] | ["[[89, 69, 35], [16, 14, 64], ['_', 23, 32]]"] |
19 | 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: aeon, plier, gazon, ileum The initial board: [['l', 'a', 'e', 'o', 'n'], ['p', 'z', 'i', 'n', 'r'], ['l', 'a', 'g', 'o', '_'], ['i', 'e', 'e', 'u', 'm']] | 8_puzzle_words | puzzle | 2 | ["up-left", "up-left", "down-left", "down-right", "down-left", "up-left", "up-right", "up-right", "down-right", "down-left", "up-left", "up-left"] | 12 | 0.19801783561706543 | 12 | 4 | 20 | [[["l", "a", "e", "o", "n"], ["p", "z", "i", "n", "r"], ["l", "a", "g", "o", "_"], ["i", "e", "e", "u", "m"]]] | [[["l", "a", "e", "o", "n"], ["p", "z", "i", "n", "r"], ["l", "a", "g", "o", "_"], ["i", "e", "e", "u", "m"]], ["aeon", "plier", "gazon", "ileum"]] | ["[['l', 'a', 'e', 'o', 'n'], ['p', 'z', 'i', 'n', 'r'], ['l', 'a', 'g', 'o', '_'], ['i', 'e', 'e', 'u', 'm']]", "['aeon', 'plier', 'gazon', 'ileum']"] |