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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 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: [[12, 55, '_'], [35, 97, 43], [17, 25, 9]] | 8_puzzle | puzzle | 2 | [55, 97, 35, 12, 97, 55, 43, 9, 25, 17, 12, 35, 9, 25, 17, 9, 25, 17] | 18 | 0.04202771186828613 | 18 | 4 | 9 | [[[12, 55, "_"], [35, 97, 43], [17, 25, 9]]] | [[[12, 55, "_"], [35, 97, 43], [17, 25, 9]]] | ["[[12, 55, '_'], [35, 97, 43], [17, 25, 9]]"] |
1 | 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: cam, hill, pray, doer The initial board: [['i', 'c', 'a', 'm'], ['h', 'p', 'l', 'o'], ['_', 'r', 'a', 'y'], ['d', 'l', 'e', 'r']] | 8_puzzle_words | puzzle | 1 | ["up-right", "down-right", "down-left", "up-left", "up-right", "down-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left"] | 16 | 0.21660590171813965 | 16 | 4 | 16 | [[["i", "c", "a", "m"], ["h", "p", "l", "o"], ["_", "r", "a", "y"], ["d", "l", "e", "r"]]] | [[["i", "c", "a", "m"], ["h", "p", "l", "o"], ["_", "r", "a", "y"], ["d", "l", "e", "r"]], ["cam", "hill", "pray", "doer"]] | ["[['i', 'c', 'a', 'm'], ['h', 'p', 'l', 'o'], ['_', 'r', 'a', 'y'], ['d', 'l', 'e', 'r']]", "['cam', 'hill', 'pray', 'doer']"] |
1 | 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 'W'. Our task is to visit city A and city H 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 H and A, 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 D X N Y W A P V H
G 0 0 0 0 0 0 0 0 0 1
D 0 0 0 0 0 0 0 1 0 0
X 1 0 0 0 1 1 0 0 0 0
N 0 0 0 0 0 1 1 0 0 1
Y 0 0 1 1 0 0 1 0 0 0
W 0 0 1 0 0 0 0 0 0 0
A 1 1 1 0 0 0 0 0 1 0
P 1 0 0 0 1 0 0 0 0 1
V 1 0 0 0 0 0 0 1 0 0
H 1 1 0 1 0 0 1 1 0 0
| city_directed_graph | pathfinding | 10 | ["W", "X", "G", "H", "A", "D", "P", "H", "A"] | 9 | 0.020942211151123047 | 9 | 10 | 13 | [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 1, 0, 0, 1, 1, 0, 0]], ["G", "D", "X", "N", "Y", "W", "A", "P", "V", "H"], "A", "H"] | [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 1, 0, 0, 1, 1, 0, 0]], ["G", "D", "X", "N", "Y", "W", "A", "P", "V", "H"], "W", "A", "H"] | ["[[0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 1, 0, 0, 1, 1, 0, 0]]", "['G', 'D', 'X', 'N', 'Y', 'W', 'A', 'P', 'V', 'H']", "['W']", "['A', 'H']"] |
1 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [14, 2, 5, 8, 65, 5, 16, 2, 5, 2, 12, 17, 16, 15, 20, 4, 19, 9, 10, 64, 2, 10, 14, 2, 17], such that the sum of the chosen coins adds up to 208. 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 {20: 13, 4: 2, 17: 16, 19: 8, 64: 4, 5: 3, 14: 10, 10: 9, 65: 11, 16: 2, 12: 7, 8: 5, 2: 2, 15: 14, 9: 8}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 15 | [64, 16, 4, 5, 5, 19, 65, 16, 12, 2] | 44 | 0.03430962562561035 | 10 | 25 | 25 | [[14, 2, 5, 8, 65, 5, 16, 2, 5, 2, 12, 17, 16, 15, 20, 4, 19, 9, 10, 64, 2, 10, 14, 2, 17]] | [[14, 2, 5, 8, 65, 5, 16, 2, 5, 2, 12, 17, 16, 15, 20, 4, 19, 9, 10, 64, 2, 10, 14, 2, 17], {"20": 13, "4": 2, "17": 16, "19": 8, "64": 4, "5": 3, "14": 10, "10": 9, "65": 11, "16": 2, "12": 7, "8": 5, "2": 2, "15": 14, "9": 8}, 208] | ["[14, 2, 5, 8, 65, 5, 16, 2, 5, 2, 12, 17, 16, 15, 20, 4, 19, 9, 10, 64, 2, 10, 14, 2, 17]", "{20: 13, 4: 2, 17: 16, 19: 8, 64: 4, 5: 3, 14: 10, 10: 9, 65: 11, 16: 2, 12: 7, 8: 5, 2: 2, 15: 14, 9: 8}", "208"] |
1 | 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', 'Green', 'Red'], ['Blue', 'Blue', 'Red', 'Green'], ['Red', 'Blue', 'Green', 'Blue']] | color_sorting | sorting | 7 | [[0, 1], [0, 2], [0, 1], [2, 0], [2, 0], [1, 0], [1, 0], [2, 1], [2, 0], [1, 2], [1, 2], [1, 2], [1, 2], [0, 1], [0, 1], [0, 1], [2, 0]] | 17 | 0.9051551818847656 | 17 | 6 | 12 | [[["Green", "Red", "Green", "Red"], ["Blue", "Blue", "Red", "Green"], ["Red", "Blue", "Green", "Blue"]], 6] | [[["Green", "Red", "Green", "Red"], ["Blue", "Blue", "Red", "Green"], ["Red", "Blue", "Green", "Blue"]], 6] | ["[['Green', 'Red', 'Green', 'Red'], ['Blue', 'Blue', 'Red', 'Green'], ['Red', 'Blue', 'Green', 'Blue']]", "6"] |
1 | We have a 3x3 numerical grid, with numbers ranging from 13 to 46 (13 included in the range but 46 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' 'x' '41']
['x' '30' 'x']
['x' '29' '30']] | consecutive_grid | underdetermined_system | 7 | [[0, 1, 31], [1, 0, 14], [1, 2, 32], [2, 0, 13]] | 267 | 0.23554539680480957 | 4 | 33 | 9 | ["[['16', '', '41'], ['', '30', ''], ['', '29', '30']]", 13, 46] | ["[['16', '', '41'], ['', '30', ''], ['', '29', '30']]", 13, 46] | ["[['16', '', '41'], ['', '30', ''], ['', '29', '30']]", "13", "46"] |
1 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 29 to 48. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 107, and sum of row 1 must be 103. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 124. 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:
[['35' 'x' '46']
['x' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 6 | [[0, 1, 31], [1, 0, 29], [1, 1, 44], [1, 2, 30], [2, 0, 34], [2, 1, 32], [2, 2, 33]] | 314 | 0.3927474021911621 | 7 | 19 | 9 | ["[['35', '', '46'], ['', '', ''], ['', '', '']]", 3, 29, 48] | ["[['35', '', '46'], ['', '', ''], ['', '', '']]", 29, 48, [1, 2], [1, 2], [107], [103], 124] | ["[['35', '', '46'], ['', '', ''], ['', '', '']]", "29", "48", "[None, 107, None]", "[None, 103, None]", "124"] |
1 | 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: 5, 1: 5, 2: 3, 3: 1, 4: 5, 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? [[], [], [], ['Blue', 'Yellow', 'Blue', 'Blue'], ['Red', 'Green', 'Yellow', 'Green'], ['Red', 'Red', 'Yellow', 'Green']] | restricted_sorting | sorting | 1 | [[4, 0], [5, 0], [5, 0], [3, 1], [3, 2], [5, 2], [4, 5], [4, 2], [1, 3], [4, 5]] | 32 | 0.06039690971374512 | 10 | 30 | 12 | [[[], [], [], ["Blue", "Yellow", "Blue", "Blue"], ["Red", "Green", "Yellow", "Green"], ["Red", "Red", "Yellow", "Green"]], 4, {"0": 5, "1": 5, "2": 3, "3": 1, "4": 5, "5": 1}] | [[[], [], [], ["Blue", "Yellow", "Blue", "Blue"], ["Red", "Green", "Yellow", "Green"], ["Red", "Red", "Yellow", "Green"]], 4, {"0": 5, "1": 5, "2": 3, "3": 1, "4": 5, "5": 1}, 3] | ["[[], [], [], ['Blue', 'Yellow', 'Blue', 'Blue'], ['Red', 'Green', 'Yellow', 'Green'], ['Red', 'Red', 'Yellow', 'Green']]", "{0: 5, 1: 5, 2: 3, 3: 1, 4: 5, 5: 1}", "4", "3"] |
1 | 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, 7) to his destination workshop at index (2, 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 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.
[13 x x 3 10 20 3 x 5]
[x x x x 20 16 x x 17]
[3 14 18 8 1 20 14 x 7]
[13 3 6 10 7 4 6 6 1]
[10 12 2 x 11 x 10 8 11]
[x x x 11 6 18 13 20 17]
[x x 16 x 4 17 7 10 15]
[x 7 16 6 19 4 7 x x]
[x 11 18 x x x 3 8 x] | traffic | pathfinding | 1 | [[5, 7], [4, 7], [3, 7], [3, 6], [3, 5], [3, 4], [3, 3], [3, 2], [3, 1], [2, 1]] | 64 | 0.030263185501098633 | 10 | 4 | 4 | [[["13", "x", "x", "3", "10", "20", "3", "x", "5"], ["x", "x", "x", "x", "20", "16", "x", "x", "17"], ["3", "14", "18", "8", "1", "20", "14", "x", "7"], ["13", "3", "6", "10", "7", "4", "6", "6", "1"], ["10", "12", "2", "x", "11", "x", "10", "8", "11"], ["x", "x", "x", "11", "6", "18", "13", "20", "17"], ["x", "x", "16", "x", "4", "17", "7", "10", "15"], ["x", "7", "16", "6", "19", "4", "7", "x", "x"], ["x", "11", "18", "x", "x", "x", "3", "8", "x"]]] | [[["13", "x", "x", "3", "10", "20", "3", "x", "5"], ["x", "x", "x", "x", "20", "16", "x", "x", "17"], ["3", "14", "18", "8", "1", "20", "14", "x", "7"], ["13", "3", "6", "10", "7", "4", "6", "6", "1"], ["10", "12", "2", "x", "11", "x", "10", "8", "11"], ["x", "x", "x", "11", "6", "18", "13", "20", "17"], ["x", "x", "16", "x", "4", "17", "7", "10", "15"], ["x", "7", "16", "6", "19", "4", "7", "x", "x"], ["x", "11", "18", "x", "x", "x", "3", "8", "x"]], [5, 7], [2, 1], 2, 4] | ["[['13', 'x', 'x', '3', '10', '20', '3', 'x', '5'], ['x', 'x', 'x', 'x', '20', '16', 'x', 'x', '17'], ['3', '14', '18', '8', '1', '20', '14', 'x', '7'], ['13', '3', '6', '10', '7', '4', '6', '6', '1'], ['10', '12', '2', 'x', '11', 'x', '10', '8', '11'], ['x', 'x', 'x', '11', '6', '18', '13', '20', '17'], ['x', 'x', '16', 'x', '4', '17', '7', '10', '15'], ['x', '7', '16', '6', '19', '4', '7', 'x', 'x'], ['x', '11', '18', 'x', 'x', 'x', '3', '8', 'x']]", "(5, 7)", "(2, 1)", "2", "4"] |
1 | 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, 0) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (2, 7). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
0 1 0 1 0 1 1 1 1
0 0 1 1 0 0 0 0 1
0 0 0 1 1 1 0 0 1
0 0 0 0 0 0 0 1 0
0 0 0 0 0 1 1 1 1
0 0 1 1 1 1 0 1 1
0 0 0 1 1 1 1 1 0
1 0 1 1 1 1 1 0 1
0 1 1 1 1 1 0 1 0 | trampoline_matrix | pathfinding | 9 | [[8, 0], [7, 1], [6, 1], [5, 1], [4, 1], [4, 2], [4, 3], [4, 4], [3, 5], [3, 6], [2, 7]] | 11 | 0.03385114669799805 | 11 | 8 | 2 | ["[[0, 1, 0, 1, 0, 1, 1, 1, 1], [0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1, 0, 1, 1], [0, 0, 0, 1, 1, 1, 1, 1, 0], [1, 0, 1, 1, 1, 1, 1, 0, 1], [0, 1, 1, 1, 1, 1, 0, 1, 0]]", 3] | ["[[0, 1, 0, 1, 0, 1, 1, 1, 1], [0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1, 0, 1, 1], [0, 0, 0, 1, 1, 1, 1, 1, 0], [1, 0, 1, 1, 1, 1, 1, 0, 1], [0, 1, 1, 1, 1, 1, 0, 1, 0]]", [8, 0], [2, 7], 3] | ["[[0, 1, 0, 1, 0, 1, 1, 1, 1], [0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1, 0, 1, 1], [0, 0, 0, 1, 1, 1, 1, 1, 0], [1, 0, 1, 1, 1, 1, 1, 0, 1], [0, 1, 1, 1, 1, 1, 0, 1, 0]]", "(8, 0)", "(2, 7)", "3"] |
1 | Given 5 labeled water jugs with capacities 41, 26, 44, 75, 40, 136 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 274, 297, 343 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 | [["+", 40, 3], ["+", 75, 3], ["+", 136, 3], ["-", 44, 3], ["+", 136, 3], ["+", 26, 2], ["+", 40, 2], ["+", 136, 2], ["-", 41, 2], ["+", 136, 2], ["+", 40, 1], ["+", 40, 1], ["+", 44, 1], ["+", 75, 1], ["+", 75, 1]] | 15 | 0.05471658706665039 | 15 | 36 | 3 | [[41, 26, 44, 75, 40, 136], [274, 297, 343]] | [[41, 26, 44, 75, 40, 136], [274, 297, 343]] | ["[41, 26, 44, 75, 40, 136]", "[274, 297, 343]"] |
2 | 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: [[99, 69, 19], [53, '_', 30], [100, 63, 40]] | 8_puzzle | puzzle | 2 | [53, 100, 63, 40, 30, 19, 69, 53, 40, 30, 19, 40, 53, 99, 100, 63, 30, 19] | 18 | 0.03798794746398926 | 18 | 4 | 9 | [[[99, 69, 19], [53, "_", 30], [100, 63, 40]]] | [[[99, 69, 19], [53, "_", 30], [100, 63, 40]]] | ["[[99, 69, 19], [53, '_', 30], [100, 63, 40]]"] |
2 | 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: ako, pole, raff, mudd The initial board: [['o', 'a', 'u', 'o'], ['p', 'r', 'l', 'e'], ['f', 'a', '_', 'f'], ['m', 'k', 'd', 'd']] | 8_puzzle_words | puzzle | 1 | ["up-left", "down-left", "down-right", "up-right", "up-left", "up-right", "down-right", "down-left", "up-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left"] | 16 | 0.23615717887878418 | 16 | 4 | 16 | [[["o", "a", "u", "o"], ["p", "r", "l", "e"], ["f", "a", "_", "f"], ["m", "k", "d", "d"]]] | [[["o", "a", "u", "o"], ["p", "r", "l", "e"], ["f", "a", "_", "f"], ["m", "k", "d", "d"]], ["ako", "pole", "raff", "mudd"]] | ["[['o', 'a', 'u', 'o'], ['p', 'r', 'l', 'e'], ['f', 'a', '_', 'f'], ['m', 'k', 'd', 'd']]", "['ako', 'pole', 'raff', 'mudd']"] |
2 | 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 'D'. Our task is to visit city K and city Q 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 Q 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.
S U X D I Z R M K Q
S 0 0 0 0 1 0 0 0 0 1
U 0 0 1 0 0 0 0 0 0 0
X 0 0 0 0 0 0 1 0 1 0
D 0 1 0 0 0 1 0 0 0 0
I 0 1 0 0 0 0 0 0 0 1
Z 0 0 0 0 1 0 0 0 1 0
R 1 1 0 0 0 0 0 0 0 0
M 0 0 1 0 1 0 0 0 0 0
K 0 0 0 0 0 0 1 1 0 0
Q 0 1 0 1 1 1 0 0 1 0
| city_directed_graph | pathfinding | 10 | ["D", "Z", "I", "Q", "K", "R", "S", "Q", "K"] | 9 | 0.027526378631591797 | 9 | 10 | 13 | [[[0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 1, 1, 1, 0, 0, 1, 0]], ["S", "U", "X", "D", "I", "Z", "R", "M", "K", "Q"], "K", "Q"] | [[[0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 1, 1, 1, 0, 0, 1, 0]], ["S", "U", "X", "D", "I", "Z", "R", "M", "K", "Q"], "D", "K", "Q"] | ["[[0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 1, 1, 1, 0, 0, 1, 0]]", "['S', 'U', 'X', 'D', 'I', 'Z', 'R', 'M', 'K', 'Q']", "['D']", "['K', 'Q']"] |
2 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [13, 10, 12, 10, 16, 7, 9, 14, 13, 18, 36, 11, 7, 14, 7, 8, 19, 7, 39, 13, 3, 18, 20, 4, 3, 18, 15, 2, 19, 16], such that the sum of the chosen coins adds up to 203. 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 {15: 5, 36: 15, 39: 9, 9: 8, 13: 3, 2: 2, 18: 10, 12: 12, 3: 3, 8: 8, 11: 6, 10: 4, 4: 4, 14: 10, 7: 3, 16: 16, 20: 18, 19: 17}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 16 | [7, 7, 7, 13, 13, 39, 36, 10, 15, 10, 11, 13, 2, 7, 4, 9] | 78 | 0.03766942024230957 | 16 | 30 | 30 | [[13, 10, 12, 10, 16, 7, 9, 14, 13, 18, 36, 11, 7, 14, 7, 8, 19, 7, 39, 13, 3, 18, 20, 4, 3, 18, 15, 2, 19, 16]] | [[13, 10, 12, 10, 16, 7, 9, 14, 13, 18, 36, 11, 7, 14, 7, 8, 19, 7, 39, 13, 3, 18, 20, 4, 3, 18, 15, 2, 19, 16], {"15": 5, "36": 15, "39": 9, "9": 8, "13": 3, "2": 2, "18": 10, "12": 12, "3": 3, "8": 8, "11": 6, "10": 4, "4": 4, "14": 10, "7": 3, "16": 16, "20": 18, "19": 17}, 203] | ["[13, 10, 12, 10, 16, 7, 9, 14, 13, 18, 36, 11, 7, 14, 7, 8, 19, 7, 39, 13, 3, 18, 20, 4, 3, 18, 15, 2, 19, 16]", "{15: 5, 36: 15, 39: 9, 9: 8, 13: 3, 2: 2, 18: 10, 12: 12, 3: 3, 8: 8, 11: 6, 10: 4, 4: 4, 14: 10, 7: 3, 16: 16, 20: 18, 19: 17}", "203"] |
2 | 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', 'Blue', 'Blue', 'Blue'], ['Green', 'Green', 'Red', 'Green'], ['Green', 'Blue', 'Red', 'Red']] | color_sorting | sorting | 7 | [[1, 2], [1, 2], [1, 0], [2, 1], [2, 1], [2, 1], [2, 1], [0, 2], [0, 2], [1, 0]] | 10 | 0.05974388122558594 | 10 | 6 | 12 | [[["Red", "Blue", "Blue", "Blue"], ["Green", "Green", "Red", "Green"], ["Green", "Blue", "Red", "Red"]], 6] | [[["Red", "Blue", "Blue", "Blue"], ["Green", "Green", "Red", "Green"], ["Green", "Blue", "Red", "Red"]], 6] | ["[['Red', 'Blue', 'Blue', 'Blue'], ['Green', 'Green', 'Red', 'Green'], ['Green', 'Blue', 'Red', 'Red']]", "6"] |
2 | We have a 3x3 numerical grid, with numbers ranging from 8 to 41 (8 included in the range but 41 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:
[['10' '15' '39']
['x' '27' '29']
['x' 'x' 'x']] | consecutive_grid | underdetermined_system | 7 | [[1, 0, 11], [2, 0, 30], [2, 1, 28], [2, 2, 8]] | 185 | 0.6896023750305176 | 4 | 33 | 9 | ["[['10', '15', '39'], ['', '27', '29'], ['', '', '']]", 8, 41] | ["[['10', '15', '39'], ['', '27', '29'], ['', '', '']]", 8, 41] | ["[['10', '15', '39'], ['', '27', '29'], ['', '', '']]", "8", "41"] |
2 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 20 to 39. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 82, and sum of row 1 must be 87. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 94. 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']
['30' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 6 | [[0, 0, 20], [0, 1, 22], [0, 2, 25], [1, 1, 36], [1, 2, 21], [2, 0, 33], [2, 1, 24], [2, 2, 23]] | 234 | 3.1459109783172607 | 8 | 19 | 9 | ["[['', '', ''], ['30', '', ''], ['', '', '']]", 3, 20, 39] | ["[['', '', ''], ['30', '', ''], ['', '', '']]", 20, 39, [1, 2], [1, 2], [82], [87], 94] | ["[['', '', ''], ['30', '', ''], ['', '', '']]", "20", "39", "[None, 82, None]", "[None, 87, None]", "94"] |
2 | 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: 5, 1: 3, 2: 3, 3: 1, 4: 3, 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', 'Red', 'Blue'], ['Red', 'Yellow', 'Yellow', 'Green'], [], ['Blue', 'Yellow', 'Green', 'Blue'], [], []] | restricted_sorting | sorting | 1 | [[1, 2], [0, 2], [1, 5], [1, 5], [0, 1], [0, 2], [3, 4], [3, 5], [3, 1], [0, 3], [4, 3]] | 26 | 0.10936236381530762 | 11 | 30 | 12 | [[["Red", "Green", "Red", "Blue"], ["Red", "Yellow", "Yellow", "Green"], [], ["Blue", "Yellow", "Green", "Blue"], [], []], 4, {"0": 5, "1": 3, "2": 3, "3": 1, "4": 3, "5": 2}] | [[["Red", "Green", "Red", "Blue"], ["Red", "Yellow", "Yellow", "Green"], [], ["Blue", "Yellow", "Green", "Blue"], [], []], 4, {"0": 5, "1": 3, "2": 3, "3": 1, "4": 3, "5": 2}, 3] | ["[['Red', 'Green', 'Red', 'Blue'], ['Red', 'Yellow', 'Yellow', 'Green'], [], ['Blue', 'Yellow', 'Green', 'Blue'], [], []]", "{0: 5, 1: 3, 2: 3, 3: 1, 4: 3, 5: 2}", "4", "3"] |
2 | 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 (2, 2) 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 1, district 2 covering rows 2 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 13 9 x x 16 6 18 7]
[x 3 11 x x 5 7 x 19]
[8 x 2 5 6 12 9 10 7]
[12 1 6 20 19 18 12 x 14]
[16 5 10 3 x x x 1 9]
[x 3 x x x x x x 4]
[7 10 x 1 x x 17 x 8]
[x 5 x x x 17 x 9 x]
[13 16 8 15 x 2 x 1 2] | traffic | pathfinding | 1 | [[2, 2], [2, 3], [2, 4], [2, 5], [1, 5], [1, 6], [2, 6], [2, 7], [2, 8], [3, 8], [4, 8], [5, 8]] | 88 | 0.027752399444580078 | 12 | 4 | 4 | [[["x", "13", "9", "x", "x", "16", "6", "18", "7"], ["x", "3", "11", "x", "x", "5", "7", "x", "19"], ["8", "x", "2", "5", "6", "12", "9", "10", "7"], ["12", "1", "6", "20", "19", "18", "12", "x", "14"], ["16", "5", "10", "3", "x", "x", "x", "1", "9"], ["x", "3", "x", "x", "x", "x", "x", "x", "4"], ["7", "10", "x", "1", "x", "x", "17", "x", "8"], ["x", "5", "x", "x", "x", "17", "x", "9", "x"], ["13", "16", "8", "15", "x", "2", "x", "1", "2"]]] | [[["x", "13", "9", "x", "x", "16", "6", "18", "7"], ["x", "3", "11", "x", "x", "5", "7", "x", "19"], ["8", "x", "2", "5", "6", "12", "9", "10", "7"], ["12", "1", "6", "20", "19", "18", "12", "x", "14"], ["16", "5", "10", "3", "x", "x", "x", "1", "9"], ["x", "3", "x", "x", "x", "x", "x", "x", "4"], ["7", "10", "x", "1", "x", "x", "17", "x", "8"], ["x", "5", "x", "x", "x", "17", "x", "9", "x"], ["13", "16", "8", "15", "x", "2", "x", "1", "2"]], [2, 2], [5, 8], 1, 4] | ["[['x', '13', '9', 'x', 'x', '16', '6', '18', '7'], ['x', '3', '11', 'x', 'x', '5', '7', 'x', '19'], ['8', 'x', '2', '5', '6', '12', '9', '10', '7'], ['12', '1', '6', '20', '19', '18', '12', 'x', '14'], ['16', '5', '10', '3', 'x', 'x', 'x', '1', '9'], ['x', '3', 'x', 'x', 'x', 'x', 'x', 'x', '4'], ['7', '10', 'x', '1', 'x', 'x', '17', 'x', '8'], ['x', '5', 'x', 'x', 'x', '17', 'x', '9', 'x'], ['13', '16', '8', '15', 'x', '2', 'x', '1', '2']]", "(2, 2)", "(5, 8)", "1", "4"] |
2 | 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, 4) (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 0 1 0 0 1 1 1
1 1 1 0 1 0 1 1 1
0 1 0 1 1 0 0 0 0
1 1 1 0 1 1 0 1 0
0 1 0 1 1 0 0 1 1
0 0 0 0 0 0 1 0 1
0 1 0 1 1 0 1 0 0
1 0 0 1 1 0 0 1 0
0 0 0 0 0 0 0 1 0 | trampoline_matrix | pathfinding | 9 | [[0, 4], [0, 5], [1, 5], [2, 5], [2, 6], [3, 6], [4, 5], [5, 4], [5, 3], [5, 2], [6, 2], [7, 1], [8, 1], [8, 0]] | 14 | 0.03374505043029785 | 14 | 8 | 2 | ["[[1, 1, 0, 1, 0, 0, 1, 1, 1], [1, 1, 1, 0, 1, 0, 1, 1, 1], [0, 1, 0, 1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 1, 0, 1, 0, 0], [1, 0, 0, 1, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0]]", 3] | ["[[1, 1, 0, 1, 0, 0, 1, 1, 1], [1, 1, 1, 0, 1, 0, 1, 1, 1], [0, 1, 0, 1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 1, 0, 1, 0, 0], [1, 0, 0, 1, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0]]", [0, 4], [8, 0], 3] | ["[[1, 1, 0, 1, 0, 0, 1, 1, 1], [1, 1, 1, 0, 1, 0, 1, 1, 1], [0, 1, 0, 1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 1, 0, 1, 0, 0], [1, 0, 0, 1, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0]]", "(0, 4)", "(8, 0)", "3"] |
2 | Given 5 labeled water jugs with capacities 31, 102, 53, 33, 32, 24 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 188, 198, 289 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 | [["+", 32, 3], ["+", 102, 3], ["+", 102, 3], ["+", 53, 3], ["+", 31, 2], ["+", 32, 2], ["+", 33, 2], ["+", 102, 2], ["+", 33, 1], ["+", 53, 1], ["+", 102, 1]] | 11 | 0.04619026184082031 | 11 | 36 | 3 | [[31, 102, 53, 33, 32, 24], [188, 198, 289]] | [[31, 102, 53, 33, 32, 24], [188, 198, 289]] | ["[31, 102, 53, 33, 32, 24]", "[188, 198, 289]"] |
3 | 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: [[87, 50, 82], [68, '_', 74], [23, 61, 11]] | 8_puzzle | puzzle | 2 | [50, 82, 74, 50, 61, 11] | 6 | 0.028201580047607422 | 6 | 4 | 9 | [[[87, 50, 82], [68, "_", 74], [23, 61, 11]]] | [[[87, 50, 82], [68, "_", 74], [23, 61, 11]]] | ["[[87, 50, 82], [68, '_', 74], [23, 61, 11]]"] |
3 | 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: twi, ovey, udic, diem The initial board: [['v', 't', 'u', 'i'], ['o', 'w', 'e', 'i'], ['y', 'd', '_', 'c'], ['d', 'i', 'e', 'm']] | 8_puzzle_words | puzzle | 1 | ["up-left", "up-right", "down-right", "down-left", "up-left", "down-left", "down-right", "up-right", "up-left", "up-right", "down-right", "down-left", "up-left", "down-left", "down-right", "up-right", "up-left", "up-left"] | 18 | 0.22588300704956055 | 18 | 4 | 16 | [[["v", "t", "u", "i"], ["o", "w", "e", "i"], ["y", "d", "_", "c"], ["d", "i", "e", "m"]]] | [[["v", "t", "u", "i"], ["o", "w", "e", "i"], ["y", "d", "_", "c"], ["d", "i", "e", "m"]], ["twi", "ovey", "udic", "diem"]] | ["[['v', 't', 'u', 'i'], ['o', 'w', 'e', 'i'], ['y', 'd', '_', 'c'], ['d', 'i', 'e', 'm']]", "['twi', 'ovey', 'udic', 'diem']"] |
3 | 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 'M'. Our task is to visit city A and city R 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 R and A, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
O T I F A M X Y R G
O 0 0 0 0 1 0 0 0 0 0
T 1 0 1 0 0 0 0 0 0 0
I 0 0 0 0 1 1 0 0 1 1
F 0 0 1 0 0 0 0 0 0 1
A 1 1 0 0 0 0 1 0 0 0
M 0 0 0 1 0 0 0 0 0 1
X 0 0 1 1 1 0 0 1 0 0
Y 1 1 0 0 0 0 1 0 1 1
R 1 1 0 1 0 0 0 1 0 0
G 0 0 0 1 1 0 0 0 1 0
| city_directed_graph | pathfinding | 10 | ["M", "G", "R", "Y", "R", "O", "A", "X", "A"] | 9 | 0.0287935733795166 | 9 | 10 | 13 | [[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 1, 1], [1, 1, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 1, 0]], ["O", "T", "I", "F", "A", "M", "X", "Y", "R", "G"], "A", "R"] | [[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 1, 1], [1, 1, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 1, 0]], ["O", "T", "I", "F", "A", "M", "X", "Y", "R", "G"], "M", "A", "R"] | ["[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 1, 1], [1, 1, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 1, 0]]", "['O', 'T', 'I', 'F', 'A', 'M', 'X', 'Y', 'R', 'G']", "['M']", "['A', 'R']"] |
3 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [13, 19, 9, 4, 18, 17, 2, 14, 17, 17, 8, 6, 4, 10, 19, 37, 20, 19, 14, 7, 6, 11, 21, 9, 3, 10, 21, 20, 2, 17, 2], such that the sum of the chosen coins adds up to 215. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {14: 2, 18: 9, 11: 10, 9: 6, 10: 9, 13: 10, 37: 9, 6: 5, 2: 2, 4: 1, 8: 3, 19: 10, 17: 7, 7: 6, 3: 3, 21: 3, 20: 4}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 17 | [14, 21, 20, 4, 37, 4, 21, 20, 18, 8, 17, 14, 17] | 55 | 0.0338587760925293 | 13 | 31 | 31 | [[13, 19, 9, 4, 18, 17, 2, 14, 17, 17, 8, 6, 4, 10, 19, 37, 20, 19, 14, 7, 6, 11, 21, 9, 3, 10, 21, 20, 2, 17, 2]] | [[13, 19, 9, 4, 18, 17, 2, 14, 17, 17, 8, 6, 4, 10, 19, 37, 20, 19, 14, 7, 6, 11, 21, 9, 3, 10, 21, 20, 2, 17, 2], {"14": 2, "18": 9, "11": 10, "9": 6, "10": 9, "13": 10, "37": 9, "6": 5, "2": 2, "4": 1, "8": 3, "19": 10, "17": 7, "7": 6, "3": 3, "21": 3, "20": 4}, 215] | ["[13, 19, 9, 4, 18, 17, 2, 14, 17, 17, 8, 6, 4, 10, 19, 37, 20, 19, 14, 7, 6, 11, 21, 9, 3, 10, 21, 20, 2, 17, 2]", "{14: 2, 18: 9, 11: 10, 9: 6, 10: 9, 13: 10, 37: 9, 6: 5, 2: 2, 4: 1, 8: 3, 19: 10, 17: 7, 7: 6, 3: 3, 21: 3, 20: 4}", "215"] |
3 | 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', 'Blue', 'Blue', 'Red'], ['Red', 'Blue', 'Blue', 'Green'], ['Green', 'Green', 'Red', 'Green']] | color_sorting | sorting | 7 | [[0, 1], [2, 0], [2, 0], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [1, 2], [1, 0], [2, 1], [2, 1], [2, 1], [0, 2], [0, 1]] | 19 | 2.109553337097168 | 19 | 6 | 12 | [[["Red", "Blue", "Blue", "Red"], ["Red", "Blue", "Blue", "Green"], ["Green", "Green", "Red", "Green"]], 6] | [[["Red", "Blue", "Blue", "Red"], ["Red", "Blue", "Blue", "Green"], ["Green", "Green", "Red", "Green"]], 6] | ["[['Red', 'Blue', 'Blue', 'Red'], ['Red', 'Blue', 'Blue', 'Green'], ['Green', 'Green', 'Red', 'Green']]", "6"] |
3 | We have a 3x3 numerical grid, with numbers ranging from 20 to 53 (20 included in the range but 53 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:
[['22' 'x' '48']
['27' 'x' 'x']
['x' '42' '52']] | consecutive_grid | underdetermined_system | 7 | [[0, 1, 23], [1, 1, 28], [1, 2, 49], [2, 0, 29]] | 344 | 0.18951058387756348 | 4 | 33 | 9 | ["[['22', '', '48'], ['27', '', ''], ['', '42', '52']]", 20, 53] | ["[['22', '', '48'], ['27', '', ''], ['', '42', '52']]", 20, 53] | ["[['22', '', '48'], ['27', '', ''], ['', '42', '52']]", "20", "53"] |
3 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 20 to 39. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 99, and sum of row 1 must be 86. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 76. 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:
[['25' 'x' 'x']
['x' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 6 | [[0, 1, 26], [0, 2, 20], [1, 0, 23], [1, 1, 35], [1, 2, 28], [2, 0, 21], [2, 1, 38], [2, 2, 22]] | 238 | 6.525880575180054 | 8 | 19 | 9 | ["[['25', '', ''], ['', '', ''], ['', '', '']]", 3, 20, 39] | ["[['25', '', ''], ['', '', ''], ['', '', '']]", 20, 39, [1, 2], [1, 2], [99], [86], 76] | ["[['25', '', ''], ['', '', ''], ['', '', '']]", "20", "39", "[None, 99, None]", "[None, 86, None]", "76"] |
3 | 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: 6, 4: 1, 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? [[], ['Yellow', 'Green', 'Red', 'Red'], ['Blue', 'Green', 'Red', 'Green'], ['Yellow', 'Blue', 'Yellow', 'Blue'], [], []] | restricted_sorting | sorting | 1 | [[1, 0], [1, 4], [2, 5], [2, 4], [2, 1], [3, 0], [3, 5], [3, 0], [2, 4], [3, 5]] | 21 | 0.11831974983215332 | 10 | 30 | 12 | [[[], ["Yellow", "Green", "Red", "Red"], ["Blue", "Green", "Red", "Green"], ["Yellow", "Blue", "Yellow", "Blue"], [], []], 4, {"0": 3, "1": 6, "2": 5, "3": 6, "4": 1, "5": 1}] | [[[], ["Yellow", "Green", "Red", "Red"], ["Blue", "Green", "Red", "Green"], ["Yellow", "Blue", "Yellow", "Blue"], [], []], 4, {"0": 3, "1": 6, "2": 5, "3": 6, "4": 1, "5": 1}, 3] | ["[[], ['Yellow', 'Green', 'Red', 'Red'], ['Blue', 'Green', 'Red', 'Green'], ['Yellow', 'Blue', 'Yellow', 'Blue'], [], []]", "{0: 3, 1: 6, 2: 5, 3: 6, 4: 1, 5: 1}", "4", "3"] |
3 | 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, 7) to his destination workshop at index (1, 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 1, district 2 covering rows 2 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.
[10 14 4 16 x 17 5 x x]
[5 20 16 3 1 8 x 16 19]
[1 x 5 13 3 15 19 15 x]
[x 16 13 20 x 8 x x x]
[x 16 x 17 11 1 x 15 x]
[10 x 14 11 5 7 12 x 5]
[7 x 15 x 15 8 3 6 7]
[x 12 14 x x x 16 3 13]
[19 5 10 x x x 9 7 14] | traffic | pathfinding | 1 | [[7, 7], [6, 7], [6, 6], [6, 5], [5, 5], [4, 5], [3, 5], [2, 5], [2, 4], [1, 4], [1, 3], [1, 2]] | 71 | 0.02632451057434082 | 12 | 4 | 4 | [[["10", "14", "4", "16", "x", "17", "5", "x", "x"], ["5", "20", "16", "3", "1", "8", "x", "16", "19"], ["1", "x", "5", "13", "3", "15", "19", "15", "x"], ["x", "16", "13", "20", "x", "8", "x", "x", "x"], ["x", "16", "x", "17", "11", "1", "x", "15", "x"], ["10", "x", "14", "11", "5", "7", "12", "x", "5"], ["7", "x", "15", "x", "15", "8", "3", "6", "7"], ["x", "12", "14", "x", "x", "x", "16", "3", "13"], ["19", "5", "10", "x", "x", "x", "9", "7", "14"]]] | [[["10", "14", "4", "16", "x", "17", "5", "x", "x"], ["5", "20", "16", "3", "1", "8", "x", "16", "19"], ["1", "x", "5", "13", "3", "15", "19", "15", "x"], ["x", "16", "13", "20", "x", "8", "x", "x", "x"], ["x", "16", "x", "17", "11", "1", "x", "15", "x"], ["10", "x", "14", "11", "5", "7", "12", "x", "5"], ["7", "x", "15", "x", "15", "8", "3", "6", "7"], ["x", "12", "14", "x", "x", "x", "16", "3", "13"], ["19", "5", "10", "x", "x", "x", "9", "7", "14"]], [7, 7], [1, 2], 1, 6] | ["[['10', '14', '4', '16', 'x', '17', '5', 'x', 'x'], ['5', '20', '16', '3', '1', '8', 'x', '16', '19'], ['1', 'x', '5', '13', '3', '15', '19', '15', 'x'], ['x', '16', '13', '20', 'x', '8', 'x', 'x', 'x'], ['x', '16', 'x', '17', '11', '1', 'x', '15', 'x'], ['10', 'x', '14', '11', '5', '7', '12', 'x', '5'], ['7', 'x', '15', 'x', '15', '8', '3', '6', '7'], ['x', '12', '14', 'x', 'x', 'x', '16', '3', '13'], ['19', '5', '10', 'x', 'x', 'x', '9', '7', '14']]", "(7, 7)", "(1, 2)", "1", "6"] |
3 | 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, 6) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (0, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
0 1 1 0 1 1 1 1 0
0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 0 0 0
1 1 0 1 0 0 0 1 1
0 1 1 1 1 1 0 0 1
1 0 0 1 1 0 0 0 0
1 0 1 1 1 0 0 0 0
0 1 1 0 1 0 1 0 1
1 1 1 1 1 0 0 0 0 | trampoline_matrix | pathfinding | 9 | [[8, 6], [7, 5], [6, 5], [5, 5], [4, 6], [3, 5], [3, 4], [2, 4], [2, 3], [2, 2], [1, 2], [1, 1], [1, 0], [0, 0]] | 14 | 0.03221940994262695 | 14 | 8 | 2 | ["[[0, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 1, 1], [0, 1, 1, 1, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 0, 0, 0, 0]]", 3] | ["[[0, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 1, 1], [0, 1, 1, 1, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 0, 0, 0, 0]]", [8, 6], [0, 0], 3] | ["[[0, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 1, 1], [0, 1, 1, 1, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 0, 0, 0, 0]]", "(8, 6)", "(0, 0)", "3"] |
3 | Given 5 labeled water jugs with capacities 43, 149, 131, 132, 70, 104 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 284, 297, 436 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 | [["+", 131, 3], ["+", 131, 3], ["+", 70, 3], ["+", 104, 3], ["+", 131, 2], ["+", 132, 2], ["-", 70, 2], ["+", 104, 2], ["+", 104, 1], ["+", 104, 1], ["-", 132, 1], ["+", 104, 1], ["+", 104, 1]] | 13 | 0.038121938705444336 | 13 | 36 | 3 | [[43, 149, 131, 132, 70, 104], [284, 297, 436]] | [[43, 149, 131, 132, 70, 104], [284, 297, 436]] | ["[43, 149, 131, 132, 70, 104]", "[284, 297, 436]"] |
4 | 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, 89, 70], [25, 42, 83], ['_', 24, 71]] | 8_puzzle | puzzle | 2 | [24, 42, 89, 70, 83, 71, 42, 24, 25, 66, 70, 89, 66, 70, 89, 83, 71, 42] | 18 | 0.03897857666015625 | 18 | 4 | 9 | [[[66, 89, 70], [25, 42, 83], ["_", 24, 71]]] | [[[66, 89, 70], [25, 42, 83], ["_", 24, 71]]] | ["[[66, 89, 70], [25, 42, 83], ['_', 24, 71]]"] |
4 | 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: map, cere, drub, velo The initial board: [['_', 'm', 'u', 'p'], ['c', 'e', 'r', 'a'], ['d', 'r', 'e', 'b'], ['v', 'e', 'l', 'o']] | 8_puzzle_words | puzzle | 1 | ["down-right", "up-right", "down-right", "down-left", "up-left", "up-left"] | 6 | 0.2581043243408203 | 6 | 4 | 16 | [[["_", "m", "u", "p"], ["c", "e", "r", "a"], ["d", "r", "e", "b"], ["v", "e", "l", "o"]]] | [[["_", "m", "u", "p"], ["c", "e", "r", "a"], ["d", "r", "e", "b"], ["v", "e", "l", "o"]], ["map", "cere", "drub", "velo"]] | ["[['_', 'm', 'u', 'p'], ['c', 'e', 'r', 'a'], ['d', 'r', 'e', 'b'], ['v', 'e', 'l', 'o']]", "['map', 'cere', 'drub', 'velo']"] |
4 | 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 'L'. Our task is to visit city D and city N excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from N and D, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
D E Z R N I K G L B
D 0 1 1 1 0 0 0 1 1 1
E 0 0 1 0 0 1 0 0 0 0
Z 0 0 0 0 1 0 0 0 0 0
R 1 0 1 0 0 0 0 0 0 1
N 0 1 0 0 0 1 1 1 0 0
I 1 0 0 0 1 0 1 0 1 0
K 0 0 1 0 1 0 0 0 0 0
G 0 0 1 1 0 1 0 0 0 0
L 0 0 1 0 0 0 0 1 0 0
B 0 1 0 0 0 1 1 0 0 0
| city_directed_graph | pathfinding | 10 | ["L", "Z", "N", "K", "N", "I", "D", "R", "D"] | 9 | 0.026905059814453125 | 9 | 10 | 13 | [[[0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 1, 1, 0, 0, 0]], ["D", "E", "Z", "R", "N", "I", "K", "G", "L", "B"], "D", "N"] | [[[0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 1, 1, 0, 0, 0]], ["D", "E", "Z", "R", "N", "I", "K", "G", "L", "B"], "L", "D", "N"] | ["[[0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 1, 1, 0, 0, 0]]", "['D', 'E', 'Z', 'R', 'N', 'I', 'K', 'G', 'L', 'B']", "['L']", "['D', 'N']"] |
4 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [14, 19, 3, 8, 5, 107, 4, 10, 9, 2, 11, 7, 11, 11, 4, 10, 17, 14, 18, 10, 21, 13, 2, 13, 19, 5, 8, 4, 7, 6, 10], such that the sum of the chosen coins adds up to 215. 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: 9, 107: 7, 13: 11, 10: 7, 19: 12, 9: 2, 4: 4, 14: 8, 21: 14, 6: 2, 5: 3, 2: 2, 3: 3, 7: 6, 18: 6, 8: 4, 11: 11}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 18 | [18, 6, 9, 8, 2, 5, 5, 17, 14, 8, 107, 14, 2] | 60 | 0.03795170783996582 | 13 | 31 | 31 | [[14, 19, 3, 8, 5, 107, 4, 10, 9, 2, 11, 7, 11, 11, 4, 10, 17, 14, 18, 10, 21, 13, 2, 13, 19, 5, 8, 4, 7, 6, 10]] | [[14, 19, 3, 8, 5, 107, 4, 10, 9, 2, 11, 7, 11, 11, 4, 10, 17, 14, 18, 10, 21, 13, 2, 13, 19, 5, 8, 4, 7, 6, 10], {"17": 9, "107": 7, "13": 11, "10": 7, "19": 12, "9": 2, "4": 4, "14": 8, "21": 14, "6": 2, "5": 3, "2": 2, "3": 3, "7": 6, "18": 6, "8": 4, "11": 11}, 215] | ["[14, 19, 3, 8, 5, 107, 4, 10, 9, 2, 11, 7, 11, 11, 4, 10, 17, 14, 18, 10, 21, 13, 2, 13, 19, 5, 8, 4, 7, 6, 10]", "{17: 9, 107: 7, 13: 11, 10: 7, 19: 12, 9: 2, 4: 4, 14: 8, 21: 14, 6: 2, 5: 3, 2: 2, 3: 3, 7: 6, 18: 6, 8: 4, 11: 11}", "215"] |
4 | 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', 'Red', 'Blue', 'Blue'], ['Red', 'Blue', 'Red', 'Green'], ['Green', 'Blue', 'Green', 'Green']] | color_sorting | sorting | 7 | [[1, 0], [1, 2], [1, 0], [1, 2], [0, 1], [0, 1], [0, 1], [0, 1], [2, 1], [2, 0], [2, 1], [2, 0], [1, 2], [1, 2]] | 14 | 0.22463750839233398 | 14 | 6 | 12 | [[["Red", "Red", "Blue", "Blue"], ["Red", "Blue", "Red", "Green"], ["Green", "Blue", "Green", "Green"]], 6] | [[["Red", "Red", "Blue", "Blue"], ["Red", "Blue", "Red", "Green"], ["Green", "Blue", "Green", "Green"]], 6] | ["[['Red', 'Red', 'Blue', 'Blue'], ['Red', 'Blue', 'Red', 'Green'], ['Green', 'Blue', 'Green', 'Green']]", "6"] |
4 | We have a 3x3 numerical grid, with numbers ranging from 20 to 53 (20 included in the range but 53 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' '32' '37']
['29' 'x' 'x']
['x' '46' 'x']] | consecutive_grid | underdetermined_system | 8 | [[0, 0, 20], [1, 1, 33], [1, 2, 34], [2, 0, 47], [2, 2, 21]] | 255 | 0.18683171272277832 | 5 | 33 | 9 | ["[['', '32', '37'], ['29', '', ''], ['', '46', '']]", 20, 53] | ["[['', '32', '37'], ['29', '', ''], ['', '46', '']]", 20, 53] | ["[['', '32', '37'], ['29', '', ''], ['', '46', '']]", "20", "53"] |
4 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 20 to 39. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 72, and sum of row 1 must be 95. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 71. 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:
[['21' 'x' 'x']
['x' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 6 | [[0, 1, 22], [0, 2, 20], [1, 0, 30], [1, 1, 27], [1, 2, 38], [2, 0, 24], [2, 1, 23], [2, 2, 25]] | 230 | 0.5546069145202637 | 8 | 19 | 9 | ["[['21', '', ''], ['', '', ''], ['', '', '']]", 3, 20, 39] | ["[['21', '', ''], ['', '', ''], ['', '', '']]", 20, 39, [1, 2], [1, 2], [72], [95], 71] | ["[['21', '', ''], ['', '', ''], ['', '', '']]", "20", "39", "[None, 72, None]", "[None, 95, None]", "71"] |
4 | 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: 6, 2: 5, 3: 2, 4: 5, 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? [['Red', 'Green', 'Yellow', 'Blue'], [], ['Yellow', 'Green', 'Blue', 'Red'], [], ['Green', 'Red', 'Blue', 'Yellow'], []] | restricted_sorting | sorting | 1 | [[0, 3], [0, 1], [4, 1], [4, 3], [0, 5], [4, 0], [2, 4], [2, 1], [2, 0], [5, 4], [2, 3]] | 45 | 0.024616003036499023 | 11 | 30 | 12 | [[["Red", "Green", "Yellow", "Blue"], [], ["Yellow", "Green", "Blue", "Red"], [], ["Green", "Red", "Blue", "Yellow"], []], 4, {"0": 2, "1": 6, "2": 5, "3": 2, "4": 5, "5": 7}] | [[["Red", "Green", "Yellow", "Blue"], [], ["Yellow", "Green", "Blue", "Red"], [], ["Green", "Red", "Blue", "Yellow"], []], 4, {"0": 2, "1": 6, "2": 5, "3": 2, "4": 5, "5": 7}, 3] | ["[['Red', 'Green', 'Yellow', 'Blue'], [], ['Yellow', 'Green', 'Blue', 'Red'], [], ['Green', 'Red', 'Blue', 'Yellow'], []]", "{0: 2, 1: 6, 2: 5, 3: 2, 4: 5, 5: 7}", "4", "3"] |
4 | 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 (2, 0) to his destination workshop at index (5, 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 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.
[18 9 2 x 9 14 x 1 x]
[3 14 18 7 x 3 x 2 19]
[6 18 20 3 13 x 6 10 x]
[20 x 12 4 14 6 x x x]
[7 18 8 5 19 3 x x 7]
[15 9 14 16 5 14 6 x x]
[x 5 13 x x 19 x x 2]
[x x 8 x x x x 17 12]
[x 1 x x 3 19 x 2 18] | traffic | pathfinding | 1 | [[2, 0], [2, 1], [2, 2], [2, 3], [3, 3], [3, 4], [3, 5], [4, 5], [5, 5], [5, 6]] | 88 | 0.02671647071838379 | 10 | 4 | 4 | [[["18", "9", "2", "x", "9", "14", "x", "1", "x"], ["3", "14", "18", "7", "x", "3", "x", "2", "19"], ["6", "18", "20", "3", "13", "x", "6", "10", "x"], ["20", "x", "12", "4", "14", "6", "x", "x", "x"], ["7", "18", "8", "5", "19", "3", "x", "x", "7"], ["15", "9", "14", "16", "5", "14", "6", "x", "x"], ["x", "5", "13", "x", "x", "19", "x", "x", "2"], ["x", "x", "8", "x", "x", "x", "x", "17", "12"], ["x", "1", "x", "x", "3", "19", "x", "2", "18"]]] | [[["18", "9", "2", "x", "9", "14", "x", "1", "x"], ["3", "14", "18", "7", "x", "3", "x", "2", "19"], ["6", "18", "20", "3", "13", "x", "6", "10", "x"], ["20", "x", "12", "4", "14", "6", "x", "x", "x"], ["7", "18", "8", "5", "19", "3", "x", "x", "7"], ["15", "9", "14", "16", "5", "14", "6", "x", "x"], ["x", "5", "13", "x", "x", "19", "x", "x", "2"], ["x", "x", "8", "x", "x", "x", "x", "17", "12"], ["x", "1", "x", "x", "3", "19", "x", "2", "18"]], [2, 0], [5, 6], 2, 4] | ["[['18', '9', '2', 'x', '9', '14', 'x', '1', 'x'], ['3', '14', '18', '7', 'x', '3', 'x', '2', '19'], ['6', '18', '20', '3', '13', 'x', '6', '10', 'x'], ['20', 'x', '12', '4', '14', '6', 'x', 'x', 'x'], ['7', '18', '8', '5', '19', '3', 'x', 'x', '7'], ['15', '9', '14', '16', '5', '14', '6', 'x', 'x'], ['x', '5', '13', 'x', 'x', '19', 'x', 'x', '2'], ['x', 'x', '8', 'x', 'x', 'x', 'x', '17', '12'], ['x', '1', 'x', 'x', '3', '19', 'x', '2', '18']]", "(2, 0)", "(5, 6)", "2", "4"] |
4 | 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, 1) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (0, 5). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
0 0 1 0 0 0 0 0 1
0 1 0 1 1 0 0 0 0
1 1 1 1 1 1 1 1 0
1 1 0 1 1 0 0 0 0
1 0 1 0 1 0 1 1 1
1 0 1 0 0 0 1 0 1
0 1 0 0 0 1 1 0 1
0 0 1 0 1 1 1 1 1
1 0 0 1 1 0 0 1 1 | trampoline_matrix | pathfinding | 9 | [[8, 1], [7, 1], [6, 2], [5, 3], [5, 4], [4, 5], [3, 5], [3, 6], [3, 7], [3, 8], [2, 8], [1, 8], [1, 7], [1, 6], [0, 6], [0, 5]] | 16 | 0.026789426803588867 | 16 | 8 | 2 | ["[[0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 1, 1, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 1, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 0, 1, 1, 0, 1], [0, 0, 1, 0, 1, 1, 1, 1, 1], [1, 0, 0, 1, 1, 0, 0, 1, 1]]", 3] | ["[[0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 1, 1, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 1, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 0, 1, 1, 0, 1], [0, 0, 1, 0, 1, 1, 1, 1, 1], [1, 0, 0, 1, 1, 0, 0, 1, 1]]", [8, 1], [0, 5], 3] | ["[[0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 1, 1, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 1, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 0, 1, 1, 0, 1], [0, 0, 1, 0, 1, 1, 1, 1, 1], [1, 0, 0, 1, 1, 0, 0, 1, 1]]", "(8, 1)", "(0, 5)", "3"] |
4 | Given 5 labeled water jugs with capacities 36, 88, 132, 70, 87, 111 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 225, 237, 243 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 | [["+", 111, 3], ["+", 132, 3], ["+", 87, 2], ["+", 132, 2], ["-", 70, 2], ["+", 88, 2], ["+", 70, 1], ["+", 132, 1], ["-", 88, 1], ["+", 111, 1]] | 10 | 0.033365726470947266 | 10 | 36 | 3 | [[36, 88, 132, 70, 87, 111], [225, 237, 243]] | [[36, 88, 132, 70, 87, 111], [225, 237, 243]] | ["[36, 88, 132, 70, 87, 111]", "[225, 237, 243]"] |
5 | 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: [[78, 98, 89], [38, '_', 7], [58, 95, 70]] | 8_puzzle | puzzle | 2 | [95, 58, 38, 78, 98, 95, 7, 70, 58, 7, 70, 58] | 12 | 0.029888629913330078 | 12 | 4 | 9 | [[[78, 98, 89], [38, "_", 7], [58, 95, 70]]] | [[[78, 98, 89], [38, "_", 7], [58, 95, 70]]] | ["[[78, 98, 89], [38, '_', 7], [58, 95, 70]]"] |
5 | 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: sax, tass, turp, cade The initial board: [['a', 's', 't', 'x'], ['t', 'r', 's', 'a'], ['s', 'u', '_', 'p'], ['c', 'a', 'd', 'e']] | 8_puzzle_words | puzzle | 1 | ["up-left", "down-left", "down-right", "up-right", "up-left", "up-right", "down-right", "down-left", "down-left", "up-left", "up-right", "up-left"] | 12 | 0.1913444995880127 | 12 | 4 | 16 | [[["a", "s", "t", "x"], ["t", "r", "s", "a"], ["s", "u", "_", "p"], ["c", "a", "d", "e"]]] | [[["a", "s", "t", "x"], ["t", "r", "s", "a"], ["s", "u", "_", "p"], ["c", "a", "d", "e"]], ["sax", "tass", "turp", "cade"]] | ["[['a', 's', 't', 'x'], ['t', 'r', 's', 'a'], ['s', 'u', '_', 'p'], ['c', 'a', 'd', 'e']]", "['sax', 'tass', 'turp', 'cade']"] |
5 | 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 Z and city K excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from K and Z, 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.
K B Z S X H O E U V
K 0 0 1 1 0 0 1 1 0 1
B 0 0 0 0 0 0 0 1 0 1
Z 0 1 0 1 0 1 1 0 0 1
S 0 1 1 0 1 0 0 0 0 0
X 1 1 0 0 0 0 0 0 0 1
H 0 0 0 1 0 0 1 0 1 0
O 0 0 1 1 1 0 0 0 0 0
E 1 0 0 0 0 0 1 0 0 1
U 0 0 0 0 0 0 1 0 0 0
V 0 0 0 0 1 0 0 0 0 0
| city_directed_graph | pathfinding | 10 | ["H", "O", "X", "K", "E", "K", "Z", "S", "Z"] | 9 | 0.03679943084716797 | 9 | 10 | 13 | [[[0, 0, 1, 1, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0]], ["K", "B", "Z", "S", "X", "H", "O", "E", "U", "V"], "Z", "K"] | [[[0, 0, 1, 1, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0]], ["K", "B", "Z", "S", "X", "H", "O", "E", "U", "V"], "H", "Z", "K"] | ["[[0, 0, 1, 1, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0]]", "['K', 'B', 'Z', 'S', 'X', 'H', 'O', 'E', 'U', 'V']", "['H']", "['Z', 'K']"] |
5 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [20, 10, 16, 21, 15, 21, 13, 6, 19, 9, 7, 5, 2, 6, 9, 22, 4, 13, 3, 16, 22, 18, 6, 5, 14, 7, 7, 2, 17, 9, 8, 83, 14], such that the sum of the chosen coins adds up to 239. 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 {22: 18, 21: 1, 14: 12, 10: 8, 8: 6, 17: 9, 6: 4, 7: 6, 9: 3, 20: 13, 19: 12, 5: 3, 13: 8, 4: 3, 83: 14, 3: 2, 18: 1, 2: 1, 16: 2, 15: 3}, 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 | 19 | [18, 21, 16, 2, 15, 2, 9, 9, 21, 83, 16, 6, 4, 17] | 48 | 0.03824257850646973 | 14 | 33 | 33 | [[20, 10, 16, 21, 15, 21, 13, 6, 19, 9, 7, 5, 2, 6, 9, 22, 4, 13, 3, 16, 22, 18, 6, 5, 14, 7, 7, 2, 17, 9, 8, 83, 14]] | [[20, 10, 16, 21, 15, 21, 13, 6, 19, 9, 7, 5, 2, 6, 9, 22, 4, 13, 3, 16, 22, 18, 6, 5, 14, 7, 7, 2, 17, 9, 8, 83, 14], {"22": 18, "21": 1, "14": 12, "10": 8, "8": 6, "17": 9, "6": 4, "7": 6, "9": 3, "20": 13, "19": 12, "5": 3, "13": 8, "4": 3, "83": 14, "3": 2, "18": 1, "2": 1, "16": 2, "15": 3}, 239] | ["[20, 10, 16, 21, 15, 21, 13, 6, 19, 9, 7, 5, 2, 6, 9, 22, 4, 13, 3, 16, 22, 18, 6, 5, 14, 7, 7, 2, 17, 9, 8, 83, 14]", "{22: 18, 21: 1, 14: 12, 10: 8, 8: 6, 17: 9, 6: 4, 7: 6, 9: 3, 20: 13, 19: 12, 5: 3, 13: 8, 4: 3, 83: 14, 3: 2, 18: 1, 2: 1, 16: 2, 15: 3}", "239"] |
5 | 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', 'Blue'], ['Red', 'Green', 'Red', 'Red'], ['Green', 'Red', 'Green', 'Blue']] | color_sorting | sorting | 7 | [[1, 2], [1, 0], [2, 1], [2, 0], [2, 1], [2, 1], [2, 1], [0, 2], [0, 2], [0, 2], [1, 0], [1, 2]] | 12 | 0.08999156951904297 | 12 | 6 | 12 | [[["Green", "Blue", "Blue", "Blue"], ["Red", "Green", "Red", "Red"], ["Green", "Red", "Green", "Blue"]], 6] | [[["Green", "Blue", "Blue", "Blue"], ["Red", "Green", "Red", "Red"], ["Green", "Red", "Green", "Blue"]], 6] | ["[['Green', 'Blue', 'Blue', 'Blue'], ['Red', 'Green', 'Red', 'Red'], ['Green', 'Red', 'Green', 'Blue']]", "6"] |
5 | We have a 3x3 numerical grid, with numbers ranging from 44 to 77 (44 included in the range but 77 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:
[['66' 'x' '74']
['x' '60' '62']
['x' 'x' 'x']] | consecutive_grid | underdetermined_system | 8 | [[0, 1, 67], [1, 0, 47], [2, 0, 46], [2, 1, 45], [2, 2, 44]] | 557 | 0.45664143562316895 | 5 | 33 | 9 | ["[['66', '', '74'], ['', '60', '62'], ['', '', '']]", 44, 77] | ["[['66', '', '74'], ['', '60', '62'], ['', '', '']]", 44, 77] | ["[['66', '', '74'], ['', '60', '62'], ['', '', '']]", "44", "77"] |
5 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 20 to 39. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 82, and sum of row 1 must be 82. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 82. 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']
['22' 'x' 'x']] | magic_square | underdetermined_system | 7 | [[0, 0, 20], [0, 1, 23], [0, 2, 27], [1, 0, 24], [1, 1, 33], [1, 2, 25], [2, 1, 26], [2, 2, 21]] | 221 | 0.6350831985473633 | 8 | 19 | 9 | ["[['', '', ''], ['', '', ''], ['22', '', '']]", 3, 20, 39] | ["[['', '', ''], ['', '', ''], ['22', '', '']]", 20, 39, [1, 2], [1, 2], [82], [82], 82] | ["[['', '', ''], ['', '', ''], ['22', '', '']]", "20", "39", "[None, 82, None]", "[None, 82, None]", "82"] |
5 | 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: 1, 2: 7, 3: 3, 4: 2, 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', 'Yellow'], [], ['Blue', 'Blue', 'Green', 'Red'], [], ['Blue', 'Yellow', 'Red', 'Yellow'], []] | restricted_sorting | sorting | 1 | [[4, 3], [0, 1], [0, 5], [0, 5], [4, 0], [4, 1], [4, 0], [2, 3], [2, 3], [2, 5], [2, 1]] | 26 | 0.1328294277191162 | 11 | 30 | 12 | [[["Red", "Green", "Green", "Yellow"], [], ["Blue", "Blue", "Green", "Red"], [], ["Blue", "Yellow", "Red", "Yellow"], []], 4, {"0": 4, "1": 1, "2": 7, "3": 3, "4": 2, "5": 2}] | [[["Red", "Green", "Green", "Yellow"], [], ["Blue", "Blue", "Green", "Red"], [], ["Blue", "Yellow", "Red", "Yellow"], []], 4, {"0": 4, "1": 1, "2": 7, "3": 3, "4": 2, "5": 2}, 3] | ["[['Red', 'Green', 'Green', 'Yellow'], [], ['Blue', 'Blue', 'Green', 'Red'], [], ['Blue', 'Yellow', 'Red', 'Yellow'], []]", "{0: 4, 1: 1, 2: 7, 3: 3, 4: 2, 5: 2}", "4", "3"] |
5 | 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, 0) to his destination workshop at index (3, 7), 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.
[8 x 4 7 10 x 12 5 x]
[x x 4 11 16 4 12 15 x]
[3 x 16 16 4 x x x x]
[11 6 3 12 8 2 19 14 x]
[20 18 19 x 4 18 x 15 13]
[8 15 x 16 11 x 10 14 1]
[x x x 19 x x x x x]
[7 x x x x x 1 7 8]
[15 3 x x x x x x x] | traffic | pathfinding | 1 | [[5, 0], [4, 0], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7]] | 95 | 0.022897005081176758 | 10 | 4 | 4 | [[["8", "x", "4", "7", "10", "x", "12", "5", "x"], ["x", "x", "4", "11", "16", "4", "12", "15", "x"], ["3", "x", "16", "16", "4", "x", "x", "x", "x"], ["11", "6", "3", "12", "8", "2", "19", "14", "x"], ["20", "18", "19", "x", "4", "18", "x", "15", "13"], ["8", "15", "x", "16", "11", "x", "10", "14", "1"], ["x", "x", "x", "19", "x", "x", "x", "x", "x"], ["7", "x", "x", "x", "x", "x", "1", "7", "8"], ["15", "3", "x", "x", "x", "x", "x", "x", "x"]]] | [[["8", "x", "4", "7", "10", "x", "12", "5", "x"], ["x", "x", "4", "11", "16", "4", "12", "15", "x"], ["3", "x", "16", "16", "4", "x", "x", "x", "x"], ["11", "6", "3", "12", "8", "2", "19", "14", "x"], ["20", "18", "19", "x", "4", "18", "x", "15", "13"], ["8", "15", "x", "16", "11", "x", "10", "14", "1"], ["x", "x", "x", "19", "x", "x", "x", "x", "x"], ["7", "x", "x", "x", "x", "x", "1", "7", "8"], ["15", "3", "x", "x", "x", "x", "x", "x", "x"]], [5, 0], [3, 7], 3, 4] | ["[['8', 'x', '4', '7', '10', 'x', '12', '5', 'x'], ['x', 'x', '4', '11', '16', '4', '12', '15', 'x'], ['3', 'x', '16', '16', '4', 'x', 'x', 'x', 'x'], ['11', '6', '3', '12', '8', '2', '19', '14', 'x'], ['20', '18', '19', 'x', '4', '18', 'x', '15', '13'], ['8', '15', 'x', '16', '11', 'x', '10', '14', '1'], ['x', 'x', 'x', '19', 'x', 'x', 'x', 'x', 'x'], ['7', 'x', 'x', 'x', 'x', 'x', '1', '7', '8'], ['15', '3', 'x', 'x', 'x', 'x', 'x', 'x', 'x']]", "(5, 0)", "(3, 7)", "3", "4"] |
5 | 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, 0) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (5, 7). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
0 0 0 0 1 1 0 1 0
0 0 0 0 0 0 0 1 1
0 1 1 1 1 0 0 0 1
1 1 1 1 1 0 0 1 0
1 1 0 1 1 0 0 0 0
0 1 1 0 1 0 0 0 0
0 1 1 1 1 0 0 1 1
0 0 0 1 1 0 0 1 1
1 0 1 0 1 1 0 1 1 | trampoline_matrix | pathfinding | 9 | [[0, 0], [0, 1], [0, 2], [0, 3], [1, 3], [1, 4], [2, 5], [3, 5], [4, 6], [5, 7]] | 10 | 0.031831979751586914 | 10 | 8 | 2 | ["[[0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 1, 1, 1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 0, 0, 1, 0], [1, 1, 0, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1], [0, 0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1]]", 3] | ["[[0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 1, 1, 1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 0, 0, 1, 0], [1, 1, 0, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1], [0, 0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1]]", [0, 0], [5, 7], 3] | ["[[0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 1, 1, 1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 0, 0, 1, 0], [1, 1, 0, 1, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1], [0, 0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1]]", "(0, 0)", "(5, 7)", "3"] |
5 | Given 5 labeled water jugs with capacities 145, 101, 17, 75, 102, 129 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 260, 287, 413 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 | [["+", 17, 3], ["+", 101, 3], ["+", 145, 3], ["+", 75, 3], ["+", 75, 3], ["+", 101, 2], ["+", 101, 2], ["-", 17, 2], ["+", 102, 2], ["+", 101, 1], ["-", 17, 1], ["+", 75, 1], ["+", 101, 1]] | 13 | 0.04054903984069824 | 13 | 36 | 3 | [[145, 101, 17, 75, 102, 129], [260, 287, 413]] | [[145, 101, 17, 75, 102, 129], [260, 287, 413]] | ["[145, 101, 17, 75, 102, 129]", "[260, 287, 413]"] |
6 | 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: [[46, 82, 90], [36, 41, 38], [28, 55, '_']] | 8_puzzle | puzzle | 2 | [38, 41, 82, 90, 41, 82, 55, 28, 36, 46, 90, 41, 82, 55, 41, 82, 55, 38] | 18 | 0.046418190002441406 | 18 | 4 | 9 | [[[46, 82, 90], [36, 41, 38], [28, 55, "_"]]] | [[[46, 82, 90], [36, 41, 38], [28, 55, "_"]]] | ["[[46, 82, 90], [36, 41, 38], [28, 55, '_']]"] |
6 | 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: cho, slod, syce, halt The initial board: [['l', 'c', '_', 'o'], ['s', 'c', 'o', 'h'], ['d', 'y', 'a', 'e'], ['h', 's', 'l', 't']] | 8_puzzle_words | puzzle | 1 | ["down-left", "down-left", "down-right", "up-right", "up-left", "up-right", "down-right", "down-left", "up-left", "up-left"] | 10 | 0.16235899925231934 | 10 | 4 | 16 | [[["l", "c", "_", "o"], ["s", "c", "o", "h"], ["d", "y", "a", "e"], ["h", "s", "l", "t"]]] | [[["l", "c", "_", "o"], ["s", "c", "o", "h"], ["d", "y", "a", "e"], ["h", "s", "l", "t"]], ["cho", "slod", "syce", "halt"]] | ["[['l', 'c', '_', 'o'], ['s', 'c', 'o', 'h'], ['d', 'y', 'a', 'e'], ['h', 's', 'l', 't']]", "['cho', 'slod', 'syce', 'halt']"] |
6 | 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 D and city F excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from F and D, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
F I O J K D N R M B
F 0 0 0 1 1 0 0 0 1 0
I 1 0 0 0 0 0 0 0 0 1
O 0 0 0 1 0 1 0 0 1 1
J 1 0 1 0 0 0 0 0 0 0
K 0 0 1 0 0 1 0 0 0 0
D 0 1 1 0 0 0 0 1 0 0
N 0 1 0 0 0 0 0 1 0 0
R 0 0 0 1 0 0 0 0 1 0
M 1 1 0 1 0 0 0 0 0 0
B 1 0 0 1 0 1 0 0 1 0
| city_directed_graph | pathfinding | 10 | ["N", "I", "F", "J", "F", "K", "D", "O", "D"] | 9 | 0.028170108795166016 | 9 | 10 | 13 | [[[0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 1, 0, 0, 1, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 1, 0, 0, 1, 0]], ["F", "I", "O", "J", "K", "D", "N", "R", "M", "B"], "D", "F"] | [[[0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 1, 0, 0, 1, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 1, 0, 0, 1, 0]], ["F", "I", "O", "J", "K", "D", "N", "R", "M", "B"], "N", "D", "F"] | ["[[0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 1, 0, 0, 1, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 1, 0, 0, 1, 0]]", "['F', 'I', 'O', 'J', 'K', 'D', 'N', 'R', 'M', 'B']", "['N']", "['D', 'F']"] |
6 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [20, 25, 10, 4, 13, 3, 10, 17, 5, 25, 17, 2, 19, 24, 25, 10, 19, 8, 2, 20, 15, 84, 23, 87, 19, 8, 12, 17, 23, 6], such that the sum of the chosen coins adds up to 250. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {12: 12, 19: 8, 84: 20, 24: 1, 5: 1, 3: 1, 4: 2, 87: 7, 10: 5, 25: 7, 6: 5, 20: 5, 15: 7, 23: 17, 13: 4, 17: 16, 2: 1, 8: 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 | 20 | [3, 5, 87, 84, 24, 20, 25, 2] | 43 | 0.036344051361083984 | 8 | 30 | 30 | [[20, 25, 10, 4, 13, 3, 10, 17, 5, 25, 17, 2, 19, 24, 25, 10, 19, 8, 2, 20, 15, 84, 23, 87, 19, 8, 12, 17, 23, 6]] | [[20, 25, 10, 4, 13, 3, 10, 17, 5, 25, 17, 2, 19, 24, 25, 10, 19, 8, 2, 20, 15, 84, 23, 87, 19, 8, 12, 17, 23, 6], {"12": 12, "19": 8, "84": 20, "24": 1, "5": 1, "3": 1, "4": 2, "87": 7, "10": 5, "25": 7, "6": 5, "20": 5, "15": 7, "23": 17, "13": 4, "17": 16, "2": 1, "8": 5}, 250] | ["[20, 25, 10, 4, 13, 3, 10, 17, 5, 25, 17, 2, 19, 24, 25, 10, 19, 8, 2, 20, 15, 84, 23, 87, 19, 8, 12, 17, 23, 6]", "{12: 12, 19: 8, 84: 20, 24: 1, 5: 1, 3: 1, 4: 2, 87: 7, 10: 5, 25: 7, 6: 5, 20: 5, 15: 7, 23: 17, 13: 4, 17: 16, 2: 1, 8: 5}", "250"] |
6 | 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', 'Blue', 'Red'], ['Red', 'Blue', 'Green', 'Red'], ['Green', 'Green', 'Blue', 'Red']] | color_sorting | sorting | 7 | [[0, 1], [0, 2], [0, 1], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [2, 0], [1, 2], [1, 0], [2, 1], [2, 1], [2, 1], [2, 1], [2, 1], [0, 2], [0, 2], [0, 1], [0, 2], [1, 0], [1, 0]] | 22 | 7.465789318084717 | 22 | 6 | 12 | [[["Blue", "Green", "Blue", "Red"], ["Red", "Blue", "Green", "Red"], ["Green", "Green", "Blue", "Red"]], 6] | [[["Blue", "Green", "Blue", "Red"], ["Red", "Blue", "Green", "Red"], ["Green", "Green", "Blue", "Red"]], 6] | ["[['Blue', 'Green', 'Blue', 'Red'], ['Red', 'Blue', 'Green', 'Red'], ['Green', 'Green', 'Blue', 'Red']]", "6"] |
6 | We have a 3x3 numerical grid, with numbers ranging from 41 to 74 (41 included in the range but 74 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' '48' 'x']
['x' 'x' '63']
['x' 'x' '67']] | consecutive_grid | underdetermined_system | 8 | [[0, 2, 49], [1, 0, 42], [1, 1, 45], [2, 0, 43], [2, 1, 44]] | 470 | 0.18347549438476562 | 5 | 33 | 9 | ["[['41', '48', ''], ['', '', '63'], ['', '', '67']]", 41, 74] | ["[['41', '48', ''], ['', '', '63'], ['', '', '67']]", 41, 74] | ["[['41', '48', ''], ['', '', '63'], ['', '', '67']]", "41", "74"] |
6 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 19 to 43. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 82, and sum of row 1 must be 82. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 96. 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' '20' 'x']
['x' 'x' 'x']
['x' 'x' '33']] | magic_square | underdetermined_system | 7 | [[0, 0, 19], [0, 2, 25], [1, 0, 21], [1, 1, 39], [1, 2, 22], [2, 0, 32], [2, 1, 23]] | 234 | 7.9251344203948975 | 7 | 19 | 9 | ["[['', '20', ''], ['', '', ''], ['', '', '33']]", 3, 19, 43] | ["[['', '20', ''], ['', '', ''], ['', '', '33']]", 19, 43, [1, 2], [1, 2], [82], [82], 96] | ["[['', '20', ''], ['', '', ''], ['', '', '33']]", "19", "43", "[None, 82, None]", "[None, 82, None]", "96"] |
6 | 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: 3, 2: 5, 3: 5, 4: 1, 5: 3}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Yellow', 'Blue', 'Blue', 'Green'], [], ['Yellow', 'Green', 'Red', 'Red'], ['Green', 'Red', 'Yellow', 'Blue'], [], []] | restricted_sorting | sorting | 1 | [[0, 5], [2, 5], [2, 4], [3, 4], [3, 2], [0, 1], [0, 1], [3, 5], [3, 1], [0, 4]] | 26 | 0.06659841537475586 | 10 | 30 | 12 | [[["Yellow", "Blue", "Blue", "Green"], [], ["Yellow", "Green", "Red", "Red"], ["Green", "Red", "Yellow", "Blue"], [], []], 4, {"0": 7, "1": 3, "2": 5, "3": 5, "4": 1, "5": 3}] | [[["Yellow", "Blue", "Blue", "Green"], [], ["Yellow", "Green", "Red", "Red"], ["Green", "Red", "Yellow", "Blue"], [], []], 4, {"0": 7, "1": 3, "2": 5, "3": 5, "4": 1, "5": 3}, 3] | ["[['Yellow', 'Blue', 'Blue', 'Green'], [], ['Yellow', 'Green', 'Red', 'Red'], ['Green', 'Red', 'Yellow', 'Blue'], [], []]", "{0: 7, 1: 3, 2: 5, 3: 5, 4: 1, 5: 3}", "4", "3"] |
6 | 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, 5) to his destination workshop at index (1, 0), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 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.
[6 16 x x 15 x 14 11 x]
[5 2 1 x 3 x 4 13 x]
[x 7 x x 13 x 10 14 5]
[6 16 x 13 6 x 16 x x]
[x 1 17 x 6 3 x x 3]
[11 10 7 19 15 8 12 6 x]
[18 x x 9 8 9 x x 13]
[4 x x x 18 20 x x x]
[x x 8 x 18 2 6 13 x] | traffic | pathfinding | 1 | [[5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [1, 0]] | 82 | 0.027018070220947266 | 10 | 4 | 4 | [[["6", "16", "x", "x", "15", "x", "14", "11", "x"], ["5", "2", "1", "x", "3", "x", "4", "13", "x"], ["x", "7", "x", "x", "13", "x", "10", "14", "5"], ["6", "16", "x", "13", "6", "x", "16", "x", "x"], ["x", "1", "17", "x", "6", "3", "x", "x", "3"], ["11", "10", "7", "19", "15", "8", "12", "6", "x"], ["18", "x", "x", "9", "8", "9", "x", "x", "13"], ["4", "x", "x", "x", "18", "20", "x", "x", "x"], ["x", "x", "8", "x", "18", "2", "6", "13", "x"]]] | [[["6", "16", "x", "x", "15", "x", "14", "11", "x"], ["5", "2", "1", "x", "3", "x", "4", "13", "x"], ["x", "7", "x", "x", "13", "x", "10", "14", "5"], ["6", "16", "x", "13", "6", "x", "16", "x", "x"], ["x", "1", "17", "x", "6", "3", "x", "x", "3"], ["11", "10", "7", "19", "15", "8", "12", "6", "x"], ["18", "x", "x", "9", "8", "9", "x", "x", "13"], ["4", "x", "x", "x", "18", "20", "x", "x", "x"], ["x", "x", "8", "x", "18", "2", "6", "13", "x"]], [5, 5], [1, 0], 1, 4] | ["[['6', '16', 'x', 'x', '15', 'x', '14', '11', 'x'], ['5', '2', '1', 'x', '3', 'x', '4', '13', 'x'], ['x', '7', 'x', 'x', '13', 'x', '10', '14', '5'], ['6', '16', 'x', '13', '6', 'x', '16', 'x', 'x'], ['x', '1', '17', 'x', '6', '3', 'x', 'x', '3'], ['11', '10', '7', '19', '15', '8', '12', '6', 'x'], ['18', 'x', 'x', '9', '8', '9', 'x', 'x', '13'], ['4', 'x', 'x', 'x', '18', '20', 'x', 'x', 'x'], ['x', 'x', '8', 'x', '18', '2', '6', '13', 'x']]", "(5, 5)", "(1, 0)", "1", "4"] |
6 | 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, 6) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (8, 2). 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 1 0 1 0
1 1 1 0 1 1 0 0 1
1 1 1 1 1 0 0 1 0
1 0 1 1 1 0 1 1 0
0 0 1 1 0 0 1 0 0
1 1 0 0 0 0 0 0 1
1 0 0 0 0 0 0 1 1
1 1 0 0 0 1 0 1 0
0 1 0 0 0 1 1 1 1 | trampoline_matrix | pathfinding | 9 | [[0, 6], [1, 6], [2, 5], [3, 5], [4, 4], [5, 3], [6, 3], [7, 3], [7, 2], [8, 2]] | 10 | 0.02278614044189453 | 10 | 8 | 2 | ["[[1, 0, 1, 0, 0, 1, 0, 1, 0], [1, 1, 1, 0, 1, 1, 0, 0, 1], [1, 1, 1, 1, 1, 0, 0, 1, 0], [1, 0, 1, 1, 1, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 1, 1, 1]]", 3] | ["[[1, 0, 1, 0, 0, 1, 0, 1, 0], [1, 1, 1, 0, 1, 1, 0, 0, 1], [1, 1, 1, 1, 1, 0, 0, 1, 0], [1, 0, 1, 1, 1, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 1, 1, 1]]", [0, 6], [8, 2], 3] | ["[[1, 0, 1, 0, 0, 1, 0, 1, 0], [1, 1, 1, 0, 1, 1, 0, 0, 1], [1, 1, 1, 1, 1, 0, 0, 1, 0], [1, 0, 1, 1, 1, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 1, 1, 1]]", "(0, 6)", "(8, 2)", "3"] |
6 | Given 5 labeled water jugs with capacities 76, 135, 134, 19, 10, 30 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 390, 420, 439 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 | [["+", 76, 3], ["+", 76, 3], ["+", 134, 3], ["+", 19, 3], ["+", 134, 3], ["+", 134, 2], ["+", 134, 2], ["+", 76, 2], ["+", 76, 2], ["+", 76, 1], ["+", 76, 1], ["+", 134, 1], ["-", 30, 1], ["+", 134, 1]] | 14 | 0.05055570602416992 | 14 | 36 | 3 | [[76, 135, 134, 19, 10, 30], [390, 420, 439]] | [[76, 135, 134, 19, 10, 30], [390, 420, 439]] | ["[76, 135, 134, 19, 10, 30]", "[390, 420, 439]"] |
7 | 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: [[36, 16, 48], [86, '_', 13], [89, 31, 37]] | 8_puzzle | puzzle | 3 | [31, 37, 13, 31, 16, 36, 86, 89, 37, 16, 36, 86, 89, 37, 16, 13] | 16 | 0.03079676628112793 | 16 | 4 | 9 | [[[36, 16, 48], [86, "_", 13], [89, 31, 37]]] | [[[36, 16, 48], [86, "_", 13], [89, 31, 37]]] | ["[[36, 16, 48], [86, '_', 13], [89, 31, 37]]"] |
7 | 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: cry, dune, rump, knee The initial board: [['u', 'c', 'r', 'y'], ['d', 'n', 'n', 'r'], ['_', 'u', 'm', 'p'], ['k', 'e', 'e', 'e']] | 8_puzzle_words | puzzle | 1 | ["up-right", "down-right", "up-right", "up-left", "down-left", "down-right", "down-left", "up-left", "up-right", "up-right", "down-right", "down-left", "up-left", "up-left"] | 14 | 0.1806955337524414 | 14 | 4 | 16 | [[["u", "c", "r", "y"], ["d", "n", "n", "r"], ["_", "u", "m", "p"], ["k", "e", "e", "e"]]] | [[["u", "c", "r", "y"], ["d", "n", "n", "r"], ["_", "u", "m", "p"], ["k", "e", "e", "e"]], ["cry", "dune", "rump", "knee"]] | ["[['u', 'c', 'r', 'y'], ['d', 'n', 'n', 'r'], ['_', 'u', 'm', 'p'], ['k', 'e', 'e', 'e']]", "['cry', 'dune', 'rump', 'knee']"] |
7 | 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 'Z'. Our task is to visit city B and city H 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 H and B, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
R B F Z N H A P M J
R 0 1 1 0 1 0 0 0 0 0
B 0 0 1 0 0 0 1 0 0 0
F 0 0 0 1 1 0 0 0 1 0
Z 0 0 0 0 0 0 1 0 0 1
N 0 1 0 0 0 0 0 0 0 0
H 0 0 0 0 1 0 0 0 0 1
A 1 0 0 0 1 0 0 1 0 0
P 0 0 1 1 0 1 0 0 1 0
M 1 0 0 0 0 1 1 0 0 0
J 1 0 0 1 0 0 1 0 0 0
| city_directed_graph | pathfinding | 10 | ["Z", "A", "P", "H", "J", "R", "B", "F", "M", "H", "N", "B"] | 12 | 0.02784132957458496 | 12 | 10 | 13 | [[[0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 0]], ["R", "B", "F", "Z", "N", "H", "A", "P", "M", "J"], "B", "H"] | [[[0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 0]], ["R", "B", "F", "Z", "N", "H", "A", "P", "M", "J"], "Z", "B", "H"] | ["[[0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 0, 0]]", "['R', 'B', 'F', 'Z', 'N', 'H', 'A', 'P', 'M', 'J']", "['Z']", "['B', 'H']"] |
7 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [41, 4, 22, 8, 5, 5, 20, 4, 3, 19, 4, 13, 3, 18, 20, 9, 15, 3, 3, 14, 3, 14, 9, 4, 15, 19, 6, 15, 22, 19, 3, 3, 20, 9, 20, 11, 22, 15, 20], such that the sum of the chosen coins adds up to 220. 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 {20: 11, 15: 13, 9: 7, 8: 3, 3: 1, 6: 3, 5: 2, 13: 11, 4: 4, 22: 11, 19: 19, 11: 1, 14: 2, 41: 16, 18: 18}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 21 | [14, 8, 6, 11, 41, 22, 20, 14, 4, 5, 5, 9, 9, 9, 13, 15, 15] | 115 | 0.03900480270385742 | 17 | 39 | 39 | [[41, 4, 22, 8, 5, 5, 20, 4, 3, 19, 4, 13, 3, 18, 20, 9, 15, 3, 3, 14, 3, 14, 9, 4, 15, 19, 6, 15, 22, 19, 3, 3, 20, 9, 20, 11, 22, 15, 20]] | [[41, 4, 22, 8, 5, 5, 20, 4, 3, 19, 4, 13, 3, 18, 20, 9, 15, 3, 3, 14, 3, 14, 9, 4, 15, 19, 6, 15, 22, 19, 3, 3, 20, 9, 20, 11, 22, 15, 20], {"20": 11, "15": 13, "9": 7, "8": 3, "3": 1, "6": 3, "5": 2, "13": 11, "4": 4, "22": 11, "19": 19, "11": 1, "14": 2, "41": 16, "18": 18}, 220] | ["[41, 4, 22, 8, 5, 5, 20, 4, 3, 19, 4, 13, 3, 18, 20, 9, 15, 3, 3, 14, 3, 14, 9, 4, 15, 19, 6, 15, 22, 19, 3, 3, 20, 9, 20, 11, 22, 15, 20]", "{20: 11, 15: 13, 9: 7, 8: 3, 3: 1, 6: 3, 5: 2, 13: 11, 4: 4, 22: 11, 19: 19, 11: 1, 14: 2, 41: 16, 18: 18}", "220"] |
7 | 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', 'Red', 'Blue', 'Green'], ['Blue', 'Red', 'Blue', 'Green'], ['Blue', 'Green', 'Red', 'Green']] | color_sorting | sorting | 7 | [[1, 2], [1, 0], [1, 2], [1, 0], [2, 1], [2, 1], [2, 1], [0, 1], [2, 1], [2, 0], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [2, 1]] | 20 | 2.5152063369750977 | 20 | 6 | 12 | [[["Red", "Red", "Blue", "Green"], ["Blue", "Red", "Blue", "Green"], ["Blue", "Green", "Red", "Green"]], 6] | [[["Red", "Red", "Blue", "Green"], ["Blue", "Red", "Blue", "Green"], ["Blue", "Green", "Red", "Green"]], 6] | ["[['Red', 'Red', 'Blue', 'Green'], ['Blue', 'Red', 'Blue', 'Green'], ['Blue', 'Green', 'Red', 'Green']]", "6"] |
7 | We have a 3x3 numerical grid, with numbers ranging from 25 to 58 (25 included in the range but 58 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' '42']
['x' '46' 'x']
['x' 'x' '55']] | consecutive_grid | underdetermined_system | 9 | [[0, 0, 25], [0, 1, 26], [1, 0, 47], [1, 2, 43], [2, 0, 48], [2, 1, 49]] | 359 | 0.5126192569732666 | 6 | 33 | 9 | ["[['', '', '42'], ['', '46', ''], ['', '', '55']]", 25, 58] | ["[['', '', '42'], ['', '46', ''], ['', '', '55']]", 25, 58] | ["[['', '', '42'], ['', '46', ''], ['', '', '55']]", "25", "58"] |
7 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 19 to 43. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 111, and sum of row 1 must be 94. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 82. 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:
[['37' 'x' '26']
['x' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 7 | [[0, 1, 33], [1, 0, 23], [1, 1, 36], [1, 2, 35], [2, 0, 20], [2, 1, 42], [2, 2, 19]] | 271 | 1.7812092304229736 | 7 | 19 | 9 | ["[['37', '', '26'], ['', '', ''], ['', '', '']]", 3, 19, 43] | ["[['37', '', '26'], ['', '', ''], ['', '', '']]", 19, 43, [1, 2], [1, 2], [111], [94], 82] | ["[['37', '', '26'], ['', '', ''], ['', '', '']]", "19", "43", "[None, 111, None]", "[None, 94, None]", "82"] |
7 | 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: 5, 1: 3, 2: 5, 3: 6, 4: 5, 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? [[], [], [], ['Yellow', 'Green', 'Blue', 'Blue'], ['Red', 'Blue', 'Green', 'Green'], ['Red', 'Red', 'Yellow', 'Yellow']] | restricted_sorting | sorting | 1 | [[4, 1], [5, 1], [5, 1], [3, 0], [3, 2], [4, 3], [0, 5], [2, 4]] | 37 | 0.026184558868408203 | 8 | 30 | 12 | [[[], [], [], ["Yellow", "Green", "Blue", "Blue"], ["Red", "Blue", "Green", "Green"], ["Red", "Red", "Yellow", "Yellow"]], 4, {"0": 5, "1": 3, "2": 5, "3": 6, "4": 5, "5": 7}] | [[[], [], [], ["Yellow", "Green", "Blue", "Blue"], ["Red", "Blue", "Green", "Green"], ["Red", "Red", "Yellow", "Yellow"]], 4, {"0": 5, "1": 3, "2": 5, "3": 6, "4": 5, "5": 7}, 3] | ["[[], [], [], ['Yellow', 'Green', 'Blue', 'Blue'], ['Red', 'Blue', 'Green', 'Green'], ['Red', 'Red', 'Yellow', 'Yellow']]", "{0: 5, 1: 3, 2: 5, 3: 6, 4: 5, 5: 7}", "4", "3"] |
7 | Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (6, 1) to his destination workshop at index (2, 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 2, district 2 covering rows 3 to 5, and district 3 covering rows 6 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 7 7 12 7 x 13 1 18]
[9 18 x 4 19 8 x 15 10]
[9 x 10 5 5 9 8 x x]
[14 4 19 9 14 x x 7 9]
[9 4 11 15 7 x 17 3 x]
[11 x 2 18 15 15 x x x]
[x 5 10 x x 13 x 9 x]
[3 x 2 x 12 x x x 4]
[x x 7 x 19 x x x 9] | traffic | pathfinding | 1 | [[6, 1], [6, 2], [5, 2], [4, 2], [4, 3], [3, 3], [2, 3], [2, 4], [2, 5], [2, 6]] | 74 | 0.021251201629638672 | 10 | 4 | 4 | [[["x", "7", "7", "12", "7", "x", "13", "1", "18"], ["9", "18", "x", "4", "19", "8", "x", "15", "10"], ["9", "x", "10", "5", "5", "9", "8", "x", "x"], ["14", "4", "19", "9", "14", "x", "x", "7", "9"], ["9", "4", "11", "15", "7", "x", "17", "3", "x"], ["11", "x", "2", "18", "15", "15", "x", "x", "x"], ["x", "5", "10", "x", "x", "13", "x", "9", "x"], ["3", "x", "2", "x", "12", "x", "x", "x", "4"], ["x", "x", "7", "x", "19", "x", "x", "x", "9"]]] | [[["x", "7", "7", "12", "7", "x", "13", "1", "18"], ["9", "18", "x", "4", "19", "8", "x", "15", "10"], ["9", "x", "10", "5", "5", "9", "8", "x", "x"], ["14", "4", "19", "9", "14", "x", "x", "7", "9"], ["9", "4", "11", "15", "7", "x", "17", "3", "x"], ["11", "x", "2", "18", "15", "15", "x", "x", "x"], ["x", "5", "10", "x", "x", "13", "x", "9", "x"], ["3", "x", "2", "x", "12", "x", "x", "x", "4"], ["x", "x", "7", "x", "19", "x", "x", "x", "9"]], [6, 1], [2, 6], 2, 5] | ["[['x', '7', '7', '12', '7', 'x', '13', '1', '18'], ['9', '18', 'x', '4', '19', '8', 'x', '15', '10'], ['9', 'x', '10', '5', '5', '9', '8', 'x', 'x'], ['14', '4', '19', '9', '14', 'x', 'x', '7', '9'], ['9', '4', '11', '15', '7', 'x', '17', '3', 'x'], ['11', 'x', '2', '18', '15', '15', 'x', 'x', 'x'], ['x', '5', '10', 'x', 'x', '13', 'x', '9', 'x'], ['3', 'x', '2', 'x', '12', 'x', 'x', 'x', '4'], ['x', 'x', '7', 'x', '19', 'x', 'x', 'x', '9']]", "(6, 1)", "(2, 6)", "2", "5"] |
7 | 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, 2) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (0, 7). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
1 0 1 1 1 1 1 0 0
0 1 1 1 1 1 1 0 0
1 1 1 1 0 0 0 1 0
1 1 1 0 0 1 1 0 0
0 0 1 0 0 1 1 0 0
1 1 0 0 1 0 1 0 0
0 1 1 1 1 1 1 1 0
1 0 0 0 0 1 1 0 0
0 0 0 0 0 0 0 0 0 | trampoline_matrix | pathfinding | 9 | [[8, 2], [8, 3], [8, 4], [8, 5], [8, 6], [7, 7], [6, 8], [5, 8], [4, 8], [3, 8], [2, 8], [1, 7], [0, 7]] | 13 | 0.030285120010375977 | 13 | 8 | 2 | ["[[1, 0, 1, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 0, 0, 0, 1, 0], [1, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]", 3] | ["[[1, 0, 1, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 0, 0, 0, 1, 0], [1, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]", [8, 2], [0, 7], 3] | ["[[1, 0, 1, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 0, 0, 0, 1, 0], [1, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]", "(8, 2)", "(0, 7)", "3"] |
7 | Given 5 labeled water jugs with capacities 22, 48, 29, 111, 92, 28 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 164, 233, 289 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 | [["+", 48, 3], ["+", 111, 3], ["+", 111, 3], ["-", 29, 3], ["+", 48, 3], ["+", 29, 2], ["+", 92, 2], ["+", 92, 2], ["-", 28, 2], ["+", 48, 2], ["+", 22, 1], ["+", 22, 1], ["+", 28, 1], ["+", 92, 1]] | 14 | 0.03762245178222656 | 14 | 36 | 3 | [[22, 48, 29, 111, 92, 28], [164, 233, 289]] | [[22, 48, 29, 111, 92, 28], [164, 233, 289]] | ["[22, 48, 29, 111, 92, 28]", "[164, 233, 289]"] |
8 | 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, 49, '_'], [56, 72, 74], [96, 33, 59]] | 8_puzzle | puzzle | 3 | [74, 72, 56, 96, 33, 56, 49, 77, 96, 49, 72, 59, 56, 33, 49, 72, 59, 56] | 18 | 0.03490924835205078 | 18 | 4 | 9 | [[[77, 49, "_"], [56, 72, 74], [96, 33, 59]]] | [[[77, 49, "_"], [56, 72, 74], [96, 33, 59]]] | ["[[77, 49, '_'], [56, 72, 74], [96, 33, 59]]"] |
8 | 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: ken, khat, kill, went The initial board: [['h', 'k', 't', 'n'], ['k', 'e', 'a', 'k'], ['e', 'i', '_', 'l'], ['w', 'l', 'n', 't']] | 8_puzzle_words | puzzle | 1 | ["up-right", "up-left", "down-left", "down-right", "down-left", "up-left", "up-right", "up-left"] | 8 | 0.16104960441589355 | 8 | 4 | 16 | [[["h", "k", "t", "n"], ["k", "e", "a", "k"], ["e", "i", "_", "l"], ["w", "l", "n", "t"]]] | [[["h", "k", "t", "n"], ["k", "e", "a", "k"], ["e", "i", "_", "l"], ["w", "l", "n", "t"]], ["ken", "khat", "kill", "went"]] | ["[['h', 'k', 't', 'n'], ['k', 'e', 'a', 'k'], ['e', 'i', '_', 'l'], ['w', 'l', 'n', 't']]", "['ken', 'khat', 'kill', 'went']"] |
8 | 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 'U'. Our task is to visit city A 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 A, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
Y O Q X K R A U M L
Y 0 1 0 0 0 1 1 1 1 1
O 0 0 0 0 0 0 1 0 0 0
Q 1 0 0 1 0 1 0 0 1 0
X 1 0 1 0 0 1 0 0 1 1
K 0 1 0 1 0 0 1 0 0 0
R 0 0 0 0 1 0 0 0 0 0
A 0 0 0 1 0 1 0 0 1 1
U 0 0 0 0 0 0 0 0 0 1
M 0 0 1 0 0 0 0 0 0 0
L 0 1 0 0 0 0 0 0 0 0
| city_directed_graph | pathfinding | 10 | ["U", "L", "O", "A", "X", "Y", "A", "X"] | 8 | 0.029206514358520508 | 8 | 10 | 13 | [[[0, 1, 0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 0, 1, 0, 0, 1, 0], [1, 0, 1, 0, 0, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0]], ["Y", "O", "Q", "X", "K", "R", "A", "U", "M", "L"], "A", "X"] | [[[0, 1, 0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 0, 1, 0, 0, 1, 0], [1, 0, 1, 0, 0, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0]], ["Y", "O", "Q", "X", "K", "R", "A", "U", "M", "L"], "U", "A", "X"] | ["[[0, 1, 0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 0, 1, 0, 0, 1, 0], [1, 0, 1, 0, 0, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0]]", "['Y', 'O', 'Q', 'X', 'K', 'R', 'A', 'U', 'M', 'L']", "['U']", "['A', 'X']"] |
8 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [4, 17, 8, 15, 6, 14, 2, 4, 16, 10, 6, 5, 14, 8, 18, 2, 17, 9, 17, 59, 3, 10, 21, 4, 9, 14, 14, 20, 14, 8, 14, 18, 5, 16, 14, 17, 5, 3], such that the sum of the chosen coins adds up to 214. 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 {15: 6, 5: 5, 17: 1, 14: 4, 2: 2, 8: 2, 10: 9, 59: 9, 16: 8, 4: 3, 18: 10, 20: 11, 21: 8, 6: 6, 9: 9, 3: 3}, 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 | 22 | [17, 17, 17, 14, 8, 59, 14, 8, 17, 14, 8, 21] | 39 | 0.037581682205200195 | 12 | 38 | 38 | [[4, 17, 8, 15, 6, 14, 2, 4, 16, 10, 6, 5, 14, 8, 18, 2, 17, 9, 17, 59, 3, 10, 21, 4, 9, 14, 14, 20, 14, 8, 14, 18, 5, 16, 14, 17, 5, 3]] | [[4, 17, 8, 15, 6, 14, 2, 4, 16, 10, 6, 5, 14, 8, 18, 2, 17, 9, 17, 59, 3, 10, 21, 4, 9, 14, 14, 20, 14, 8, 14, 18, 5, 16, 14, 17, 5, 3], {"15": 6, "5": 5, "17": 1, "14": 4, "2": 2, "8": 2, "10": 9, "59": 9, "16": 8, "4": 3, "18": 10, "20": 11, "21": 8, "6": 6, "9": 9, "3": 3}, 214] | ["[4, 17, 8, 15, 6, 14, 2, 4, 16, 10, 6, 5, 14, 8, 18, 2, 17, 9, 17, 59, 3, 10, 21, 4, 9, 14, 14, 20, 14, 8, 14, 18, 5, 16, 14, 17, 5, 3]", "{15: 6, 5: 5, 17: 1, 14: 4, 2: 2, 8: 2, 10: 9, 59: 9, 16: 8, 4: 3, 18: 10, 20: 11, 21: 8, 6: 6, 9: 9, 3: 3}", "214"] |
8 | 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', 'Red', 'Red'], ['Red', 'Green', 'Green', 'Blue'], ['Red', 'Green', 'Blue', 'Blue']] | color_sorting | sorting | 7 | [[1, 2], [1, 0], [1, 0], [1, 2], [0, 1], [0, 1], [0, 1], [0, 1], [2, 1], [2, 0], [2, 0], [2, 0], [1, 2], [1, 2], [0, 1]] | 15 | 0.3737452030181885 | 15 | 6 | 12 | [[["Green", "Blue", "Red", "Red"], ["Red", "Green", "Green", "Blue"], ["Red", "Green", "Blue", "Blue"]], 6] | [[["Green", "Blue", "Red", "Red"], ["Red", "Green", "Green", "Blue"], ["Red", "Green", "Blue", "Blue"]], 6] | ["[['Green', 'Blue', 'Red', 'Red'], ['Red', 'Green', 'Green', 'Blue'], ['Red', 'Green', 'Blue', 'Blue']]", "6"] |
8 | We have a 3x3 numerical grid, with numbers ranging from 19 to 52 (19 included in the range but 52 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows:
Grid:
[['x' 'x' 'x']
['x' '36' '44']
['x' '34' 'x']] | consecutive_grid | underdetermined_system | 9 | [[0, 0, 19], [0, 1, 37], [0, 2, 45], [1, 0, 21], [2, 0, 35], [2, 2, 20]] | 285 | 6.972386598587036 | 6 | 33 | 9 | ["[['', '', ''], ['', '36', '44'], ['', '34', '']]", 19, 52] | ["[['', '', ''], ['', '36', '44'], ['', '34', '']]", 19, 52] | ["[['', '', ''], ['', '36', '44'], ['', '34', '']]", "19", "52"] |
8 | 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 130, 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 123. 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:
[['52' 'x' 'x']
['x' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 7 | [[0, 1, 38], [0, 2, 35], [1, 0, 39], [1, 1, 51], [1, 2, 54], [2, 0, 37], [2, 1, 41], [2, 2, 36]] | 383 | 2.281245708465576 | 8 | 19 | 9 | ["[['52', '', ''], ['', '', ''], ['', '', '']]", 3, 35, 59] | ["[['52', '', ''], ['', '', ''], ['', '', '']]", 35, 59, [1, 2], [1, 2], [130], [144], 123] | ["[['52', '', ''], ['', '', ''], ['', '', '']]", "35", "59", "[None, 130, None]", "[None, 144, None]", "123"] |
8 | 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: 1, 3: 7, 4: 2, 5: 3}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Blue', 'Green', 'Green', 'Red'], ['Yellow', 'Yellow', 'Green', 'Yellow'], [], [], [], ['Red', 'Blue', 'Red', 'Blue']] | restricted_sorting | sorting | 1 | [[0, 2], [0, 4], [0, 4], [5, 0], [5, 2], [5, 0], [2, 5], [2, 5], [1, 2], [1, 2], [1, 4], [1, 2]] | 23 | 0.13733744621276855 | 12 | 30 | 12 | [[["Blue", "Green", "Green", "Red"], ["Yellow", "Yellow", "Green", "Yellow"], [], [], [], ["Red", "Blue", "Red", "Blue"]], 4, {"0": 3, "1": 6, "2": 1, "3": 7, "4": 2, "5": 3}] | [[["Blue", "Green", "Green", "Red"], ["Yellow", "Yellow", "Green", "Yellow"], [], [], [], ["Red", "Blue", "Red", "Blue"]], 4, {"0": 3, "1": 6, "2": 1, "3": 7, "4": 2, "5": 3}, 3] | ["[['Blue', 'Green', 'Green', 'Red'], ['Yellow', 'Yellow', 'Green', 'Yellow'], [], [], [], ['Red', 'Blue', 'Red', 'Blue']]", "{0: 3, 1: 6, 2: 1, 3: 7, 4: 2, 5: 3}", "4", "3"] |
8 | 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 (2, 8) to his destination workshop at index (6, 3), 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 5, and district 3 covering rows 6 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 13 x x 3 8]
[x 18 19 19 2 9 x x x]
[15 x 6 x x x 13 13 4]
[7 x 4 10 x 11 10 17 x]
[2 7 x x 8 16 4 1 4]
[x x x 5 16 15 x 17 10]
[x x x 5 14 9 3 15 x]
[x 6 4 x x x 18 x x]
[17 x 19 x 1 4 8 x 8] | traffic | pathfinding | 1 | [[2, 8], [2, 7], [3, 7], [4, 7], [4, 6], [4, 5], [4, 4], [5, 4], [5, 3], [6, 3]] | 85 | 0.026849031448364258 | 10 | 4 | 4 | [[["x", "x", "x", "x", "13", "x", "x", "3", "8"], ["x", "18", "19", "19", "2", "9", "x", "x", "x"], ["15", "x", "6", "x", "x", "x", "13", "13", "4"], ["7", "x", "4", "10", "x", "11", "10", "17", "x"], ["2", "7", "x", "x", "8", "16", "4", "1", "4"], ["x", "x", "x", "5", "16", "15", "x", "17", "10"], ["x", "x", "x", "5", "14", "9", "3", "15", "x"], ["x", "6", "4", "x", "x", "x", "18", "x", "x"], ["17", "x", "19", "x", "1", "4", "8", "x", "8"]]] | [[["x", "x", "x", "x", "13", "x", "x", "3", "8"], ["x", "18", "19", "19", "2", "9", "x", "x", "x"], ["15", "x", "6", "x", "x", "x", "13", "13", "4"], ["7", "x", "4", "10", "x", "11", "10", "17", "x"], ["2", "7", "x", "x", "8", "16", "4", "1", "4"], ["x", "x", "x", "5", "16", "15", "x", "17", "10"], ["x", "x", "x", "5", "14", "9", "3", "15", "x"], ["x", "6", "4", "x", "x", "x", "18", "x", "x"], ["17", "x", "19", "x", "1", "4", "8", "x", "8"]], [2, 8], [6, 3], 2, 5] | ["[['x', 'x', 'x', 'x', '13', 'x', 'x', '3', '8'], ['x', '18', '19', '19', '2', '9', 'x', 'x', 'x'], ['15', 'x', '6', 'x', 'x', 'x', '13', '13', '4'], ['7', 'x', '4', '10', 'x', '11', '10', '17', 'x'], ['2', '7', 'x', 'x', '8', '16', '4', '1', '4'], ['x', 'x', 'x', '5', '16', '15', 'x', '17', '10'], ['x', 'x', 'x', '5', '14', '9', '3', '15', 'x'], ['x', '6', '4', 'x', 'x', 'x', '18', 'x', 'x'], ['17', 'x', '19', 'x', '1', '4', '8', 'x', '8']]", "(2, 8)", "(6, 3)", "2", "5"] |
8 | 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, 8) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (8, 3). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
0 1 1 1 0 0 0 1 0
0 1 1 0 1 0 1 0 0
1 0 1 1 1 1 0 0 1
0 0 1 0 1 1 1 0 1
1 0 1 1 0 1 1 0 1
1 1 1 1 1 0 0 0 0
0 0 1 1 1 0 0 0 1
1 1 1 0 0 0 0 1 1
1 1 1 0 0 0 0 1 1 | trampoline_matrix | pathfinding | 9 | [[0, 8], [1, 7], [2, 7], [3, 7], [4, 7], [5, 6], [5, 5], [6, 5], [7, 4], [7, 3], [8, 3]] | 11 | 0.03156876564025879 | 11 | 8 | 2 | ["[[0, 1, 1, 1, 0, 0, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 0], [1, 0, 1, 1, 1, 1, 0, 0, 1], [0, 0, 1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 0, 1, 1]]", 3] | ["[[0, 1, 1, 1, 0, 0, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 0], [1, 0, 1, 1, 1, 1, 0, 0, 1], [0, 0, 1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 0, 1, 1]]", [0, 8], [8, 3], 3] | ["[[0, 1, 1, 1, 0, 0, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 0], [1, 0, 1, 1, 1, 1, 0, 0, 1], [0, 0, 1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 0, 1, 1]]", "(0, 8)", "(8, 3)", "3"] |
8 | Given 5 labeled water jugs with capacities 59, 68, 104, 106, 69, 42 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 196, 210, 238 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 | [["+", 106, 3], ["+", 106, 3], ["-", 42, 3], ["+", 68, 3], ["+", 104, 2], ["+", 106, 2], ["+", 59, 1], ["+", 68, 1], ["+", 69, 1]] | 9 | 0.032889366149902344 | 9 | 36 | 3 | [[59, 68, 104, 106, 69, 42], [196, 210, 238]] | [[59, 68, 104, 106, 69, 42], [196, 210, 238]] | ["[59, 68, 104, 106, 69, 42]", "[196, 210, 238]"] |
9 | 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: [[23, 30, 43], [12, 31, 19], [6, 68, '_']] | 8_puzzle | puzzle | 3 | [19, 31, 68, 6, 12, 23, 30, 68, 23, 30, 68, 43, 31, 19] | 14 | 0.02962183952331543 | 14 | 4 | 9 | [[[23, 30, 43], [12, 31, 19], [6, 68, "_"]]] | [[[23, 30, 43], [12, 31, 19], [6, 68, "_"]]] | ["[[23, 30, 43], [12, 31, 19], [6, 68, '_']]"] |
9 | 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: sun, quot, chat, lure The initial board: [['_', 's', 'a', 'n'], ['q', 'u', 'o', 'u'], ['c', 'h', 'u', 't'], ['l', 't', 'r', 'e']] | 8_puzzle_words | puzzle | 1 | ["down-right", "down-right", "down-left", "up-left", "up-right", "down-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left"] | 16 | 0.14909648895263672 | 16 | 4 | 16 | [[["_", "s", "a", "n"], ["q", "u", "o", "u"], ["c", "h", "u", "t"], ["l", "t", "r", "e"]]] | [[["_", "s", "a", "n"], ["q", "u", "o", "u"], ["c", "h", "u", "t"], ["l", "t", "r", "e"]], ["sun", "quot", "chat", "lure"]] | ["[['_', 's', 'a', 'n'], ['q', 'u', 'o', 'u'], ['c', 'h', 'u', 't'], ['l', 't', 'r', 'e']]", "['sun', 'quot', 'chat', 'lure']"] |
9 | We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'C'. Our task is to visit city W and city F excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from F and 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.
R T C F S X Y E A W
R 0 1 1 0 0 0 1 1 0 1
T 0 0 1 1 0 0 0 0 0 1
C 0 0 0 0 0 0 1 0 0 0
F 1 1 0 0 0 1 0 1 1 0
S 1 0 0 1 0 0 0 1 0 0
X 1 0 1 1 1 0 0 0 0 0
Y 1 1 0 1 0 0 0 0 0 0
E 0 0 1 0 1 0 0 0 0 0
A 1 0 0 0 1 1 1 1 0 0
W 1 0 0 1 1 1 0 1 1 0
| city_directed_graph | pathfinding | 10 | ["C", "Y", "F", "T", "W", "R", "W", "F"] | 8 | 0.022681236267089844 | 8 | 10 | 13 | [[[0, 1, 1, 0, 0, 0, 1, 1, 0, 1], [0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 0, 1, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 1, 1, 1, 0, 1, 1, 0]], ["R", "T", "C", "F", "S", "X", "Y", "E", "A", "W"], "W", "F"] | [[[0, 1, 1, 0, 0, 0, 1, 1, 0, 1], [0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 0, 1, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 1, 1, 1, 0, 1, 1, 0]], ["R", "T", "C", "F", "S", "X", "Y", "E", "A", "W"], "C", "W", "F"] | ["[[0, 1, 1, 0, 0, 0, 1, 1, 0, 1], [0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 0, 1, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 1, 1, 1, 0, 1, 1, 0]]", "['R', 'T', 'C', 'F', 'S', 'X', 'Y', 'E', 'A', 'W']", "['C']", "['W', 'F']"] |
9 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [3, 6, 9, 10, 13, 15, 18, 5, 21, 19, 12, 15, 5, 9, 4, 16, 8, 4, 7, 7, 7, 2, 16, 14, 18, 3, 89, 21, 12, 10, 7, 14, 4, 11, 6, 20], such that the sum of the chosen coins adds up to 229. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {14: 1, 89: 13, 2: 2, 5: 2, 4: 4, 6: 6, 8: 2, 16: 5, 21: 4, 20: 2, 18: 9, 11: 10, 10: 3, 12: 12, 15: 5, 13: 1, 3: 1, 19: 19, 7: 7, 9: 3}, 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 | 23 | [3, 89, 20, 14, 21, 14, 8, 13, 21, 16, 10] | 37 | 0.03856658935546875 | 11 | 36 | 36 | [[3, 6, 9, 10, 13, 15, 18, 5, 21, 19, 12, 15, 5, 9, 4, 16, 8, 4, 7, 7, 7, 2, 16, 14, 18, 3, 89, 21, 12, 10, 7, 14, 4, 11, 6, 20]] | [[3, 6, 9, 10, 13, 15, 18, 5, 21, 19, 12, 15, 5, 9, 4, 16, 8, 4, 7, 7, 7, 2, 16, 14, 18, 3, 89, 21, 12, 10, 7, 14, 4, 11, 6, 20], {"14": 1, "89": 13, "2": 2, "5": 2, "4": 4, "6": 6, "8": 2, "16": 5, "21": 4, "20": 2, "18": 9, "11": 10, "10": 3, "12": 12, "15": 5, "13": 1, "3": 1, "19": 19, "7": 7, "9": 3}, 229] | ["[3, 6, 9, 10, 13, 15, 18, 5, 21, 19, 12, 15, 5, 9, 4, 16, 8, 4, 7, 7, 7, 2, 16, 14, 18, 3, 89, 21, 12, 10, 7, 14, 4, 11, 6, 20]", "{14: 1, 89: 13, 2: 2, 5: 2, 4: 4, 6: 6, 8: 2, 16: 5, 21: 4, 20: 2, 18: 9, 11: 10, 10: 3, 12: 12, 15: 5, 13: 1, 3: 1, 19: 19, 7: 7, 9: 3}", "229"] |
9 | 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', 'Red'], ['Red', 'Green', 'Blue', 'Red'], ['Blue', 'Red', 'Green', 'Blue']] | color_sorting | sorting | 7 | [[0, 2], [1, 0], [1, 2], [1, 0], [1, 0], [2, 1], [2, 1], [0, 1], [2, 0], [2, 1], [2, 1], [0, 2], [0, 2], [0, 1], [0, 2], [0, 2], [1, 0], [1, 2], [1, 0], [1, 0], [2, 1], [2, 1]] | 22 | 7.09385085105896 | 22 | 6 | 12 | [[["Green", "Blue", "Green", "Red"], ["Red", "Green", "Blue", "Red"], ["Blue", "Red", "Green", "Blue"]], 6] | [[["Green", "Blue", "Green", "Red"], ["Red", "Green", "Blue", "Red"], ["Blue", "Red", "Green", "Blue"]], 6] | ["[['Green', 'Blue', 'Green', 'Red'], ['Red', 'Green', 'Blue', 'Red'], ['Blue', 'Red', 'Green', 'Blue']]", "6"] |
9 | We have a 3x3 numerical grid, with numbers ranging from 34 to 67 (34 included in the range but 67 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows:
Grid:
[['x' 'x' 'x']
['x' '51' 'x']
['x' '61' '64']] | consecutive_grid | underdetermined_system | 9 | [[0, 0, 34], [0, 1, 35], [0, 2, 36], [1, 0, 52], [1, 2, 37], [2, 0, 53]] | 391 | 0.19122576713562012 | 6 | 33 | 9 | ["[['', '', ''], ['', '51', ''], ['', '61', '64']]", 34, 67] | ["[['', '', ''], ['', '51', ''], ['', '61', '64']]", 34, 67] | ["[['', '', ''], ['', '51', ''], ['', '61', '64']]", "34", "67"] |
9 | 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 125, and sum of row 1 must be 157. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 138. 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']
['37' 'x' 'x']] | magic_square | underdetermined_system | 6 | [[0, 0, 38], [0, 1, 35], [0, 2, 47], [1, 0, 45], [1, 1, 54], [1, 2, 58], [2, 1, 36], [2, 2, 39]] | 389 | 1.5451362133026123 | 8 | 24 | 9 | ["[['', '', ''], ['', '', ''], ['37', '', '']]", 3, 35, 59] | ["[['', '', ''], ['', '', ''], ['37', '', '']]", 35, 59, [1, 2], [1, 2], [125], [157], 138] | ["[['', '', ''], ['', '', ''], ['37', '', '']]", "35", "59", "[None, 125, None]", "[None, 157, None]", "138"] |
9 | 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: 1, 2: 4, 3: 7, 4: 4, 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? [['Yellow', 'Yellow', 'Red', 'Red'], [], ['Blue', 'Yellow', 'Red', 'Green'], [], ['Green', 'Blue', 'Green', 'Blue'], []] | restricted_sorting | sorting | 1 | [[0, 3], [0, 3], [2, 5], [2, 3], [2, 1], [4, 2], [4, 5], [4, 2], [4, 5], [0, 1], [0, 1]] | 44 | 0.111785888671875 | 11 | 30 | 12 | [[["Yellow", "Yellow", "Red", "Red"], [], ["Blue", "Yellow", "Red", "Green"], [], ["Green", "Blue", "Green", "Blue"], []], 4, {"0": 7, "1": 1, "2": 4, "3": 7, "4": 4, "5": 4}] | [[["Yellow", "Yellow", "Red", "Red"], [], ["Blue", "Yellow", "Red", "Green"], [], ["Green", "Blue", "Green", "Blue"], []], 4, {"0": 7, "1": 1, "2": 4, "3": 7, "4": 4, "5": 4}, 3] | ["[['Yellow', 'Yellow', 'Red', 'Red'], [], ['Blue', 'Yellow', 'Red', 'Green'], [], ['Green', 'Blue', 'Green', 'Blue'], []]", "{0: 7, 1: 1, 2: 4, 3: 7, 4: 4, 5: 4}", "4", "3"] |
9 | 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, 0), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 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.
[6 9 19 x 5 9 x 15 x]
[8 10 16 x x x 5 11 4]
[5 11 20 1 14 16 7 1 5]
[10 5 3 5 12 8 x x 2]
[16 15 15 14 x 13 10 x 10]
[6 4 7 13 x x x x 13]
[x 1 6 3 x x 17 9 5]
[x 11 x 9 x 5 7 x x]
[x x x 18 x 2 x x 12] | traffic | pathfinding | 1 | [[1, 8], [2, 8], [2, 7], [2, 6], [2, 5], [2, 4], [2, 3], [3, 3], [3, 2], [3, 1], [4, 1], [5, 1], [5, 0], [4, 0]] | 98 | 0.02410721778869629 | 14 | 4 | 4 | [[["6", "9", "19", "x", "5", "9", "x", "15", "x"], ["8", "10", "16", "x", "x", "x", "5", "11", "4"], ["5", "11", "20", "1", "14", "16", "7", "1", "5"], ["10", "5", "3", "5", "12", "8", "x", "x", "2"], ["16", "15", "15", "14", "x", "13", "10", "x", "10"], ["6", "4", "7", "13", "x", "x", "x", "x", "13"], ["x", "1", "6", "3", "x", "x", "17", "9", "5"], ["x", "11", "x", "9", "x", "5", "7", "x", "x"], ["x", "x", "x", "18", "x", "2", "x", "x", "12"]]] | [[["6", "9", "19", "x", "5", "9", "x", "15", "x"], ["8", "10", "16", "x", "x", "x", "5", "11", "4"], ["5", "11", "20", "1", "14", "16", "7", "1", "5"], ["10", "5", "3", "5", "12", "8", "x", "x", "2"], ["16", "15", "15", "14", "x", "13", "10", "x", "10"], ["6", "4", "7", "13", "x", "x", "x", "x", "13"], ["x", "1", "6", "3", "x", "x", "17", "9", "5"], ["x", "11", "x", "9", "x", "5", "7", "x", "x"], ["x", "x", "x", "18", "x", "2", "x", "x", "12"]], [1, 8], [4, 0], 1, 4] | ["[['6', '9', '19', 'x', '5', '9', 'x', '15', 'x'], ['8', '10', '16', 'x', 'x', 'x', '5', '11', '4'], ['5', '11', '20', '1', '14', '16', '7', '1', '5'], ['10', '5', '3', '5', '12', '8', 'x', 'x', '2'], ['16', '15', '15', '14', 'x', '13', '10', 'x', '10'], ['6', '4', '7', '13', 'x', 'x', 'x', 'x', '13'], ['x', '1', '6', '3', 'x', 'x', '17', '9', '5'], ['x', '11', 'x', '9', 'x', '5', '7', 'x', 'x'], ['x', 'x', 'x', '18', 'x', '2', 'x', 'x', '12']]", "(1, 8)", "(4, 0)", "1", "4"] |
9 | 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, 2) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (8, 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.
1 0 1 1 1 0 1 1 1
0 1 0 0 1 1 1 0 0
1 0 1 0 1 1 1 0 0
1 1 1 0 0 0 1 1 0
1 1 0 1 0 1 0 1 1
1 0 1 1 0 1 1 1 0
0 1 0 0 0 1 1 0 0
0 1 0 0 0 1 0 1 1
1 1 0 0 0 0 0 0 0 | trampoline_matrix | pathfinding | 9 | [[1, 2], [2, 3], [3, 3], [4, 4], [5, 4], [6, 4], [7, 4], [8, 5], [8, 6], [8, 7], [8, 8]] | 11 | 0.034554481506347656 | 11 | 8 | 2 | ["[[1, 0, 1, 1, 1, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 1, 1, 0, 0], [1, 1, 1, 0, 0, 0, 1, 1, 0], [1, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 0, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0, 1, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0]]", 3] | ["[[1, 0, 1, 1, 1, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 1, 1, 0, 0], [1, 1, 1, 0, 0, 0, 1, 1, 0], [1, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 0, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0, 1, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0]]", [1, 2], [8, 8], 3] | ["[[1, 0, 1, 1, 1, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 1, 1, 0, 0], [1, 1, 1, 0, 0, 0, 1, 1, 0], [1, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 0, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0, 1, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0]]", "(1, 2)", "(8, 8)", "3"] |
9 | Given 5 labeled water jugs with capacities 129, 57, 45, 105, 128, 78 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 344, 376, 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 | [["+", 128, 3], ["+", 129, 3], ["+", 129, 3], ["+", 105, 2], ["+", 105, 2], ["+", 128, 2], ["-", 45, 2], ["-", 45, 2], ["+", 128, 2], ["+", 78, 1], ["+", 105, 1], ["+", 128, 1], ["-", 45, 1], ["+", 78, 1]] | 14 | 0.05803990364074707 | 14 | 36 | 3 | [[129, 57, 45, 105, 128, 78], [344, 376, 386]] | [[129, 57, 45, 105, 128, 78], [344, 376, 386]] | ["[129, 57, 45, 105, 128, 78]", "[344, 376, 386]"] |
10 | 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: [[93, 88, 60], [28, 18, 24], ['_', 47, 53]] | 8_puzzle | puzzle | 3 | [47, 53, 24, 18, 28, 47, 53, 24, 18, 28, 47, 53, 24, 18] | 14 | 0.022923946380615234 | 14 | 4 | 9 | [[[93, 88, 60], [28, 18, 24], ["_", 47, 53]]] | [[[93, 88, 60], [28, 18, 24], ["_", 47, 53]]] | ["[[93, 88, 60], [28, 18, 24], ['_', 47, 53]]"] |