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
46
We have a 4x4 numerical grid, with numbers ranging from 9 to 49 (9 included in the range but 49 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth 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' '29' '41' 'x'] ['x' 'x' '32' '43'] ['23' '25' '29' '44'] ['12' 'x' '20' 'x']]
consecutive_grid
underdetermined_system
10
[[0, 0, 26], [0, 3, 42], [1, 0, 24], [1, 1, 27], [3, 1, 13], [3, 3, 45]]
439
0.18374395370483398
6
40
16
["[['', '29', '41', ''], ['', '', '32', '43'], ['23', '25', '29', '44'], ['12', '', '20', '']]", 9, 49]
["[['', '29', '41', ''], ['', '', '32', '43'], ['23', '25', '29', '44'], ['12', '', '20', '']]", 9, 49]
["[['', '29', '41', ''], ['', '', '32', '43'], ['23', '25', '29', '44'], ['12', '', '20', '']]", "9", "49"]
46
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 35 to 61. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 151, 189, None for columns 1 to 2 respectively, and the sums of rows must be None, 180, 176, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 184. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' 'x' 'x' 'x'] ['x' '37' 'x' '41'] ['48' 'x' 'x' 'x'] ['49' 'x' '46' '38']]
magic_square
underdetermined_system
8
[[0, 0, 36], [0, 1, 39], [0, 2, 44], [0, 3, 43], [1, 0, 45], [1, 2, 57], [2, 1, 35], [2, 2, 42], [2, 3, 51], [3, 1, 40]]
691
5.864994525909424
10
44
9
["[['', '', '', ''], ['', '37', '', '41'], ['48', '', '', ''], ['49', '', '46', '38']]", 4, 35, 61]
["[['', '', '', ''], ['', '37', '', '41'], ['48', '', '', ''], ['49', '', '46', '38']]", 35, 61, [1, 3], [1, 3], [151, 189], [180, 176], 184]
["[['', '', '', ''], ['', '37', '', '41'], ['48', '', '', ''], ['49', '', '46', '38']]", "35", "61", "[None, 151, 189, None]", "[None, 180, 176, None]", "184"]
46
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 2, 1: 1, 2: 6, 3: 3, 4: 1, 5: 5, 6: 4, 7: 2}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], [], [], ['Yellow', 'Black', 'Yellow', 'Black', 'Green'], ['Red', 'Yellow', 'Blue', 'Black', 'Black'], [], ['Red', 'Blue', 'Green', 'Red', 'Blue'], ['Green', 'Blue', 'Red', 'Yellow', 'Green']]
restricted_sorting
sorting
2
[[4, 2], [3, 5], [4, 5], [4, 0], [3, 4], [3, 5], [3, 4], [7, 3], [7, 0], [7, 1], [7, 5], [6, 1], [6, 0], [6, 3], [7, 3], [6, 1], [6, 0], [2, 1]]
49
12.073513269424438
18
56
20
[[[], [], [], ["Yellow", "Black", "Yellow", "Black", "Green"], ["Red", "Yellow", "Blue", "Black", "Black"], [], ["Red", "Blue", "Green", "Red", "Blue"], ["Green", "Blue", "Red", "Yellow", "Green"]], 5, {"0": 2, "1": 1, "2": 6, "3": 3, "4": 1, "5": 5, "6": 4, "7": 2}]
[[[], [], [], ["Yellow", "Black", "Yellow", "Black", "Green"], ["Red", "Yellow", "Blue", "Black", "Black"], [], ["Red", "Blue", "Green", "Red", "Blue"], ["Green", "Blue", "Red", "Yellow", "Green"]], 5, {"0": 2, "1": 1, "2": 6, "3": 3, "4": 1, "5": 5, "6": 4, "7": 2}, 4]
["[[], [], [], ['Yellow', 'Black', 'Yellow', 'Black', 'Green'], ['Red', 'Yellow', 'Blue', 'Black', 'Black'], [], ['Red', 'Blue', 'Green', 'Red', 'Blue'], ['Green', 'Blue', 'Red', 'Yellow', 'Green']]", "{0: 2, 1: 1, 2: 6, 3: 3, 4: 1, 5: 5, 6: 4, 7: 2}", "5", "4"]
46
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, 0) to his destination workshop at index (8, 10), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 7, and district 3 covering rows 8 to 11. 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. [3 14 2 x x x 19 13 17 12 8 x] [1 2 13 1 4 19 x x 16 x x 12] [9 8 9 15 x 12 x x x x x 14] [11 1 10 18 x 16 1 x 12 x x x] [7 16 13 10 13 x 14 x x 9 x 7] [19 7 7 20 13 14 18 x x 7 5 x] [4 x 11 x x 2 7 1 5 x x x] [x x x x x x x x 18 x 1 x] [4 x x 9 19 2 18 8 16 14 19 7] [x x x x 9 x 17 17 1 2 2 15] [18 x x x x x x 11 10 x 17 x] [9 x x x 10 3 x x 13 x 2 x]
traffic
pathfinding
4
[[1, 0], [1, 1], [2, 1], [3, 1], [3, 2], [4, 2], [4, 3], [4, 4], [5, 4], [5, 5], [6, 5], [6, 6], [6, 7], [6, 8], [7, 8], [8, 8], [9, 8], [9, 9], [9, 10], [8, 10]]
157
0.030195236206054688
20
4
4
[[["3", "14", "2", "x", "x", "x", "19", "13", "17", "12", "8", "x"], ["1", "2", "13", "1", "4", "19", "x", "x", "16", "x", "x", "12"], ["9", "8", "9", "15", "x", "12", "x", "x", "x", "x", "x", "14"], ["11", "1", "10", "18", "x", "16", "1", "x", "12", "x", "x", "x"], ["7", "16", "13", "10", "13", "x", "14", "x", "x", "9", "x", "7"], ["19", "7", "7", "20", "13", "14", "18", "x", "x", "7", "5", "x"], ["4", "x", "11", "x", "x", "2", "7", "1", "5", "x", "x", "x"], ["x", "x", "x", "x", "x", "x", "x", "x", "18", "x", "1", "x"], ["4", "x", "x", "9", "19", "2", "18", "8", "16", "14", "19", "7"], ["x", "x", "x", "x", "9", "x", "17", "17", "1", "2", "2", "15"], ["18", "x", "x", "x", "x", "x", "x", "11", "10", "x", "17", "x"], ["9", "x", "x", "x", "10", "3", "x", "x", "13", "x", "2", "x"]]]
[[["3", "14", "2", "x", "x", "x", "19", "13", "17", "12", "8", "x"], ["1", "2", "13", "1", "4", "19", "x", "x", "16", "x", "x", "12"], ["9", "8", "9", "15", "x", "12", "x", "x", "x", "x", "x", "14"], ["11", "1", "10", "18", "x", "16", "1", "x", "12", "x", "x", "x"], ["7", "16", "13", "10", "13", "x", "14", "x", "x", "9", "x", "7"], ["19", "7", "7", "20", "13", "14", "18", "x", "x", "7", "5", "x"], ["4", "x", "11", "x", "x", "2", "7", "1", "5", "x", "x", "x"], ["x", "x", "x", "x", "x", "x", "x", "x", "18", "x", "1", "x"], ["4", "x", "x", "9", "19", "2", "18", "8", "16", "14", "19", "7"], ["x", "x", "x", "x", "9", "x", "17", "17", "1", "2", "2", "15"], ["18", "x", "x", "x", "x", "x", "x", "11", "10", "x", "17", "x"], ["9", "x", "x", "x", "10", "3", "x", "x", "13", "x", "2", "x"]], [1, 0], [8, 10], 1, 7]
["[['3', '14', '2', 'x', 'x', 'x', '19', '13', '17', '12', '8', 'x'], ['1', '2', '13', '1', '4', '19', 'x', 'x', '16', 'x', 'x', '12'], ['9', '8', '9', '15', 'x', '12', 'x', 'x', 'x', 'x', 'x', '14'], ['11', '1', '10', '18', 'x', '16', '1', 'x', '12', 'x', 'x', 'x'], ['7', '16', '13', '10', '13', 'x', '14', 'x', 'x', '9', 'x', '7'], ['19', '7', '7', '20', '13', '14', '18', 'x', 'x', '7', '5', 'x'], ['4', 'x', '11', 'x', 'x', '2', '7', '1', '5', 'x', 'x', 'x'], ['x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', '18', 'x', '1', 'x'], ['4', 'x', 'x', '9', '19', '2', '18', '8', '16', '14', '19', '7'], ['x', 'x', 'x', 'x', '9', 'x', '17', '17', '1', '2', '2', '15'], ['18', 'x', 'x', 'x', 'x', 'x', 'x', '11', '10', 'x', '17', 'x'], ['9', 'x', 'x', 'x', '10', '3', 'x', 'x', '13', 'x', '2', 'x']]", "(1, 0)", "(8, 10)", "1", "7"]
46
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. 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 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (1, 0) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (7, 11). 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 1 0 0 1 1 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0 1 0 0 0 0 1 1 0 1 1 1 0 1 0 0 0 0 1 0 0 0 1 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 1 1 1 0 0 0 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 1 0 1 1 1 0 1 0 0 1
trampoline_matrix
pathfinding
12
[[1, 0], [2, 0], [2, 1], [2, 2], [2, 3], [3, 3], [4, 4], [5, 4], [6, 4], [6, 5], [6, 6], [6, 7], [5, 8], [5, 9], [6, 10], [7, 11]]
16
0.028974056243896484
16
8
2
["[[0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1], [1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1], [0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1]]", 4]
["[[0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1], [1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1], [0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1]]", [1, 0], [7, 11], 4]
["[[0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1], [1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1], [0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1]]", "(1, 0)", "(7, 11)", "4"]
46
Given 9 labeled water jugs with capacities 20, 142, 147, 48, 29, 113, 17, 18, 112, 68 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 287, 423, 583 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 142, 3], ["+", 147, 3], ["+", 147, 3], ["+", 147, 3], ["+", 112, 2], ["+", 147, 2], ["+", 17, 2], ["+", 147, 2], ["+", 142, 1], ["+", 142, 1], ["-", 17, 1], ["+", 20, 1]]
12
0.04404854774475098
12
60
3
[[20, 142, 147, 48, 29, 113, 17, 18, 112, 68], [287, 423, 583]]
[[20, 142, 147, 48, 29, 113, 17, 18, 112, 68], [287, 423, 583]]
["[20, 142, 147, 48, 29, 113, 17, 18, 112, 68]", "[287, 423, 583]"]
47
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: [[69, 92, 89, 72], [82, 13, 65, 59], [45, '_', 67, 8]]
8_puzzle
puzzle
5
[13, 82, 45, 13, 67, 65, 82, 67, 13, 45, 69, 92, 89, 82, 65, 8]
16
0.043500661849975586
16
4
12
[[[69, 92, 89, 72], [82, 13, 65, 59], [45, "_", 67, 8]]]
[[[69, 92, 89, 72], [82, 13, 65, 59], [45, "_", 67, 8]]]
["[[69, 92, 89, 72], [82, 13, 65, 59], [45, '_', 67, 8]]"]
47
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: pongo, urchin, ondine, blinks The initial board: [['r', 'p', '_', 'n', 'n', 'o'], ['u', 'o', 'c', 'o', 'i', 'n'], ['l', 'n', 'h', 'i', 'g', 'e'], ['b', 'd', 'i', 'n', 'k', 's']]
8_puzzle_words
puzzle
3
["down-right", "down-right", "up-right", "up-left", "down-left", "down-left", "down-left", "up-left", "up-right", "up-left"]
10
0.1886446475982666
10
4
24
[[["r", "p", "_", "n", "n", "o"], ["u", "o", "c", "o", "i", "n"], ["l", "n", "h", "i", "g", "e"], ["b", "d", "i", "n", "k", "s"]]]
[[["r", "p", "_", "n", "n", "o"], ["u", "o", "c", "o", "i", "n"], ["l", "n", "h", "i", "g", "e"], ["b", "d", "i", "n", "k", "s"]], ["pongo", "urchin", "ondine", "blinks"]]
["[['r', 'p', '_', 'n', 'n', 'o'], ['u', 'o', 'c', 'o', 'i', 'n'], ['l', 'n', 'h', 'i', 'g', 'e'], ['b', 'd', 'i', 'n', 'k', 's']]", "['pongo', 'urchin', 'ondine', 'blinks']"]
47
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 C and city D 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 D and C, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. Z O F M C K B U D R S J Z 0 0 0 0 0 1 0 0 0 1 0 0 O 0 0 0 0 1 0 0 0 0 0 0 0 F 0 1 0 0 0 0 1 1 1 0 0 0 M 1 0 1 0 0 1 0 0 1 0 0 0 C 0 0 1 0 0 0 0 1 0 1 0 1 K 0 1 0 0 0 0 0 0 1 1 0 0 B 0 0 1 0 1 0 0 1 0 0 1 0 U 1 0 0 1 0 0 0 0 1 1 0 1 D 0 1 0 0 0 1 0 0 0 0 1 0 R 0 0 1 0 0 0 1 0 0 0 1 0 S 0 0 1 1 1 0 0 0 0 1 0 0 J 0 1 0 0 0 0 1 0 1 0 0 0
city_directed_graph
pathfinding
12
["Z", "K", "D", "O", "C", "F", "D", "S", "C"]
9
0.02916431427001953
9
12
15
[[[0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0]], ["Z", "O", "F", "M", "C", "K", "B", "U", "D", "R", "S", "J"], "C", "D"]
[[[0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0]], ["Z", "O", "F", "M", "C", "K", "B", "U", "D", "R", "S", "J"], "Z", "C", "D"]
["[[0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0]]", "['Z', 'O', 'F', 'M', 'C', 'K', 'B', 'U', 'D', 'R', 'S', 'J']", "['Z']", "['C', 'D']"]
47
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [18, 26, 17, 17, 16, 27, 30, 3, 4, 2, 24, 26, 29, 23, 2, 31, 25, 25, 4, 24, 14, 29, 4, 34, 34, 23, 35, 23, 28, 18, 8, 10, 17, 8, 22, 32], such that the sum of the chosen coins adds up to 342. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {27: 14, 14: 1, 18: 3, 22: 9, 10: 8, 3: 2, 32: 20, 35: 16, 8: 3, 30: 20, 25: 18, 4: 3, 28: 12, 26: 16, 29: 2, 24: 20, 16: 6, 17: 3, 31: 9, 2: 2, 23: 17, 34: 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
19
[17, 29, 29, 18, 8, 17, 17, 31, 22, 18, 16, 8, 4, 35, 28, 14, 4, 27]
98
0.0500178337097168
18
36
36
[[18, 26, 17, 17, 16, 27, 30, 3, 4, 2, 24, 26, 29, 23, 2, 31, 25, 25, 4, 24, 14, 29, 4, 34, 34, 23, 35, 23, 28, 18, 8, 10, 17, 8, 22, 32]]
[[18, 26, 17, 17, 16, 27, 30, 3, 4, 2, 24, 26, 29, 23, 2, 31, 25, 25, 4, 24, 14, 29, 4, 34, 34, 23, 35, 23, 28, 18, 8, 10, 17, 8, 22, 32], {"27": 14, "14": 1, "18": 3, "22": 9, "10": 8, "3": 2, "32": 20, "35": 16, "8": 3, "30": 20, "25": 18, "4": 3, "28": 12, "26": 16, "29": 2, "24": 20, "16": 6, "17": 3, "31": 9, "2": 2, "23": 17, "34": 17}, 342]
["[18, 26, 17, 17, 16, 27, 30, 3, 4, 2, 24, 26, 29, 23, 2, 31, 25, 25, 4, 24, 14, 29, 4, 34, 34, 23, 35, 23, 28, 18, 8, 10, 17, 8, 22, 32]", "{27: 14, 14: 1, 18: 3, 22: 9, 10: 8, 3: 2, 32: 20, 35: 16, 8: 3, 30: 20, 25: 18, 4: 3, 28: 12, 26: 16, 29: 2, 24: 20, 16: 6, 17: 3, 31: 9, 2: 2, 23: 17, 34: 17}", "342"]
47
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Red', 'Green', 'Green'], ['Green', 'Blue', 'Red', 'Blue'], ['Red', 'Green', 'Blue', 'Red']]
color_sorting
sorting
8
[[1, 2], [0, 1], [0, 1], [2, 0], [2, 1], [2, 0], [2, 0], [1, 2], [1, 2], [1, 0], [1, 0], [1, 2], [0, 1], [0, 1], [0, 1]]
15
0.9043323993682861
15
6
12
[[["Blue", "Red", "Green", "Green"], ["Green", "Blue", "Red", "Blue"], ["Red", "Green", "Blue", "Red"]], 7]
[[["Blue", "Red", "Green", "Green"], ["Green", "Blue", "Red", "Blue"], ["Red", "Green", "Blue", "Red"]], 7]
["[['Blue', 'Red', 'Green', 'Green'], ['Green', 'Blue', 'Red', 'Blue'], ['Red', 'Green', 'Blue', 'Red']]", "7"]
47
We have a 4x4 numerical grid, with numbers ranging from 27 to 67 (27 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 > fourth or first < second < third < fourth 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: [['27' '37' 'x' 'x'] ['30' 'x' 'x' 'x'] ['32' '44' '53' '61'] ['33' '54' 'x' '64']]
consecutive_grid
underdetermined_system
10
[[0, 2, 38], [0, 3, 39], [1, 1, 40], [1, 2, 41], [1, 3, 42], [3, 2, 55]]
531
0.3982374668121338
6
40
16
["[['27', '37', '', ''], ['30', '', '', ''], ['32', '44', '53', '61'], ['33', '54', '', '64']]", 27, 67]
["[['27', '37', '', ''], ['30', '', '', ''], ['32', '44', '53', '61'], ['33', '54', '', '64']]", 27, 67]
["[['27', '37', '', ''], ['30', '', '', ''], ['32', '44', '53', '61'], ['33', '54', '', '64']]", "27", "67"]
47
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 34 to 60. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 198, 175, None for columns 1 to 2 respectively, and the sums of rows must be None, 201, 190, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 193. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' '46' 'x' 'x'] ['44' 'x' 'x' '53'] ['39' 'x' 'x' 'x'] ['x' 'x' 'x' '38']]
magic_square
underdetermined_system
8
[[0, 0, 35], [0, 2, 34], [0, 3, 37], [1, 1, 48], [1, 2, 56], [2, 1, 59], [2, 2, 49], [2, 3, 43], [3, 0, 41], [3, 1, 45], [3, 2, 36]]
703
98.62403774261475
11
44
9
["[['', '46', '', ''], ['44', '', '', '53'], ['39', '', '', ''], ['', '', '', '38']]", 4, 34, 60]
["[['', '46', '', ''], ['44', '', '', '53'], ['39', '', '', ''], ['', '', '', '38']]", 34, 60, [1, 3], [1, 3], [198, 175], [201, 190], 193]
["[['', '46', '', ''], ['44', '', '', '53'], ['39', '', '', ''], ['', '', '', '38']]", "34", "60", "[None, 198, 175, None]", "[None, 201, 190, None]", "193"]
47
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 4, 1: 6, 2: 8, 3: 2, 4: 4, 5: 7, 6: 7, 7: 5}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], [], ['Red', 'Yellow', 'Black', 'Yellow', 'Green'], ['Red', 'Red', 'Blue', 'Red', 'Black'], [], ['Black', 'Blue', 'Yellow', 'Blue', 'Black'], [], ['Green', 'Green', 'Yellow', 'Blue', 'Green']]
restricted_sorting
sorting
2
[[2, 0], [5, 1], [2, 4], [2, 1], [2, 4], [5, 6], [5, 4], [5, 6], [3, 0], [3, 0], [3, 6], [3, 0], [3, 1], [7, 3], [7, 3], [7, 4], [7, 6], [5, 1], [2, 3], [7, 3]]
92
0.5225863456726074
20
56
20
[[[], [], ["Red", "Yellow", "Black", "Yellow", "Green"], ["Red", "Red", "Blue", "Red", "Black"], [], ["Black", "Blue", "Yellow", "Blue", "Black"], [], ["Green", "Green", "Yellow", "Blue", "Green"]], 5, {"0": 4, "1": 6, "2": 8, "3": 2, "4": 4, "5": 7, "6": 7, "7": 5}]
[[[], [], ["Red", "Yellow", "Black", "Yellow", "Green"], ["Red", "Red", "Blue", "Red", "Black"], [], ["Black", "Blue", "Yellow", "Blue", "Black"], [], ["Green", "Green", "Yellow", "Blue", "Green"]], 5, {"0": 4, "1": 6, "2": 8, "3": 2, "4": 4, "5": 7, "6": 7, "7": 5}, 4]
["[[], [], ['Red', 'Yellow', 'Black', 'Yellow', 'Green'], ['Red', 'Red', 'Blue', 'Red', 'Black'], [], ['Black', 'Blue', 'Yellow', 'Blue', 'Black'], [], ['Green', 'Green', 'Yellow', 'Blue', 'Green']]", "{0: 4, 1: 6, 2: 8, 3: 2, 4: 4, 5: 7, 6: 7, 7: 5}", "5", "4"]
47
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 (4, 11) to his destination workshop at index (6, 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 4, district 2 covering rows 5 to 5, and district 3 covering rows 6 to 11. 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. [5 x x 4 x 12 7 11 8 3 19 x] [x x 6 15 16 x x 4 x 7 8 19] [18 x x 15 x x x 8 4 16 7 9] [x 19 x x x 16 x x 17 15 x 9] [15 8 19 x 4 4 x x x 3 3 10] [18 6 14 5 x 18 19 15 18 19 12 5] [12 x 2 2 6 3 3 8 3 1 x 15] [10 4 x 9 15 3 x 7 x 17 x x] [5 18 x 17 x 17 x x 15 x 18 x] [4 x 16 11 10 3 12 x 11 14 3 x] [x 9 9 14 19 15 x 1 10 19 6 x] [x x 17 4 x 2 x 7 x 4 4 18]
traffic
pathfinding
4
[[4, 11], [4, 10], [4, 9], [5, 9], [6, 9], [6, 8], [6, 7], [6, 6], [6, 5], [6, 4], [6, 3], [6, 2], [5, 2], [5, 1], [5, 0], [6, 0]]
103
0.027801036834716797
16
4
4
[[["5", "x", "x", "4", "x", "12", "7", "11", "8", "3", "19", "x"], ["x", "x", "6", "15", "16", "x", "x", "4", "x", "7", "8", "19"], ["18", "x", "x", "15", "x", "x", "x", "8", "4", "16", "7", "9"], ["x", "19", "x", "x", "x", "16", "x", "x", "17", "15", "x", "9"], ["15", "8", "19", "x", "4", "4", "x", "x", "x", "3", "3", "10"], ["18", "6", "14", "5", "x", "18", "19", "15", "18", "19", "12", "5"], ["12", "x", "2", "2", "6", "3", "3", "8", "3", "1", "x", "15"], ["10", "4", "x", "9", "15", "3", "x", "7", "x", "17", "x", "x"], ["5", "18", "x", "17", "x", "17", "x", "x", "15", "x", "18", "x"], ["4", "x", "16", "11", "10", "3", "12", "x", "11", "14", "3", "x"], ["x", "9", "9", "14", "19", "15", "x", "1", "10", "19", "6", "x"], ["x", "x", "17", "4", "x", "2", "x", "7", "x", "4", "4", "18"]]]
[[["5", "x", "x", "4", "x", "12", "7", "11", "8", "3", "19", "x"], ["x", "x", "6", "15", "16", "x", "x", "4", "x", "7", "8", "19"], ["18", "x", "x", "15", "x", "x", "x", "8", "4", "16", "7", "9"], ["x", "19", "x", "x", "x", "16", "x", "x", "17", "15", "x", "9"], ["15", "8", "19", "x", "4", "4", "x", "x", "x", "3", "3", "10"], ["18", "6", "14", "5", "x", "18", "19", "15", "18", "19", "12", "5"], ["12", "x", "2", "2", "6", "3", "3", "8", "3", "1", "x", "15"], ["10", "4", "x", "9", "15", "3", "x", "7", "x", "17", "x", "x"], ["5", "18", "x", "17", "x", "17", "x", "x", "15", "x", "18", "x"], ["4", "x", "16", "11", "10", "3", "12", "x", "11", "14", "3", "x"], ["x", "9", "9", "14", "19", "15", "x", "1", "10", "19", "6", "x"], ["x", "x", "17", "4", "x", "2", "x", "7", "x", "4", "4", "18"]], [4, 11], [6, 0], 4, 5]
["[['5', 'x', 'x', '4', 'x', '12', '7', '11', '8', '3', '19', 'x'], ['x', 'x', '6', '15', '16', 'x', 'x', '4', 'x', '7', '8', '19'], ['18', 'x', 'x', '15', 'x', 'x', 'x', '8', '4', '16', '7', '9'], ['x', '19', 'x', 'x', 'x', '16', 'x', 'x', '17', '15', 'x', '9'], ['15', '8', '19', 'x', '4', '4', 'x', 'x', 'x', '3', '3', '10'], ['18', '6', '14', '5', 'x', '18', '19', '15', '18', '19', '12', '5'], ['12', 'x', '2', '2', '6', '3', '3', '8', '3', '1', 'x', '15'], ['10', '4', 'x', '9', '15', '3', 'x', '7', 'x', '17', 'x', 'x'], ['5', '18', 'x', '17', 'x', '17', 'x', 'x', '15', 'x', '18', 'x'], ['4', 'x', '16', '11', '10', '3', '12', 'x', '11', '14', '3', 'x'], ['x', '9', '9', '14', '19', '15', 'x', '1', '10', '19', '6', 'x'], ['x', 'x', '17', '4', 'x', '2', 'x', '7', 'x', '4', '4', '18']]", "(4, 11)", "(6, 0)", "4", "5"]
47
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. 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 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (11, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (0, 3). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 1 0 1 1 1 0 1 1 0 1 1 0 1 1 1 0 0 0 1 0 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 1
trampoline_matrix
pathfinding
12
[[11, 9], [10, 8], [9, 7], [8, 7], [7, 7], [6, 7], [5, 7], [4, 7], [3, 7], [2, 7], [1, 6], [0, 5], [0, 4], [0, 3]]
14
0.03473663330078125
14
8
2
["[[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1], [1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1]]", 4]
["[[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1], [1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1]]", [11, 9], [0, 3], 4]
["[[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1], [1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1]]", "(11, 9)", "(0, 3)", "4"]
47
Given 9 labeled water jugs with capacities 141, 101, 126, 26, 120, 75, 110, 108, 97, 100 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 254, 456, 579 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 75, 3], ["+", 126, 3], ["+", 126, 3], ["+", 126, 3], ["+", 126, 3], ["+", 75, 2], ["+", 120, 2], ["+", 120, 2], ["+", 141, 2], ["+", 108, 1], ["+", 120, 1], ["+", 26, 1]]
12
0.051166534423828125
12
60
3
[[141, 101, 126, 26, 120, 75, 110, 108, 97, 100], [254, 456, 579]]
[[141, 101, 126, 26, 120, 75, 110, 108, 97, 100], [254, 456, 579]]
["[141, 101, 126, 26, 120, 75, 110, 108, 97, 100]", "[254, 456, 579]"]
48
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: [[79, 98, 87, 83], [56, 76, 65, 91], [25, '_', 36, 70]]
8_puzzle
puzzle
5
[25, 56, 76, 25, 36, 65, 91, 83, 87, 91, 25, 76, 79, 98, 91, 87, 83, 70, 65, 25, 70, 65]
22
0.1393580436706543
22
4
12
[[[79, 98, 87, 83], [56, 76, 65, 91], [25, "_", 36, 70]]]
[[[79, 98, 87, 83], [56, 76, 65, 91], [25, "_", 36, 70]]]
["[[79, 98, 87, 83], [56, 76, 65, 91], [25, '_', 36, 70]]"]
48
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: added, althea, indign, patron The initial board: [['l', 'a', 'd', 'd', 'e', 'd'], ['a', 'h', 't', 'g', 'e', 'a'], ['_', 'n', 'd', 'i', 'r', 'n'], ['p', 'a', 't', 'i', 'o', 'n']]
8_puzzle_words
puzzle
3
["down-right", "up-right", "down-right", "up-right", "up-left", "up-left", "down-left", "down-right", "down-left", "up-left", "up-right", "down-right", "up-right", "up-left", "down-left", "up-left"]
16
0.18565845489501953
16
4
24
[[["l", "a", "d", "d", "e", "d"], ["a", "h", "t", "g", "e", "a"], ["_", "n", "d", "i", "r", "n"], ["p", "a", "t", "i", "o", "n"]]]
[[["l", "a", "d", "d", "e", "d"], ["a", "h", "t", "g", "e", "a"], ["_", "n", "d", "i", "r", "n"], ["p", "a", "t", "i", "o", "n"]], ["added", "althea", "indign", "patron"]]
["[['l', 'a', 'd', 'd', 'e', 'd'], ['a', 'h', 't', 'g', 'e', 'a'], ['_', 'n', 'd', 'i', 'r', 'n'], ['p', 'a', 't', 'i', 'o', 'n']]", "['added', 'althea', 'indign', 'patron']"]
48
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 'I'. 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. A Q S O N V I X D B E Y A 0 1 1 1 1 0 0 0 0 1 0 0 Q 1 0 0 0 1 0 0 0 0 1 0 0 S 0 1 0 0 1 0 0 0 1 0 0 0 O 0 0 1 0 1 0 0 1 1 0 0 0 N 0 0 0 0 0 1 1 1 0 0 0 0 V 1 1 0 0 0 0 0 0 1 0 0 0 I 0 0 0 0 0 0 0 0 0 0 0 1 X 1 1 0 0 1 0 1 0 0 0 1 0 D 0 1 0 0 1 0 0 1 0 1 0 0 B 0 0 1 1 1 1 1 1 0 0 0 0 E 1 1 1 0 0 1 1 0 1 1 0 0 Y 0 0 1 0 0 1 1 0 0 1 1 0
city_directed_graph
pathfinding
12
["I", "Y", "B", "X", "A", "N", "X", "A"]
8
0.028223037719726562
8
12
15
[[[0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]], ["A", "Q", "S", "O", "N", "V", "I", "X", "D", "B", "E", "Y"], "A", "X"]
[[[0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]], ["A", "Q", "S", "O", "N", "V", "I", "X", "D", "B", "E", "Y"], "I", "A", "X"]
["[[0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]]", "['A', 'Q', 'S', 'O', 'N', 'V', 'I', 'X', 'D', 'B', 'E', 'Y']", "['I']", "['A', 'X']"]
48
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [19, 21, 16, 6, 34, 23, 8, 10, 14, 10, 59, 15, 17, 32, 11, 15, 8, 29, 58, 12, 3, 5, 11, 34, 2, 12, 20, 6, 29, 23, 10, 34, 33, 18], such that the sum of the chosen coins adds up to 355. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {6: 5, 17: 7, 12: 10, 34: 9, 5: 1, 11: 7, 10: 8, 21: 19, 15: 3, 33: 6, 3: 2, 16: 12, 58: 19, 8: 7, 14: 5, 20: 8, 2: 2, 19: 19, 59: 14, 18: 15, 29: 8, 23: 6, 32: 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
[5, 15, 15, 23, 23, 33, 59, 58, 32, 14, 29, 29, 20]
92
0.04211783409118652
13
34
34
[[19, 21, 16, 6, 34, 23, 8, 10, 14, 10, 59, 15, 17, 32, 11, 15, 8, 29, 58, 12, 3, 5, 11, 34, 2, 12, 20, 6, 29, 23, 10, 34, 33, 18]]
[[19, 21, 16, 6, 34, 23, 8, 10, 14, 10, 59, 15, 17, 32, 11, 15, 8, 29, 58, 12, 3, 5, 11, 34, 2, 12, 20, 6, 29, 23, 10, 34, 33, 18], {"6": 5, "17": 7, "12": 10, "34": 9, "5": 1, "11": 7, "10": 8, "21": 19, "15": 3, "33": 6, "3": 2, "16": 12, "58": 19, "8": 7, "14": 5, "20": 8, "2": 2, "19": 19, "59": 14, "18": 15, "29": 8, "23": 6, "32": 5}, 355]
["[19, 21, 16, 6, 34, 23, 8, 10, 14, 10, 59, 15, 17, 32, 11, 15, 8, 29, 58, 12, 3, 5, 11, 34, 2, 12, 20, 6, 29, 23, 10, 34, 33, 18]", "{6: 5, 17: 7, 12: 10, 34: 9, 5: 1, 11: 7, 10: 8, 21: 19, 15: 3, 33: 6, 3: 2, 16: 12, 58: 19, 8: 7, 14: 5, 20: 8, 2: 2, 19: 19, 59: 14, 18: 15, 29: 8, 23: 6, 32: 5}", "355"]
48
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Blue', 'Blue', 'Red'], ['Blue', 'Green', 'Blue', 'Green'], ['Green', 'Red', 'Green', 'Red']]
color_sorting
sorting
8
[[1, 0], [1, 2], [1, 0], [2, 1], [2, 1], [2, 0], [2, 1], [0, 1], [2, 1], [0, 2], [0, 2], [0, 1], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0]]
17
2.2611169815063477
17
6
12
[[["Red", "Blue", "Blue", "Red"], ["Blue", "Green", "Blue", "Green"], ["Green", "Red", "Green", "Red"]], 7]
[[["Red", "Blue", "Blue", "Red"], ["Blue", "Green", "Blue", "Green"], ["Green", "Red", "Green", "Red"]], 7]
["[['Red', 'Blue', 'Blue', 'Red'], ['Blue', 'Green', 'Blue', 'Green'], ['Green', 'Red', 'Green', 'Red']]", "7"]
48
We have a 4x4 numerical grid, with numbers ranging from 40 to 80 (40 included in the range but 80 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth 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' '53' 'x' '79'] ['46' '51' 'x' '78'] ['45' 'x' '73' '77'] ['42' '47' 'x' 'x']]
consecutive_grid
underdetermined_system
10
[[0, 0, 48], [0, 2, 75], [1, 2, 74], [2, 1, 49], [3, 2, 50], [3, 3, 52]]
765
1.6650187969207764
6
40
16
["[['', '53', '', '79'], ['46', '51', '', '78'], ['45', '', '73', '77'], ['42', '47', '', '']]", 40, 80]
["[['', '53', '', '79'], ['46', '51', '', '78'], ['45', '', '73', '77'], ['42', '47', '', '']]", 40, 80]
["[['', '53', '', '79'], ['46', '51', '', '78'], ['45', '', '73', '77'], ['42', '47', '', '']]", "40", "80"]
48
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 34 to 60. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 179, 194, None for columns 1 to 2 respectively, and the sums of rows must be None, 179, 190, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 205. 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' '46' 'x' '41'] ['x' '57' '55' 'x'] ['x' '37' 'x' 'x']]
magic_square
underdetermined_system
8
[[0, 0, 34], [0, 1, 39], [0, 2, 40], [0, 3, 43], [1, 0, 38], [1, 2, 54], [2, 0, 36], [2, 3, 42], [3, 0, 51], [3, 2, 45], [3, 3, 35]]
693
68.24673676490784
11
44
9
["[['', '', '', ''], ['', '46', '', '41'], ['', '57', '55', ''], ['', '37', '', '']]", 4, 34, 60]
["[['', '', '', ''], ['', '46', '', '41'], ['', '57', '55', ''], ['', '37', '', '']]", 34, 60, [1, 3], [1, 3], [179, 194], [179, 190], 205]
["[['', '', '', ''], ['', '46', '', '41'], ['', '57', '55', ''], ['', '37', '', '']]", "34", "60", "[None, 179, 194, None]", "[None, 179, 190, None]", "205"]
48
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 2, 1: 4, 2: 5, 3: 2, 4: 2, 5: 3, 6: 2, 7: 5}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], ['Green', 'Blue', 'Yellow', 'Black', 'Blue'], [], [], ['Blue', 'Black', 'Green', 'Yellow', 'Red'], [], ['Green', 'Red', 'Black', 'Yellow', 'Blue'], ['Red', 'Green', 'Red', 'Black', 'Yellow']]
restricted_sorting
sorting
2
[[1, 0], [4, 3], [6, 0], [4, 5], [4, 0], [4, 2], [6, 4], [6, 5], [7, 4], [7, 0], [7, 4], [7, 5], [6, 2], [1, 3], [1, 2], [1, 5], [7, 2], [1, 3], [6, 3]]
54
0.07503151893615723
19
56
20
[[[], ["Green", "Blue", "Yellow", "Black", "Blue"], [], [], ["Blue", "Black", "Green", "Yellow", "Red"], [], ["Green", "Red", "Black", "Yellow", "Blue"], ["Red", "Green", "Red", "Black", "Yellow"]], 5, {"0": 2, "1": 4, "2": 5, "3": 2, "4": 2, "5": 3, "6": 2, "7": 5}]
[[[], ["Green", "Blue", "Yellow", "Black", "Blue"], [], [], ["Blue", "Black", "Green", "Yellow", "Red"], [], ["Green", "Red", "Black", "Yellow", "Blue"], ["Red", "Green", "Red", "Black", "Yellow"]], 5, {"0": 2, "1": 4, "2": 5, "3": 2, "4": 2, "5": 3, "6": 2, "7": 5}, 4]
["[[], ['Green', 'Blue', 'Yellow', 'Black', 'Blue'], [], [], ['Blue', 'Black', 'Green', 'Yellow', 'Red'], [], ['Green', 'Red', 'Black', 'Yellow', 'Blue'], ['Red', 'Green', 'Red', 'Black', 'Yellow']]", "{0: 2, 1: 4, 2: 5, 3: 2, 4: 2, 5: 3, 6: 2, 7: 5}", "5", "4"]
48
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 3) to his destination workshop at index (8, 11), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 2, district 2 covering rows 3 to 7, and district 3 covering rows 8 to 11. 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 x x 1 1 x x x x x x x] [11 9 17 x 14 3 x 13 x x 6 x] [x 5 x x 10 13 13 19 10 x 1 12] [6 x x 17 5 6 17 4 5 x 1 x] [4 11 1 x x x 14 7 19 4 x 6] [x x 6 18 x x x 5 8 2 1 x] [19 19 10 9 19 19 x 6 x 1 14 11] [x x x 18 11 x 7 5 15 13 1 11] [x 4 x 8 x 11 x x 9 x x 15] [10 8 10 2 x x x x x 12 x 17] [19 x 3 11 x x 9 3 15 x 5 17] [18 x x x 11 14 x 14 13 x x 8]
traffic
pathfinding
4
[[3, 3], [3, 4], [2, 4], [3, 4], [3, 5], [3, 6], [3, 7], [4, 7], [5, 7], [5, 8], [5, 9], [6, 9], [7, 9], [7, 10], [7, 11], [8, 11]]
110
0.02734541893005371
16
4
4
[[["10", "x", "x", "1", "1", "x", "x", "x", "x", "x", "x", "x"], ["11", "9", "17", "x", "14", "3", "x", "13", "x", "x", "6", "x"], ["x", "5", "x", "x", "10", "13", "13", "19", "10", "x", "1", "12"], ["6", "x", "x", "17", "5", "6", "17", "4", "5", "x", "1", "x"], ["4", "11", "1", "x", "x", "x", "14", "7", "19", "4", "x", "6"], ["x", "x", "6", "18", "x", "x", "x", "5", "8", "2", "1", "x"], ["19", "19", "10", "9", "19", "19", "x", "6", "x", "1", "14", "11"], ["x", "x", "x", "18", "11", "x", "7", "5", "15", "13", "1", "11"], ["x", "4", "x", "8", "x", "11", "x", "x", "9", "x", "x", "15"], ["10", "8", "10", "2", "x", "x", "x", "x", "x", "12", "x", "17"], ["19", "x", "3", "11", "x", "x", "9", "3", "15", "x", "5", "17"], ["18", "x", "x", "x", "11", "14", "x", "14", "13", "x", "x", "8"]]]
[[["10", "x", "x", "1", "1", "x", "x", "x", "x", "x", "x", "x"], ["11", "9", "17", "x", "14", "3", "x", "13", "x", "x", "6", "x"], ["x", "5", "x", "x", "10", "13", "13", "19", "10", "x", "1", "12"], ["6", "x", "x", "17", "5", "6", "17", "4", "5", "x", "1", "x"], ["4", "11", "1", "x", "x", "x", "14", "7", "19", "4", "x", "6"], ["x", "x", "6", "18", "x", "x", "x", "5", "8", "2", "1", "x"], ["19", "19", "10", "9", "19", "19", "x", "6", "x", "1", "14", "11"], ["x", "x", "x", "18", "11", "x", "7", "5", "15", "13", "1", "11"], ["x", "4", "x", "8", "x", "11", "x", "x", "9", "x", "x", "15"], ["10", "8", "10", "2", "x", "x", "x", "x", "x", "12", "x", "17"], ["19", "x", "3", "11", "x", "x", "9", "3", "15", "x", "5", "17"], ["18", "x", "x", "x", "11", "14", "x", "14", "13", "x", "x", "8"]], [3, 3], [8, 11], 2, 7]
["[['10', 'x', 'x', '1', '1', 'x', 'x', 'x', 'x', 'x', 'x', 'x'], ['11', '9', '17', 'x', '14', '3', 'x', '13', 'x', 'x', '6', 'x'], ['x', '5', 'x', 'x', '10', '13', '13', '19', '10', 'x', '1', '12'], ['6', 'x', 'x', '17', '5', '6', '17', '4', '5', 'x', '1', 'x'], ['4', '11', '1', 'x', 'x', 'x', '14', '7', '19', '4', 'x', '6'], ['x', 'x', '6', '18', 'x', 'x', 'x', '5', '8', '2', '1', 'x'], ['19', '19', '10', '9', '19', '19', 'x', '6', 'x', '1', '14', '11'], ['x', 'x', 'x', '18', '11', 'x', '7', '5', '15', '13', '1', '11'], ['x', '4', 'x', '8', 'x', '11', 'x', 'x', '9', 'x', 'x', '15'], ['10', '8', '10', '2', 'x', 'x', 'x', 'x', 'x', '12', 'x', '17'], ['19', 'x', '3', '11', 'x', 'x', '9', '3', '15', 'x', '5', '17'], ['18', 'x', 'x', 'x', '11', '14', 'x', '14', '13', 'x', 'x', '8']]", "(3, 3)", "(8, 11)", "2", "7"]
48
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. 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 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (0, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (10, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 1 0 1 0 0 0 0 0 1 1 1 1 1 1 0 1 0 0 0 0 1 1 0 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 1 1 1 1 0 1 0 0 1 0 0 1 0 1 1 1 0 1 0 1 0 0 1 1 0 1 1 1 1 1 1 0 0 1 1 1 0 1 0 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 1 1 1 0 0 0 1 0
trampoline_matrix
pathfinding
12
[[0, 9], [1, 8], [2, 7], [3, 6], [3, 5], [3, 4], [3, 3], [4, 3], [5, 3], [6, 3], [6, 2], [7, 2], [7, 1], [8, 1], [9, 1], [10, 0]]
16
0.024382352828979492
16
8
2
["[[1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0], [1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0], [1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0]]", 4]
["[[1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0], [1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0], [1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0]]", [0, 9], [10, 0], 4]
["[[1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0], [1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0], [1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0]]", "(0, 9)", "(10, 0)", "4"]
48
Given 9 labeled water jugs with capacities 121, 87, 150, 52, 43, 139, 90, 44, 59, 146 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 249, 446, 530 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 43, 3], ["+", 146, 3], ["+", 150, 3], ["+", 52, 3], ["+", 139, 3], ["+", 146, 2], ["+", 150, 2], ["+", 150, 2], ["+", 59, 1], ["+", 146, 1], ["+", 44, 1]]
11
0.052127838134765625
11
60
3
[[121, 87, 150, 52, 43, 139, 90, 44, 59, 146], [249, 446, 530]]
[[121, 87, 150, 52, 43, 139, 90, 44, 59, 146], [249, 446, 530]]
["[121, 87, 150, 52, 43, 139, 90, 44, 59, 146]", "[249, 446, 530]"]
49
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: [[82, '_', 39, 54], [55, 62, 53, 35], [69, 16, 11, 71]]
8_puzzle
puzzle
6
[62, 53, 35, 71, 11, 35, 53, 16, 35, 53, 71, 54, 39, 62, 82, 55, 69, 35, 16, 69, 55, 82, 69, 71, 54, 39, 62, 69, 71, 54, 53, 11]
32
0.6614413261413574
32
4
12
[[[82, "_", 39, 54], [55, 62, 53, 35], [69, 16, 11, 71]]]
[[[82, "_", 39, 54], [55, 62, 53, 35], [69, 16, 11, 71]]]
["[[82, '_', 39, 54], [55, 62, 53, 35], [69, 16, 11, 71]]"]
49
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: leath, fanman, tragic, carone The initial board: [['a', 'l', 'o', 'a', 'm', 'h'], ['f', 'e', 'n', 'n', 'a', 't'], ['t', 'r', 'a', 'g', '_', 'c'], ['c', 'i', 'r', 'a', 'n', 'e']]
8_puzzle_words
puzzle
3
["up-left", "down-left", "down-left", "up-left", "up-right", "up-right", "down-right", "up-right", "down-right", "down-left", "down-left", "up-left", "up-left", "up-right", "down-right", "down-right", "down-left", "up-left", "up-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left"]
26
1.3822917938232422
26
4
24
[[["a", "l", "o", "a", "m", "h"], ["f", "e", "n", "n", "a", "t"], ["t", "r", "a", "g", "_", "c"], ["c", "i", "r", "a", "n", "e"]]]
[[["a", "l", "o", "a", "m", "h"], ["f", "e", "n", "n", "a", "t"], ["t", "r", "a", "g", "_", "c"], ["c", "i", "r", "a", "n", "e"]], ["leath", "fanman", "tragic", "carone"]]
["[['a', 'l', 'o', 'a', 'm', 'h'], ['f', 'e', 'n', 'n', 'a', 't'], ['t', 'r', 'a', 'g', '_', 'c'], ['c', 'i', 'r', 'a', 'n', 'e']]", "['leath', 'fanman', 'tragic', 'carone']"]
49
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'E'. Our task is to visit city R and city D 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 D and R, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. W D R A Y F C S N E K Q W 0 0 0 0 1 0 0 0 0 0 1 1 D 0 0 0 1 0 0 0 0 0 1 0 0 R 1 0 0 0 0 0 1 0 0 0 0 0 A 0 1 1 0 1 0 0 1 1 0 0 0 Y 0 0 0 0 0 0 0 0 0 0 0 1 F 1 0 1 0 0 0 0 1 0 0 0 0 C 0 1 0 0 1 1 0 1 1 1 0 1 S 1 1 0 0 1 0 0 0 1 0 0 0 N 0 1 1 1 0 1 0 0 0 0 0 0 E 0 0 0 0 0 0 0 0 0 0 1 0 K 0 0 0 1 0 1 0 0 1 0 0 0 Q 0 1 0 1 0 0 0 1 1 1 0 0
city_directed_graph
pathfinding
12
["E", "K", "F", "R", "C", "D", "A", "R", "W", "Q", "D"]
11
0.03518843650817871
11
12
15
[[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1], [1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0]], ["W", "D", "R", "A", "Y", "F", "C", "S", "N", "E", "K", "Q"], "R", "D"]
[[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1], [1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0]], ["W", "D", "R", "A", "Y", "F", "C", "S", "N", "E", "K", "Q"], "E", "R", "D"]
["[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1], [1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0]]", "['W', 'D', 'R', 'A', 'Y', 'F', 'C', 'S', 'N', 'E', 'K', 'Q']", "['E']", "['R', 'D']"]
49
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [18, 20, 11, 6, 81, 3, 9, 5, 14, 19, 30, 2, 19, 3, 9, 22, 21, 29, 6, 25, 10, 18, 27, 26, 25, 13, 15, 16, 3, 5, 23, 26, 25, 31, 15, 12], such that the sum of the chosen coins adds up to 324. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {11: 6, 6: 3, 16: 11, 23: 16, 18: 3, 31: 4, 9: 2, 3: 1, 22: 10, 10: 1, 30: 4, 81: 14, 2: 1, 14: 1, 13: 11, 15: 7, 19: 16, 25: 6, 12: 12, 29: 11, 26: 9, 5: 1, 27: 15, 20: 7, 21: 14}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
21
[3, 5, 5, 31, 30, 18, 81, 18, 10, 2, 3, 25, 25, 25, 14, 29]
64
0.04390406608581543
16
36
36
[[18, 20, 11, 6, 81, 3, 9, 5, 14, 19, 30, 2, 19, 3, 9, 22, 21, 29, 6, 25, 10, 18, 27, 26, 25, 13, 15, 16, 3, 5, 23, 26, 25, 31, 15, 12]]
[[18, 20, 11, 6, 81, 3, 9, 5, 14, 19, 30, 2, 19, 3, 9, 22, 21, 29, 6, 25, 10, 18, 27, 26, 25, 13, 15, 16, 3, 5, 23, 26, 25, 31, 15, 12], {"11": 6, "6": 3, "16": 11, "23": 16, "18": 3, "31": 4, "9": 2, "3": 1, "22": 10, "10": 1, "30": 4, "81": 14, "2": 1, "14": 1, "13": 11, "15": 7, "19": 16, "25": 6, "12": 12, "29": 11, "26": 9, "5": 1, "27": 15, "20": 7, "21": 14}, 324]
["[18, 20, 11, 6, 81, 3, 9, 5, 14, 19, 30, 2, 19, 3, 9, 22, 21, 29, 6, 25, 10, 18, 27, 26, 25, 13, 15, 16, 3, 5, 23, 26, 25, 31, 15, 12]", "{11: 6, 6: 3, 16: 11, 23: 16, 18: 3, 31: 4, 9: 2, 3: 1, 22: 10, 10: 1, 30: 4, 81: 14, 2: 1, 14: 1, 13: 11, 15: 7, 19: 16, 25: 6, 12: 12, 29: 11, 26: 9, 5: 1, 27: 15, 20: 7, 21: 14}", "324"]
49
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Blue', 'Blue', 'Green'], ['Green', 'Green', 'Red', 'Blue'], ['Red', 'Red', 'Blue', 'Green']]
color_sorting
sorting
8
[[0, 2], [0, 1], [0, 1], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [1, 0], [1, 0], [1, 2], [1, 2], [1, 2], [0, 1], [0, 1], [0, 1], [2, 0]]
18
2.9103639125823975
18
6
12
[[["Red", "Blue", "Blue", "Green"], ["Green", "Green", "Red", "Blue"], ["Red", "Red", "Blue", "Green"]], 7]
[[["Red", "Blue", "Blue", "Green"], ["Green", "Green", "Red", "Blue"], ["Red", "Red", "Blue", "Green"]], 7]
["[['Red', 'Blue', 'Blue', 'Green'], ['Green', 'Green', 'Red', 'Blue'], ['Red', 'Red', 'Blue', 'Green']]", "7"]
49
We have a 4x4 numerical grid, with numbers ranging from 9 to 49 (9 included in the range but 49 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth 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' '35' '40' '47'] ['x' 'x' '37' '45'] ['18' '24' 'x' 'x'] ['x' '17' 'x' 'x']]
consecutive_grid
underdetermined_system
11
[[1, 0, 21], [1, 1, 25], [2, 2, 26], [2, 3, 27], [3, 0, 9], [3, 2, 19], [3, 3, 20]]
376
36.16464829444885
7
40
16
["[['22', '35', '40', '47'], ['', '', '37', '45'], ['18', '24', '', ''], ['', '17', '', '']]", 9, 49]
["[['22', '35', '40', '47'], ['', '', '37', '45'], ['18', '24', '', ''], ['', '17', '', '']]", 9, 49]
["[['22', '35', '40', '47'], ['', '', '37', '45'], ['18', '24', '', ''], ['', '17', '', '']]", "9", "49"]
49
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 34 to 60. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 165, 155, None for columns 1 to 2 respectively, and the sums of rows must be None, 169, 190, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 201. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['37' 'x' 'x' '56'] ['52' 'x' 'x' 'x'] ['x' '50' 'x' 'x'] ['x' 'x' 'x' '46']]
magic_square
underdetermined_system
7
[[0, 1, 36], [0, 2, 34], [1, 1, 40], [1, 2, 42], [1, 3, 35], [2, 0, 44], [2, 2, 41], [2, 3, 55], [3, 0, 53], [3, 1, 39], [3, 2, 38]]
698
238.42562222480774
11
49
9
["[['37', '', '', '56'], ['52', '', '', ''], ['', '50', '', ''], ['', '', '', '46']]", 4, 34, 60]
["[['37', '', '', '56'], ['52', '', '', ''], ['', '50', '', ''], ['', '', '', '46']]", 34, 60, [1, 3], [1, 3], [165, 155], [169, 190], 201]
["[['37', '', '', '56'], ['52', '', '', ''], ['', '50', '', ''], ['', '', '', '46']]", "34", "60", "[None, 165, 155, None]", "[None, 169, 190, None]", "201"]
49
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 4, 1: 4, 2: 1, 3: 9, 4: 7, 5: 8, 6: 9, 7: 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? [['Black', 'Green', 'Red', 'Yellow', 'Black'], [], ['Blue', 'Red', 'Black', 'Black', 'Yellow'], ['Green', 'Red', 'Yellow', 'Blue', 'Green'], [], [], ['Green', 'Blue', 'Red', 'Yellow', 'Blue'], []]
restricted_sorting
sorting
2
[[3, 4], [3, 7], [3, 5], [3, 1], [3, 4], [0, 3], [0, 4], [0, 7], [0, 5], [6, 4], [2, 1], [2, 7], [6, 1], [6, 7], [2, 0], [2, 0], [3, 0], [6, 2], [6, 1], [5, 2], [5, 2]]
112
12.685235738754272
21
56
20
[[["Black", "Green", "Red", "Yellow", "Black"], [], ["Blue", "Red", "Black", "Black", "Yellow"], ["Green", "Red", "Yellow", "Blue", "Green"], [], [], ["Green", "Blue", "Red", "Yellow", "Blue"], []], 5, {"0": 4, "1": 4, "2": 1, "3": 9, "4": 7, "5": 8, "6": 9, "7": 7}]
[[["Black", "Green", "Red", "Yellow", "Black"], [], ["Blue", "Red", "Black", "Black", "Yellow"], ["Green", "Red", "Yellow", "Blue", "Green"], [], [], ["Green", "Blue", "Red", "Yellow", "Blue"], []], 5, {"0": 4, "1": 4, "2": 1, "3": 9, "4": 7, "5": 8, "6": 9, "7": 7}, 4]
["[['Black', 'Green', 'Red', 'Yellow', 'Black'], [], ['Blue', 'Red', 'Black', 'Black', 'Yellow'], ['Green', 'Red', 'Yellow', 'Blue', 'Green'], [], [], ['Green', 'Blue', 'Red', 'Yellow', 'Blue'], []]", "{0: 4, 1: 4, 2: 1, 3: 9, 4: 7, 5: 8, 6: 9, 7: 7}", "5", "4"]
49
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 11) 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 2, district 2 covering rows 3 to 5, and district 3 covering rows 6 to 11. 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 13 9 x 15 x x 2 13 9 11] [8 x 4 5 13 x x 7 16 x 15 13] [x x x x 3 x 4 3 18 x 11 18] [6 x 14 5 16 x 11 x 3 16 3 3] [15 12 x x 10 3 2 14 x 18 x x] [11 1 2 1 17 15 x 2 x 12 x x] [x x 3 15 16 1 x x x x x x] [x 10 x x x 6 1 8 19 13 7 x] [x x x x x x x x x x x 3] [3 7 12 x 15 x 19 13 17 14 x x] [x x x x 4 4 18 x 5 x x 10] [x x 15 9 13 10 8 4 8 6 7 7]
traffic
pathfinding
4
[[3, 11], [3, 10], [3, 9], [3, 8], [2, 8], [2, 7], [2, 6], [3, 6], [4, 6], [4, 5], [4, 4], [5, 4], [5, 3], [5, 2], [6, 2], [5, 2], [5, 1], [5, 0], [4, 0]]
125
0.027664661407470703
19
4
4
[[["x", "x", "13", "9", "x", "15", "x", "x", "2", "13", "9", "11"], ["8", "x", "4", "5", "13", "x", "x", "7", "16", "x", "15", "13"], ["x", "x", "x", "x", "3", "x", "4", "3", "18", "x", "11", "18"], ["6", "x", "14", "5", "16", "x", "11", "x", "3", "16", "3", "3"], ["15", "12", "x", "x", "10", "3", "2", "14", "x", "18", "x", "x"], ["11", "1", "2", "1", "17", "15", "x", "2", "x", "12", "x", "x"], ["x", "x", "3", "15", "16", "1", "x", "x", "x", "x", "x", "x"], ["x", "10", "x", "x", "x", "6", "1", "8", "19", "13", "7", "x"], ["x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "3"], ["3", "7", "12", "x", "15", "x", "19", "13", "17", "14", "x", "x"], ["x", "x", "x", "x", "4", "4", "18", "x", "5", "x", "x", "10"], ["x", "x", "15", "9", "13", "10", "8", "4", "8", "6", "7", "7"]]]
[[["x", "x", "13", "9", "x", "15", "x", "x", "2", "13", "9", "11"], ["8", "x", "4", "5", "13", "x", "x", "7", "16", "x", "15", "13"], ["x", "x", "x", "x", "3", "x", "4", "3", "18", "x", "11", "18"], ["6", "x", "14", "5", "16", "x", "11", "x", "3", "16", "3", "3"], ["15", "12", "x", "x", "10", "3", "2", "14", "x", "18", "x", "x"], ["11", "1", "2", "1", "17", "15", "x", "2", "x", "12", "x", "x"], ["x", "x", "3", "15", "16", "1", "x", "x", "x", "x", "x", "x"], ["x", "10", "x", "x", "x", "6", "1", "8", "19", "13", "7", "x"], ["x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "3"], ["3", "7", "12", "x", "15", "x", "19", "13", "17", "14", "x", "x"], ["x", "x", "x", "x", "4", "4", "18", "x", "5", "x", "x", "10"], ["x", "x", "15", "9", "13", "10", "8", "4", "8", "6", "7", "7"]], [3, 11], [4, 0], 2, 5]
["[['x', 'x', '13', '9', 'x', '15', 'x', 'x', '2', '13', '9', '11'], ['8', 'x', '4', '5', '13', 'x', 'x', '7', '16', 'x', '15', '13'], ['x', 'x', 'x', 'x', '3', 'x', '4', '3', '18', 'x', '11', '18'], ['6', 'x', '14', '5', '16', 'x', '11', 'x', '3', '16', '3', '3'], ['15', '12', 'x', 'x', '10', '3', '2', '14', 'x', '18', 'x', 'x'], ['11', '1', '2', '1', '17', '15', 'x', '2', 'x', '12', 'x', 'x'], ['x', 'x', '3', '15', '16', '1', 'x', 'x', 'x', 'x', 'x', 'x'], ['x', '10', 'x', 'x', 'x', '6', '1', '8', '19', '13', '7', 'x'], ['x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', '3'], ['3', '7', '12', 'x', '15', 'x', '19', '13', '17', '14', 'x', 'x'], ['x', 'x', 'x', 'x', '4', '4', '18', 'x', '5', 'x', 'x', '10'], ['x', 'x', '15', '9', '13', '10', '8', '4', '8', '6', '7', '7']]", "(3, 11)", "(4, 0)", "2", "5"]
49
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. 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 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (6, 11) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (0, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 0 0 1 1 1 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 0 1 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 1 1 1 0 0 0 1 0 1 1 0 1 0 0 0 1 0 0 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0 1 0 0
trampoline_matrix
pathfinding
12
[[6, 11], [6, 10], [7, 9], [7, 8], [8, 7], [8, 6], [8, 5], [7, 4], [6, 3], [5, 3], [5, 2], [5, 1], [4, 1], [3, 1], [2, 1], [1, 1], [0, 1], [0, 0]]
18
0.025048494338989258
18
8
2
["[[0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1], [0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1], [1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0]]", 4]
["[[0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1], [0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1], [1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0]]", [6, 11], [0, 0], 4]
["[[0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0], [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1], [0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1], [1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0]]", "(6, 11)", "(0, 0)", "4"]
49
Given 9 labeled water jugs with capacities 22, 98, 38, 116, 140, 115, 21, 80, 92, 27 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 279, 488, 578 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 116, 3], ["+", 140, 3], ["+", 92, 3], ["+", 115, 3], ["+", 115, 3], ["+", 92, 2], ["+", 140, 2], ["+", 140, 2], ["+", 116, 2], ["+", 21, 1], ["+", 115, 1], ["+", 116, 1], ["+", 27, 1]]
13
0.04842829704284668
13
60
3
[[22, 98, 38, 116, 140, 115, 21, 80, 92, 27], [279, 488, 578]]
[[22, 98, 38, 116, 140, 115, 21, 80, 92, 27], [279, 488, 578]]
["[22, 98, 38, 116, 140, 115, 21, 80, 92, 27]", "[279, 488, 578]"]
50
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: [[25, 94, 12, '_'], [70, 43, 47, 85], [86, 64, 52, 92]]
8_puzzle
puzzle
6
[85, 47, 12, 94, 25, 70, 43, 64, 86, 43, 64, 12, 52, 92, 47, 52, 92, 86, 12, 25, 94, 92, 86, 12, 25, 64, 70, 94, 92, 86, 52, 47]
32
0.6588661670684814
32
4
12
[[[25, 94, 12, "_"], [70, 43, 47, 85], [86, 64, 52, 92]]]
[[[25, 94, 12, "_"], [70, 43, 47, 85], [86, 64, 52, 92]]]
["[[25, 94, 12, '_'], [70, 43, 47, 85], [86, 64, 52, 92]]"]
50
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: humus, bywork, cereus, clarty The initial board: [['y', 'h', 'r', 'm', '_', 's'], ['b', 'o', 'w', 'k', 'r', 'u'], ['r', 'e', 'l', 'e', 'u', 's'], ['c', 'c', 'a', 'u', 't', 'y']]
8_puzzle_words
puzzle
3
["down-left", "down-right", "up-right", "up-left", "down-left", "up-left", "down-left", "down-left", "down-right", "up-right", "up-left", "up-right", "down-right", "down-right", "down-left", "up-left", "up-left", "up-right", "down-right", "down-left", "up-left", "up-left"]
22
0.46178436279296875
22
4
24
[[["y", "h", "r", "m", "_", "s"], ["b", "o", "w", "k", "r", "u"], ["r", "e", "l", "e", "u", "s"], ["c", "c", "a", "u", "t", "y"]]]
[[["y", "h", "r", "m", "_", "s"], ["b", "o", "w", "k", "r", "u"], ["r", "e", "l", "e", "u", "s"], ["c", "c", "a", "u", "t", "y"]], ["humus", "bywork", "cereus", "clarty"]]
["[['y', 'h', 'r', 'm', '_', 's'], ['b', 'o', 'w', 'k', 'r', 'u'], ['r', 'e', 'l', 'e', 'u', 's'], ['c', 'c', 'a', 'u', 't', 'y']]", "['humus', 'bywork', 'cereus', 'clarty']"]
50
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'E'. Our task is to visit city O 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 O, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. I E A G V K B N F W J O I 0 0 1 0 0 0 0 0 0 0 0 0 E 1 0 0 0 1 0 0 0 0 0 0 0 A 1 1 0 0 0 1 1 0 0 0 0 1 G 0 0 0 0 0 1 0 1 0 0 0 0 V 0 1 1 0 0 0 0 1 0 1 0 0 K 1 0 0 0 0 0 1 0 0 0 0 0 B 1 0 0 0 0 0 0 0 1 0 0 0 N 1 0 1 0 0 0 0 0 0 0 0 0 F 0 0 0 1 0 1 0 1 0 0 0 0 W 1 1 0 0 1 0 0 0 0 0 0 1 J 0 0 0 1 0 1 0 0 0 0 0 1 O 1 0 1 0 0 1 0 1 1 1 1 0
city_directed_graph
pathfinding
12
["E", "V", "N", "A", "O", "J", "O", "N"]
8
0.029204368591308594
8
12
15
[[[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0]], ["I", "E", "A", "G", "V", "K", "B", "N", "F", "W", "J", "O"], "O", "N"]
[[[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0]], ["I", "E", "A", "G", "V", "K", "B", "N", "F", "W", "J", "O"], "E", "O", "N"]
["[[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0]]", "['I', 'E', 'A', 'G', 'V', 'K', 'B', 'N', 'F', 'W', 'J', 'O']", "['E']", "['O', 'N']"]
50
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [19, 14, 29, 19, 29, 9, 17, 16, 25, 7, 8, 2, 23, 11, 28, 6, 29, 16, 19, 31, 30, 15, 7, 16, 23, 23, 10, 32, 8, 14, 7, 9, 6, 23, 77, 24, 22, 24, 22], such that the sum of the chosen coins adds up to 351. 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, 29: 12, 19: 3, 30: 18, 14: 2, 77: 3, 6: 5, 17: 1, 32: 16, 9: 8, 22: 15, 31: 17, 25: 10, 24: 1, 28: 11, 2: 2, 7: 4, 8: 7, 11: 7, 23: 19, 10: 2, 16: 2}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
22
[24, 77, 24, 16, 14, 10, 19, 16, 19, 16, 14, 19, 2, 7, 17, 29, 28]
56
0.05440521240234375
17
39
39
[[19, 14, 29, 19, 29, 9, 17, 16, 25, 7, 8, 2, 23, 11, 28, 6, 29, 16, 19, 31, 30, 15, 7, 16, 23, 23, 10, 32, 8, 14, 7, 9, 6, 23, 77, 24, 22, 24, 22]]
[[19, 14, 29, 19, 29, 9, 17, 16, 25, 7, 8, 2, 23, 11, 28, 6, 29, 16, 19, 31, 30, 15, 7, 16, 23, 23, 10, 32, 8, 14, 7, 9, 6, 23, 77, 24, 22, 24, 22], {"15": 6, "29": 12, "19": 3, "30": 18, "14": 2, "77": 3, "6": 5, "17": 1, "32": 16, "9": 8, "22": 15, "31": 17, "25": 10, "24": 1, "28": 11, "2": 2, "7": 4, "8": 7, "11": 7, "23": 19, "10": 2, "16": 2}, 351]
["[19, 14, 29, 19, 29, 9, 17, 16, 25, 7, 8, 2, 23, 11, 28, 6, 29, 16, 19, 31, 30, 15, 7, 16, 23, 23, 10, 32, 8, 14, 7, 9, 6, 23, 77, 24, 22, 24, 22]", "{15: 6, 29: 12, 19: 3, 30: 18, 14: 2, 77: 3, 6: 5, 17: 1, 32: 16, 9: 8, 22: 15, 31: 17, 25: 10, 24: 1, 28: 11, 2: 2, 7: 4, 8: 7, 11: 7, 23: 19, 10: 2, 16: 2}", "351"]
50
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Green', 'Red', 'Red'], ['Red', 'Blue', 'Green', 'Red'], ['Blue', 'Blue', 'Green', 'Green']]
color_sorting
sorting
8
[[0, 2], [0, 2], [1, 0], [1, 2], [1, 0], [1, 0], [2, 1], [2, 0], [2, 1], [2, 1], [2, 1], [0, 2], [0, 1], [0, 2], [1, 0]]
15
0.6902930736541748
15
6
12
[[["Blue", "Green", "Red", "Red"], ["Red", "Blue", "Green", "Red"], ["Blue", "Blue", "Green", "Green"]], 7]
[[["Blue", "Green", "Red", "Red"], ["Red", "Blue", "Green", "Red"], ["Blue", "Blue", "Green", "Green"]], 7]
["[['Blue', 'Green', 'Red', 'Red'], ['Red', 'Blue', 'Green', 'Red'], ['Blue', 'Blue', 'Green', 'Green']]", "7"]
50
We have a 4x4 numerical grid, with numbers ranging from 36 to 76 (36 included in the range but 76 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth 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' '60'] ['47' 'x' '62' '65'] ['x' '58' '67' '68'] ['54' 'x' '74' 'x']]
consecutive_grid
underdetermined_system
11
[[0, 0, 36], [0, 1, 37], [0, 2, 38], [1, 1, 48], [2, 0, 49], [3, 1, 59], [3, 3, 75]]
665
72.83584880828857
7
40
16
["[['', '', '', '60'], ['47', '', '62', '65'], ['', '58', '67', '68'], ['54', '', '74', '']]", 36, 76]
["[['', '', '', '60'], ['47', '', '62', '65'], ['', '58', '67', '68'], ['54', '', '74', '']]", 36, 76]
["[['', '', '', '60'], ['47', '', '62', '65'], ['', '58', '67', '68'], ['54', '', '74', '']]", "36", "76"]
50
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 9 to 40. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 77, 110, None for columns 1 to 2 respectively, and the sums of rows must be None, 114, 84, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 98. 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' '39'] ['28' 'x' 'x' 'x'] ['x' '11' '33' 'x'] ['18' '20' '38' '35']]
magic_square
underdetermined_system
7
[[0, 0, 10], [0, 1, 12], [0, 2, 9], [1, 1, 34], [1, 2, 30], [1, 3, 22], [2, 0, 13], [2, 3, 27]]
379
0.18021273612976074
8
49
9
["[['', '', '', '39'], ['28', '', '', ''], ['', '11', '33', ''], ['18', '20', '38', '35']]", 4, 9, 40]
["[['', '', '', '39'], ['28', '', '', ''], ['', '11', '33', ''], ['18', '20', '38', '35']]", 9, 40, [1, 3], [1, 3], [77, 110], [114, 84], 98]
["[['', '', '', '39'], ['28', '', '', ''], ['', '11', '33', ''], ['18', '20', '38', '35']]", "9", "40", "[None, 77, 110, None]", "[None, 114, 84, None]", "98"]
50
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 1, 1: 3, 2: 3, 3: 8, 4: 7, 5: 9, 6: 8, 7: 8}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], [], ['Blue', 'Green', 'Black', 'Blue', 'Red'], ['Green', 'Red', 'Blue', 'Black', 'Blue'], [], ['Red', 'Green', 'Yellow', 'Yellow', 'Black'], ['Green', 'Black', 'Red', 'Yellow', 'Yellow'], []]
restricted_sorting
sorting
2
[[5, 7], [5, 4], [6, 4], [6, 1], [6, 7], [5, 6], [5, 6], [3, 4], [2, 0], [2, 4], [2, 1], [2, 0], [3, 2], [5, 1], [7, 2], [7, 2], [3, 0], [3, 1], [3, 0]]
85
8.27693510055542
19
56
20
[[[], [], ["Blue", "Green", "Black", "Blue", "Red"], ["Green", "Red", "Blue", "Black", "Blue"], [], ["Red", "Green", "Yellow", "Yellow", "Black"], ["Green", "Black", "Red", "Yellow", "Yellow"], []], 5, {"0": 1, "1": 3, "2": 3, "3": 8, "4": 7, "5": 9, "6": 8, "7": 8}]
[[[], [], ["Blue", "Green", "Black", "Blue", "Red"], ["Green", "Red", "Blue", "Black", "Blue"], [], ["Red", "Green", "Yellow", "Yellow", "Black"], ["Green", "Black", "Red", "Yellow", "Yellow"], []], 5, {"0": 1, "1": 3, "2": 3, "3": 8, "4": 7, "5": 9, "6": 8, "7": 8}, 4]
["[[], [], ['Blue', 'Green', 'Black', 'Blue', 'Red'], ['Green', 'Red', 'Blue', 'Black', 'Blue'], [], ['Red', 'Green', 'Yellow', 'Yellow', 'Black'], ['Green', 'Black', 'Red', 'Yellow', 'Yellow'], []]", "{0: 1, 1: 3, 2: 3, 3: 8, 4: 7, 5: 9, 6: 8, 7: 8}", "5", "4"]
50
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 9) to his destination workshop at index (7, 1), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 6, and district 3 covering rows 7 to 11. 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. [12 17 10 x x x x 9 15 5 x x] [x x x x x 12 20 9 19 8 12 11] [9 x x 2 x 2 1 9 8 14 16 x] [19 x 1 20 7 9 18 x 18 7 x x] [5 2 11 9 x 5 4 16 x 1 x 10] [10 8 8 4 11 11 x x 5 x x x] [15 15 x x 13 5 19 x x 15 x x] [15 16 9 18 x x 16 x x x 5 12] [x x x x x x x x x x x x] [x x 14 14 x x 15 6 6 x x x] [x x x x x 8 14 x 5 x x 15] [x 6 15 x x x x x x 8 x x]
traffic
pathfinding
4
[[3, 9], [2, 9], [2, 8], [2, 7], [2, 6], [2, 5], [3, 5], [4, 5], [5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [6, 1], [7, 1]]
121
0.027498483657836914
15
4
4
[[["12", "17", "10", "x", "x", "x", "x", "9", "15", "5", "x", "x"], ["x", "x", "x", "x", "x", "12", "20", "9", "19", "8", "12", "11"], ["9", "x", "x", "2", "x", "2", "1", "9", "8", "14", "16", "x"], ["19", "x", "1", "20", "7", "9", "18", "x", "18", "7", "x", "x"], ["5", "2", "11", "9", "x", "5", "4", "16", "x", "1", "x", "10"], ["10", "8", "8", "4", "11", "11", "x", "x", "5", "x", "x", "x"], ["15", "15", "x", "x", "13", "5", "19", "x", "x", "15", "x", "x"], ["15", "16", "9", "18", "x", "x", "16", "x", "x", "x", "5", "12"], ["x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x"], ["x", "x", "14", "14", "x", "x", "15", "6", "6", "x", "x", "x"], ["x", "x", "x", "x", "x", "8", "14", "x", "5", "x", "x", "15"], ["x", "6", "15", "x", "x", "x", "x", "x", "x", "8", "x", "x"]]]
[[["12", "17", "10", "x", "x", "x", "x", "9", "15", "5", "x", "x"], ["x", "x", "x", "x", "x", "12", "20", "9", "19", "8", "12", "11"], ["9", "x", "x", "2", "x", "2", "1", "9", "8", "14", "16", "x"], ["19", "x", "1", "20", "7", "9", "18", "x", "18", "7", "x", "x"], ["5", "2", "11", "9", "x", "5", "4", "16", "x", "1", "x", "10"], ["10", "8", "8", "4", "11", "11", "x", "x", "5", "x", "x", "x"], ["15", "15", "x", "x", "13", "5", "19", "x", "x", "15", "x", "x"], ["15", "16", "9", "18", "x", "x", "16", "x", "x", "x", "5", "12"], ["x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x"], ["x", "x", "14", "14", "x", "x", "15", "6", "6", "x", "x", "x"], ["x", "x", "x", "x", "x", "8", "14", "x", "5", "x", "x", "15"], ["x", "6", "15", "x", "x", "x", "x", "x", "x", "8", "x", "x"]], [3, 9], [7, 1], 3, 6]
["[['12', '17', '10', 'x', 'x', 'x', 'x', '9', '15', '5', 'x', 'x'], ['x', 'x', 'x', 'x', 'x', '12', '20', '9', '19', '8', '12', '11'], ['9', 'x', 'x', '2', 'x', '2', '1', '9', '8', '14', '16', 'x'], ['19', 'x', '1', '20', '7', '9', '18', 'x', '18', '7', 'x', 'x'], ['5', '2', '11', '9', 'x', '5', '4', '16', 'x', '1', 'x', '10'], ['10', '8', '8', '4', '11', '11', 'x', 'x', '5', 'x', 'x', 'x'], ['15', '15', 'x', 'x', '13', '5', '19', 'x', 'x', '15', 'x', 'x'], ['15', '16', '9', '18', 'x', 'x', '16', 'x', 'x', 'x', '5', '12'], ['x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x'], ['x', 'x', '14', '14', 'x', 'x', '15', '6', '6', 'x', 'x', 'x'], ['x', 'x', 'x', 'x', 'x', '8', '14', 'x', '5', 'x', 'x', '15'], ['x', '6', '15', 'x', 'x', 'x', 'x', 'x', 'x', '8', 'x', 'x']]", "(3, 9)", "(7, 1)", "3", "6"]
50
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. 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 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (11, 11) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (0, 6). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 0 1 0 0 0 0 1 1 1 0 1 0 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 1 1 0 0 1 1 1 0 0 1 1 0 1 0 0 1 0 0 0 0 0 1 1 0 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 1 0 1 1 0 0 0 1 1 0 1 0 0 1 1 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0
trampoline_matrix
pathfinding
12
[[11, 11], [10, 10], [9, 10], [8, 9], [7, 9], [6, 9], [5, 9], [4, 9], [3, 9], [2, 8], [1, 7], [1, 6], [0, 6]]
13
0.02417731285095215
13
8
2
["[[1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1], [0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1], [0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0], [1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]]", 4]
["[[1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1], [0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1], [0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0], [1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]]", [11, 11], [0, 6], 4]
["[[1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1], [0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1], [0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0], [1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]]", "(11, 11)", "(0, 6)", "4"]
50
Given 9 labeled water jugs with capacities 137, 147, 73, 131, 91, 94, 72, 31, 103, 78 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 263, 298, 505 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 94, 3], ["+", 137, 3], ["+", 137, 3], ["+", 137, 3], ["+", 73, 2], ["+", 78, 2], ["+", 147, 2], ["+", 91, 1], ["+", 94, 1], ["+", 78, 1]]
10
0.048264265060424805
10
60
3
[[137, 147, 73, 131, 91, 94, 72, 31, 103, 78], [263, 298, 505]]
[[137, 147, 73, 131, 91, 94, 72, 31, 103, 78], [263, 298, 505]]
["[137, 147, 73, 131, 91, 94, 72, 31, 103, 78]", "[263, 298, 505]"]
51
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: [[96, 53, 19, 15], [37, 32, '_', 87], [78, 100, 17, 13]]
8_puzzle
puzzle
6
[32, 37, 78, 100, 17, 32, 37, 78, 100, 17, 32, 37, 78, 53, 19, 15, 87, 78, 15, 19, 96, 100, 53, 15, 19, 87, 78, 19, 37, 32, 15, 37, 32, 13]
34
2.2093515396118164
34
4
12
[[[96, 53, 19, 15], [37, 32, "_", 87], [78, 100, 17, 13]]]
[[[96, 53, 19, 15], [37, 32, "_", 87], [78, 100, 17, 13]]]
["[[96, 53, 19, 15], [37, 32, '_', 87], [78, 100, 17, 13]]"]
51
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: biune, algist, palule, noncon The initial board: [['l', 'b', 'l', 'u', 'i', 'e'], ['a', 't', 'g', 'n', 's', 'c'], ['l', 'a', 'o', 'u', '_', 'e'], ['n', 'i', 'n', 'p', 'o', 'n']]
8_puzzle_words
puzzle
3
["up-left", "up-left", "down-left", "down-left", "down-right", "up-right", "up-right", "up-right", "down-right", "down-left", "up-left", "up-left", "down-left", "down-left", "down-right", "up-right", "down-right", "up-right", "up-left", "up-right", "down-right", "down-left", "up-left", "up-left", "down-left", "down-right", "down-right", "up-right", "up-left", "down-left", "down-left", "up-left", "up-right", "up-left"]
34
10.377072811126709
34
4
24
[[["l", "b", "l", "u", "i", "e"], ["a", "t", "g", "n", "s", "c"], ["l", "a", "o", "u", "_", "e"], ["n", "i", "n", "p", "o", "n"]]]
[[["l", "b", "l", "u", "i", "e"], ["a", "t", "g", "n", "s", "c"], ["l", "a", "o", "u", "_", "e"], ["n", "i", "n", "p", "o", "n"]], ["biune", "algist", "palule", "noncon"]]
["[['l', 'b', 'l', 'u', 'i', 'e'], ['a', 't', 'g', 'n', 's', 'c'], ['l', 'a', 'o', 'u', '_', 'e'], ['n', 'i', 'n', 'p', 'o', 'n']]", "['biune', 'algist', 'palule', 'noncon']"]
51
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 'G'. Our task is to visit city F and city U 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 U and F, 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 C F W I P U B H Q G S O 0 0 0 0 0 0 0 1 0 0 0 0 C 1 0 1 0 0 1 0 0 0 0 0 0 F 1 0 0 0 0 0 1 0 0 1 1 0 W 1 1 0 0 1 0 1 0 0 0 0 0 I 0 1 0 0 0 0 1 1 0 0 1 1 P 0 0 1 1 0 0 0 1 1 0 0 0 U 0 1 0 0 1 0 0 0 0 0 0 0 B 0 0 1 0 0 0 1 0 0 0 0 0 H 0 1 1 1 1 1 0 1 0 0 0 0 Q 0 1 1 0 1 1 0 0 0 0 1 1 G 0 0 0 0 0 1 0 0 0 0 0 0 S 0 1 0 1 0 0 0 0 1 1 0 0
city_directed_graph
pathfinding
12
["G", "P", "F", "U", "C", "F", "U"]
7
0.02801227569580078
7
12
15
[[[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0]], ["O", "C", "F", "W", "I", "P", "U", "B", "H", "Q", "G", "S"], "F", "U"]
[[[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0]], ["O", "C", "F", "W", "I", "P", "U", "B", "H", "Q", "G", "S"], "G", "F", "U"]
["[[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0]]", "['O', 'C', 'F', 'W', 'I', 'P', 'U', 'B', 'H', 'Q', 'G', 'S']", "['G']", "['F', 'U']"]
51
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [31, 83, 19, 4, 13, 27, 13, 18, 21, 24, 9, 3, 2, 30, 16, 14, 31, 29, 27, 23, 18, 8, 32, 3, 3, 25, 17, 8, 32, 5, 2, 28, 30, 26, 25, 12, 12], such that the sum of the chosen coins adds up to 335. 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 {32: 1, 19: 12, 3: 1, 27: 14, 5: 3, 9: 5, 13: 11, 14: 10, 28: 6, 31: 15, 8: 8, 18: 18, 17: 7, 2: 2, 12: 9, 24: 16, 83: 6, 23: 9, 16: 15, 29: 4, 25: 5, 26: 18, 4: 1, 21: 10, 30: 10}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
23
[32, 2, 25, 25, 83, 32, 28, 29, 31, 30, 4, 5, 9]
64
0.050809383392333984
13
37
37
[[31, 83, 19, 4, 13, 27, 13, 18, 21, 24, 9, 3, 2, 30, 16, 14, 31, 29, 27, 23, 18, 8, 32, 3, 3, 25, 17, 8, 32, 5, 2, 28, 30, 26, 25, 12, 12]]
[[31, 83, 19, 4, 13, 27, 13, 18, 21, 24, 9, 3, 2, 30, 16, 14, 31, 29, 27, 23, 18, 8, 32, 3, 3, 25, 17, 8, 32, 5, 2, 28, 30, 26, 25, 12, 12], {"32": 1, "19": 12, "3": 1, "27": 14, "5": 3, "9": 5, "13": 11, "14": 10, "28": 6, "31": 15, "8": 8, "18": 18, "17": 7, "2": 2, "12": 9, "24": 16, "83": 6, "23": 9, "16": 15, "29": 4, "25": 5, "26": 18, "4": 1, "21": 10, "30": 10}, 335]
["[31, 83, 19, 4, 13, 27, 13, 18, 21, 24, 9, 3, 2, 30, 16, 14, 31, 29, 27, 23, 18, 8, 32, 3, 3, 25, 17, 8, 32, 5, 2, 28, 30, 26, 25, 12, 12]", "{32: 1, 19: 12, 3: 1, 27: 14, 5: 3, 9: 5, 13: 11, 14: 10, 28: 6, 31: 15, 8: 8, 18: 18, 17: 7, 2: 2, 12: 9, 24: 16, 83: 6, 23: 9, 16: 15, 29: 4, 25: 5, 26: 18, 4: 1, 21: 10, 30: 10}", "335"]
51
The game of 'Sort It' begins with 3 tubes, each filled with 5 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 8 balls. It is not allowed to place a ball in a tube that already has 8 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Green', 'Green', 'Red', 'Blue', 'Blue'], ['Blue', 'Green', 'Green', 'Red', 'Red'], ['Red', 'Red', 'Blue', 'Green', 'Blue']]
color_sorting
sorting
9
[[1, 2], [1, 0], [1, 0], [2, 0], [2, 1], [2, 1], [0, 1], [2, 1], [2, 0], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [2, 1]]
20
6.3350279331207275
20
6
15
[[["Green", "Green", "Red", "Blue", "Blue"], ["Blue", "Green", "Green", "Red", "Red"], ["Red", "Red", "Blue", "Green", "Blue"]], 8]
[[["Green", "Green", "Red", "Blue", "Blue"], ["Blue", "Green", "Green", "Red", "Red"], ["Red", "Red", "Blue", "Green", "Blue"]], 8]
["[['Green', 'Green', 'Red', 'Blue', 'Blue'], ['Blue', 'Green', 'Green', 'Red', 'Red'], ['Red', 'Red', 'Blue', 'Green', 'Blue']]", "8"]
51
We have a 4x4 numerical grid, with numbers ranging from 20 to 60 (20 included in the range but 60 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth 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' '36' 'x' '55'] ['30' '34' 'x' '56'] ['x' '33' 'x' '57'] ['x' '32' '46' 'x']]
consecutive_grid
underdetermined_system
11
[[0, 0, 31], [0, 2, 37], [1, 2, 38], [2, 0, 21], [2, 2, 39], [3, 0, 20], [3, 3, 58]]
547
4.27742338180542
7
40
16
["[['', '36', '', '55'], ['30', '34', '', '56'], ['', '33', '', '57'], ['', '32', '46', '']]", 20, 60]
["[['', '36', '', '55'], ['30', '34', '', '56'], ['', '33', '', '57'], ['', '32', '46', '']]", 20, 60]
["[['', '36', '', '55'], ['30', '34', '', '56'], ['', '33', '', '57'], ['', '32', '46', '']]", "20", "60"]
51
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 9 to 40. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 102, 100, None for columns 1 to 2 respectively, and the sums of rows must be None, 72, 97, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 46. 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' '27' '9'] ['21' 'x' 'x' '15'] ['x' '16' '31' 'x'] ['11' 'x' '32' 'x']]
magic_square
underdetermined_system
7
[[0, 0, 12], [0, 1, 22], [1, 1, 26], [1, 2, 10], [2, 0, 14], [2, 3, 36], [3, 1, 38], [3, 3, 13]]
333
1.8332746028900146
8
49
9
["[['', '', '27', '9'], ['21', '', '', '15'], ['', '16', '31', ''], ['11', '', '32', '']]", 4, 9, 40]
["[['', '', '27', '9'], ['21', '', '', '15'], ['', '16', '31', ''], ['11', '', '32', '']]", 9, 40, [1, 3], [1, 3], [102, 100], [72, 97], 46]
["[['', '', '27', '9'], ['21', '', '', '15'], ['', '16', '31', ''], ['11', '', '32', '']]", "9", "40", "[None, 102, 100, None]", "[None, 72, 97, None]", "46"]
51
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 7, 1: 8, 2: 2, 3: 8, 4: 9, 5: 6, 6: 8, 7: 1}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], [], [], ['Green', 'Blue', 'Blue', 'Green', 'Black'], ['Red', 'Green', 'Blue', 'Blue', 'Red'], ['Black', 'Black', 'Yellow', 'Red', 'Yellow'], [], ['Yellow', 'Black', 'Green', 'Red', 'Yellow']]
restricted_sorting
sorting
2
[[3, 1], [3, 0], [3, 0], [3, 1], [5, 3], [5, 3], [7, 6], [7, 3], [7, 1], [4, 2], [4, 1], [4, 0], [4, 0], [7, 2], [4, 2], [5, 7], [5, 2], [5, 7], [6, 7]]
103
10.823257684707642
19
56
20
[[[], [], [], ["Green", "Blue", "Blue", "Green", "Black"], ["Red", "Green", "Blue", "Blue", "Red"], ["Black", "Black", "Yellow", "Red", "Yellow"], [], ["Yellow", "Black", "Green", "Red", "Yellow"]], 5, {"0": 7, "1": 8, "2": 2, "3": 8, "4": 9, "5": 6, "6": 8, "7": 1}]
[[[], [], [], ["Green", "Blue", "Blue", "Green", "Black"], ["Red", "Green", "Blue", "Blue", "Red"], ["Black", "Black", "Yellow", "Red", "Yellow"], [], ["Yellow", "Black", "Green", "Red", "Yellow"]], 5, {"0": 7, "1": 8, "2": 2, "3": 8, "4": 9, "5": 6, "6": 8, "7": 1}, 4]
["[[], [], [], ['Green', 'Blue', 'Blue', 'Green', 'Black'], ['Red', 'Green', 'Blue', 'Blue', 'Red'], ['Black', 'Black', 'Yellow', 'Red', 'Yellow'], [], ['Yellow', 'Black', 'Green', 'Red', 'Yellow']]", "{0: 7, 1: 8, 2: 2, 3: 8, 4: 9, 5: 6, 6: 8, 7: 1}", "5", "4"]
51
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, 2) to his destination workshop at index (2, 10), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 5, and district 3 covering rows 6 to 11. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [19 12 x x 2 5 4 13 17 19 x 2] [x 18 x 5 5 x x 8 12 18 x 15] [x 9 4 10 7 20 x 16 20 13 15 x] [8 x x 11 1 19 x 14 6 x 3 x] [10 x 4 8 17 x 18 x 7 x 6 5] [x x 3 1 8 18 x 4 17 x x 13] [x x 6 x x x 14 x x 10 10 x] [x x 15 x x x x x 2 x x x] [x x 5 11 6 1 x 6 14 x x x] [x 1 17 10 15 x 14 6 x x x x] [12 2 x 10 x x 7 x x x x x] [x 9 14 x 9 18 14 x x x 6 x]
traffic
pathfinding
4
[[6, 2], [5, 2], [5, 3], [4, 3], [3, 3], [3, 4], [2, 4], [1, 4], [0, 4], [0, 5], [0, 6], [0, 7], [1, 7], [1, 8], [1, 9], [2, 9], [2, 10]]
126
0.02806711196899414
17
4
4
[[["19", "12", "x", "x", "2", "5", "4", "13", "17", "19", "x", "2"], ["x", "18", "x", "5", "5", "x", "x", "8", "12", "18", "x", "15"], ["x", "9", "4", "10", "7", "20", "x", "16", "20", "13", "15", "x"], ["8", "x", "x", "11", "1", "19", "x", "14", "6", "x", "3", "x"], ["10", "x", "4", "8", "17", "x", "18", "x", "7", "x", "6", "5"], ["x", "x", "3", "1", "8", "18", "x", "4", "17", "x", "x", "13"], ["x", "x", "6", "x", "x", "x", "14", "x", "x", "10", "10", "x"], ["x", "x", "15", "x", "x", "x", "x", "x", "2", "x", "x", "x"], ["x", "x", "5", "11", "6", "1", "x", "6", "14", "x", "x", "x"], ["x", "1", "17", "10", "15", "x", "14", "6", "x", "x", "x", "x"], ["12", "2", "x", "10", "x", "x", "7", "x", "x", "x", "x", "x"], ["x", "9", "14", "x", "9", "18", "14", "x", "x", "x", "6", "x"]]]
[[["19", "12", "x", "x", "2", "5", "4", "13", "17", "19", "x", "2"], ["x", "18", "x", "5", "5", "x", "x", "8", "12", "18", "x", "15"], ["x", "9", "4", "10", "7", "20", "x", "16", "20", "13", "15", "x"], ["8", "x", "x", "11", "1", "19", "x", "14", "6", "x", "3", "x"], ["10", "x", "4", "8", "17", "x", "18", "x", "7", "x", "6", "5"], ["x", "x", "3", "1", "8", "18", "x", "4", "17", "x", "x", "13"], ["x", "x", "6", "x", "x", "x", "14", "x", "x", "10", "10", "x"], ["x", "x", "15", "x", "x", "x", "x", "x", "2", "x", "x", "x"], ["x", "x", "5", "11", "6", "1", "x", "6", "14", "x", "x", "x"], ["x", "1", "17", "10", "15", "x", "14", "6", "x", "x", "x", "x"], ["12", "2", "x", "10", "x", "x", "7", "x", "x", "x", "x", "x"], ["x", "9", "14", "x", "9", "18", "14", "x", "x", "x", "6", "x"]], [6, 2], [2, 10], 1, 5]
["[['19', '12', 'x', 'x', '2', '5', '4', '13', '17', '19', 'x', '2'], ['x', '18', 'x', '5', '5', 'x', 'x', '8', '12', '18', 'x', '15'], ['x', '9', '4', '10', '7', '20', 'x', '16', '20', '13', '15', 'x'], ['8', 'x', 'x', '11', '1', '19', 'x', '14', '6', 'x', '3', 'x'], ['10', 'x', '4', '8', '17', 'x', '18', 'x', '7', 'x', '6', '5'], ['x', 'x', '3', '1', '8', '18', 'x', '4', '17', 'x', 'x', '13'], ['x', 'x', '6', 'x', 'x', 'x', '14', 'x', 'x', '10', '10', 'x'], ['x', 'x', '15', 'x', 'x', 'x', 'x', 'x', '2', 'x', 'x', 'x'], ['x', 'x', '5', '11', '6', '1', 'x', '6', '14', 'x', 'x', 'x'], ['x', '1', '17', '10', '15', 'x', '14', '6', 'x', 'x', 'x', 'x'], ['12', '2', 'x', '10', 'x', 'x', '7', 'x', 'x', 'x', 'x', 'x'], ['x', '9', '14', 'x', '9', '18', '14', 'x', 'x', 'x', '6', 'x']]", "(6, 2)", "(2, 10)", "1", "5"]
51
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. 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 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (1, 11) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (11, 3). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 0 1 1 0 1 1 0 0 1 0 1 1 0 1 1 1 1 1 0 1 1 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 1 1 1 1 0 1 0 1 1 0 0 0 1 0 1 0 1 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 1 1 0 1 1 1 0 0 1 1 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 1 1
trampoline_matrix
pathfinding
12
[[1, 11], [2, 10], [2, 9], [2, 8], [2, 7], [3, 6], [4, 6], [5, 5], [6, 4], [7, 4], [8, 4], [9, 4], [10, 4], [10, 3], [11, 3]]
15
0.0235440731048584
15
8
2
["[[1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0], [0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0], [1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]]", 4]
["[[1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0], [0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0], [1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]]", [1, 11], [11, 3], 4]
["[[1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0], [0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0], [1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]]", "(1, 11)", "(11, 3)", "4"]
51
Given 9 labeled water jugs with capacities 51, 129, 150, 138, 128, 72, 69, 111, 75 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 454, 547, 601 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 128, 3], ["+", 128, 3], ["+", 69, 3], ["+", 138, 3], ["+", 138, 3], ["+", 69, 2], ["+", 128, 2], ["+", 150, 2], ["+", 72, 2], ["+", 128, 2], ["+", 128, 1], ["+", 128, 1], ["+", 69, 1], ["+", 129, 1]]
14
0.07053852081298828
14
54
3
[[51, 129, 150, 138, 128, 72, 69, 111, 75], [454, 547, 601]]
[[51, 129, 150, 138, 128, 72, 69, 111, 75], [454, 547, 601]]
["[51, 129, 150, 138, 128, 72, 69, 111, 75]", "[454, 547, 601]"]
52
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: [[26, 39, 50, 35], ['_', 67, 2, 71], [48, 41, 37, 56]]
8_puzzle
puzzle
6
[67, 2, 71, 56, 37, 41, 2, 71, 50, 35, 56, 50, 35, 39, 26, 67, 71, 35, 41, 2, 35, 26, 67, 71, 48, 35, 26, 41, 39, 56, 50, 37]
32
0.40317821502685547
32
4
12
[[[26, 39, 50, 35], ["_", 67, 2, 71], [48, 41, 37, 56]]]
[[[26, 39, 50, 35], ["_", 67, 2, 71], [48, 41, 37, 56]]]
["[[26, 39, 50, 35], ['_', 67, 2, 71], [48, 41, 37, 56]]"]
52
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: saiph, lierre, accend, evenly The initial board: [['i', 's', 'n', 'i', 'a', 'h'], ['l', 'p', 'e', 'a', 'r', 'c'], ['_', 'c', 'e', 'e', 'n', 'd'], ['e', 'v', 'e', 'r', 'l', 'y']]
8_puzzle_words
puzzle
3
["down-right", "up-right", "up-left", "up-right", "down-right", "up-right", "down-right", "down-left", "down-left", "up-left", "up-right", "up-left", "down-left", "down-right", "down-left", "up-left", "up-right", "up-right", "down-right", "down-right", "down-left", "up-left", "up-left", "up-right", "down-right", "up-right", "down-right", "down-left", "down-left", "up-left", "up-right", "up-right", "down-right", "down-left", "up-left", "up-left", "down-left", "up-left"]
38
29.637394189834595
38
4
24
[[["i", "s", "n", "i", "a", "h"], ["l", "p", "e", "a", "r", "c"], ["_", "c", "e", "e", "n", "d"], ["e", "v", "e", "r", "l", "y"]]]
[[["i", "s", "n", "i", "a", "h"], ["l", "p", "e", "a", "r", "c"], ["_", "c", "e", "e", "n", "d"], ["e", "v", "e", "r", "l", "y"]], ["saiph", "lierre", "accend", "evenly"]]
["[['i', 's', 'n', 'i', 'a', 'h'], ['l', 'p', 'e', 'a', 'r', 'c'], ['_', 'c', 'e', 'e', 'n', 'd'], ['e', 'v', 'e', 'r', 'l', 'y']]", "['saiph', 'lierre', 'accend', 'evenly']"]
52
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 J and city D 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 D and J, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. C L D O A Z M H K R Q N J C 0 0 0 0 1 0 0 0 0 0 0 0 0 L 1 0 0 1 0 0 1 0 1 0 0 0 0 D 1 0 0 0 0 0 0 1 1 0 0 1 1 O 0 0 1 0 1 0 0 0 0 0 0 0 0 A 0 1 0 0 0 0 1 0 0 0 0 0 0 Z 0 0 0 0 0 0 0 1 0 1 0 0 1 M 0 0 0 0 0 0 0 0 0 0 0 0 1 H 0 0 0 1 0 0 0 0 0 0 0 1 0 K 1 0 0 1 0 1 1 0 0 0 1 0 0 R 0 1 1 1 1 0 1 1 1 0 1 0 0 Q 0 1 1 0 1 0 0 1 0 0 0 1 0 N 0 1 1 1 0 1 0 0 1 0 0 0 0 J 0 0 0 0 0 0 0 1 1 1 0 1 0
city_directed_graph
pathfinding
13
["C", "A", "M", "J", "N", "D", "J", "R", "D"]
9
0.023613929748535156
9
13
16
[[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0]], ["C", "L", "D", "O", "A", "Z", "M", "H", "K", "R", "Q", "N", "J"], "J", "D"]
[[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0]], ["C", "L", "D", "O", "A", "Z", "M", "H", "K", "R", "Q", "N", "J"], "C", "J", "D"]
["[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0]]", "['C', 'L', 'D', 'O', 'A', 'Z', 'M', 'H', 'K', 'R', 'Q', 'N', 'J']", "['C']", "['J', 'D']"]
52
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [31, 9, 2, 24, 32, 6, 13, 29, 33, 22, 12, 28, 10, 7, 33, 15, 28, 7, 14, 26, 1, 10, 28, 30, 7, 29, 17, 2, 28, 13, 28, 17, 3, 4, 4, 4, 13, 3, 19, 2, 4, 26, 27, 27, 11, 25, 12], such that the sum of the chosen coins adds up to 337. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {2: 1, 33: 8, 9: 9, 31: 3, 19: 11, 17: 8, 28: 3, 24: 12, 6: 1, 22: 7, 26: 7, 27: 5, 29: 9, 4: 4, 10: 3, 3: 2, 11: 3, 15: 12, 7: 2, 1: 1, 12: 3, 30: 2, 14: 12, 32: 7, 13: 2, 25: 9}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
24
[28, 31, 28, 6, 13, 13, 33, 30, 28, 33, 28, 12, 27, 27]
51
0.062195539474487305
14
47
47
[[31, 9, 2, 24, 32, 6, 13, 29, 33, 22, 12, 28, 10, 7, 33, 15, 28, 7, 14, 26, 1, 10, 28, 30, 7, 29, 17, 2, 28, 13, 28, 17, 3, 4, 4, 4, 13, 3, 19, 2, 4, 26, 27, 27, 11, 25, 12]]
[[31, 9, 2, 24, 32, 6, 13, 29, 33, 22, 12, 28, 10, 7, 33, 15, 28, 7, 14, 26, 1, 10, 28, 30, 7, 29, 17, 2, 28, 13, 28, 17, 3, 4, 4, 4, 13, 3, 19, 2, 4, 26, 27, 27, 11, 25, 12], {"2": 1, "33": 8, "9": 9, "31": 3, "19": 11, "17": 8, "28": 3, "24": 12, "6": 1, "22": 7, "26": 7, "27": 5, "29": 9, "4": 4, "10": 3, "3": 2, "11": 3, "15": 12, "7": 2, "1": 1, "12": 3, "30": 2, "14": 12, "32": 7, "13": 2, "25": 9}, 337]
["[31, 9, 2, 24, 32, 6, 13, 29, 33, 22, 12, 28, 10, 7, 33, 15, 28, 7, 14, 26, 1, 10, 28, 30, 7, 29, 17, 2, 28, 13, 28, 17, 3, 4, 4, 4, 13, 3, 19, 2, 4, 26, 27, 27, 11, 25, 12]", "{2: 1, 33: 8, 9: 9, 31: 3, 19: 11, 17: 8, 28: 3, 24: 12, 6: 1, 22: 7, 26: 7, 27: 5, 29: 9, 4: 4, 10: 3, 3: 2, 11: 3, 15: 12, 7: 2, 1: 1, 12: 3, 30: 2, 14: 12, 32: 7, 13: 2, 25: 9}", "337"]
52
The game of 'Sort It' begins with 3 tubes, each filled with 5 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 8 balls. It is not allowed to place a ball in a tube that already has 8 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Green', 'Green', 'Blue', 'Red', 'Green'], ['Red', 'Red', 'Blue', 'Red', 'Blue'], ['Green', 'Blue', 'Blue', 'Red', 'Green']]
color_sorting
sorting
9
[[2, 1], [0, 1], [0, 1], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 2], [1, 0], [2, 1], [2, 0], [2, 1], [2, 1], [2, 1], [2, 1], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [1, 0], [1, 2]]
25
80.31313681602478
25
6
15
[[["Green", "Green", "Blue", "Red", "Green"], ["Red", "Red", "Blue", "Red", "Blue"], ["Green", "Blue", "Blue", "Red", "Green"]], 8]
[[["Green", "Green", "Blue", "Red", "Green"], ["Red", "Red", "Blue", "Red", "Blue"], ["Green", "Blue", "Blue", "Red", "Green"]], 8]
["[['Green', 'Green', 'Blue', 'Red', 'Green'], ['Red', 'Red', 'Blue', 'Red', 'Blue'], ['Green', 'Blue', 'Blue', 'Red', 'Green']]", "8"]
52
We have a 4x4 numerical grid, with numbers ranging from 22 to 62 (22 included in the range but 62 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth 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: [['43' '48' 'x' 'x'] ['x' 'x' 'x' '58'] ['x' '37' '41' '60'] ['x' '34' 'x' '61']]
consecutive_grid
underdetermined_system
12
[[0, 2, 49], [0, 3, 50], [1, 0, 24], [1, 1, 38], [1, 2, 42], [2, 0, 23], [3, 0, 22], [3, 2, 35]]
602
0.3810865879058838
8
40
16
["[['43', '48', '', ''], ['', '', '', '58'], ['', '37', '41', '60'], ['', '34', '', '61']]", 22, 62]
["[['43', '48', '', ''], ['', '', '', '58'], ['', '37', '41', '60'], ['', '34', '', '61']]", 22, 62]
["[['43', '48', '', ''], ['', '', '', '58'], ['', '37', '41', '60'], ['', '34', '', '61']]", "22", "62"]
52
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 9 to 40. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 121, 107, None for columns 1 to 2 respectively, and the sums of rows must be None, 89, 103, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 102. 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: [['14' '35' 'x' 'x'] ['x' 'x' 'x' '18'] ['x' '31' '27' '21'] ['30' 'x' 'x' '19']]
magic_square
underdetermined_system
7
[[0, 2, 11], [0, 3, 9], [1, 0, 10], [1, 1, 29], [1, 2, 32], [2, 0, 24], [3, 1, 26], [3, 2, 37]]
373
18.999568462371826
8
49
9
["[['14', '35', '', ''], ['', '', '', '18'], ['', '31', '27', '21'], ['30', '', '', '19']]", 4, 9, 40]
["[['14', '35', '', ''], ['', '', '', '18'], ['', '31', '27', '21'], ['30', '', '', '19']]", 9, 40, [1, 3], [1, 3], [121, 107], [89, 103], 102]
["[['14', '35', '', ''], ['', '', '', '18'], ['', '31', '27', '21'], ['30', '', '', '19']]", "9", "40", "[None, 121, 107, None]", "[None, 89, 103, None]", "102"]
52
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 6, 1: 4, 2: 3, 3: 8, 4: 7, 5: 5, 6: 9, 7: 9}, 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', 'Red', 'Blue', 'Black'], ['Red', 'Yellow', 'Blue', 'Yellow', 'Blue'], ['Green', 'Red', 'Black', 'Red', 'Yellow'], [], ['Green', 'Green', 'Black', 'Green', 'Black']]
restricted_sorting
sorting
2
[[5, 2], [4, 1], [7, 2], [7, 2], [5, 1], [5, 0], [5, 1], [4, 5], [7, 0], [7, 2], [3, 6], [3, 5], [3, 1], [3, 6], [4, 6], [4, 5], [4, 6], [3, 0], [7, 0]]
103
0.04401803016662598
19
56
20
[[[], [], [], ["Blue", "Yellow", "Red", "Blue", "Black"], ["Red", "Yellow", "Blue", "Yellow", "Blue"], ["Green", "Red", "Black", "Red", "Yellow"], [], ["Green", "Green", "Black", "Green", "Black"]], 5, {"0": 6, "1": 4, "2": 3, "3": 8, "4": 7, "5": 5, "6": 9, "7": 9}]
[[[], [], [], ["Blue", "Yellow", "Red", "Blue", "Black"], ["Red", "Yellow", "Blue", "Yellow", "Blue"], ["Green", "Red", "Black", "Red", "Yellow"], [], ["Green", "Green", "Black", "Green", "Black"]], 5, {"0": 6, "1": 4, "2": 3, "3": 8, "4": 7, "5": 5, "6": 9, "7": 9}, 4]
["[[], [], [], ['Blue', 'Yellow', 'Red', 'Blue', 'Black'], ['Red', 'Yellow', 'Blue', 'Yellow', 'Blue'], ['Green', 'Red', 'Black', 'Red', 'Yellow'], [], ['Green', 'Green', 'Black', 'Green', 'Black']]", "{0: 6, 1: 4, 2: 3, 3: 8, 4: 7, 5: 5, 6: 9, 7: 9}", "5", "4"]
52
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (8, 1) to his destination workshop at index (5, 11), 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 4, district 2 covering rows 5 to 8, and district 3 covering rows 9 to 11. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x 3 11 7 x x 1 3 x x x 3] [x 10 x x 3 9 7 8 x 2 x 17] [6 16 x 18 10 5 x 6 x x 7 x] [x 10 x 8 13 10 x x x x 6 13] [6 11 3 16 8 15 x x x 13 12 20] [15 x 16 x 17 13 x x 8 6 19 9] [14 10 16 14 x x 10 11 19 15 17 x] [x x x x 18 13 14 19 12 1 3 x] [15 1 3 17 4 18 x 18 2 7 12 x] [19 x 13 17 2 14 8 x x 8 16 x] [x 19 x 15 x 18 x 13 x 13 x x] [7 14 2 x 10 3 x x 2 5 10 x]
traffic
pathfinding
4
[[8, 1], [8, 2], [8, 3], [8, 4], [9, 4], [8, 4], [7, 4], [7, 5], [7, 6], [7, 7], [7, 8], [7, 9], [6, 9], [5, 9], [4, 9], [5, 9], [5, 10], [5, 11]]
175
0.027495384216308594
18
4
4
[[["x", "3", "11", "7", "x", "x", "1", "3", "x", "x", "x", "3"], ["x", "10", "x", "x", "3", "9", "7", "8", "x", "2", "x", "17"], ["6", "16", "x", "18", "10", "5", "x", "6", "x", "x", "7", "x"], ["x", "10", "x", "8", "13", "10", "x", "x", "x", "x", "6", "13"], ["6", "11", "3", "16", "8", "15", "x", "x", "x", "13", "12", "20"], ["15", "x", "16", "x", "17", "13", "x", "x", "8", "6", "19", "9"], ["14", "10", "16", "14", "x", "x", "10", "11", "19", "15", "17", "x"], ["x", "x", "x", "x", "18", "13", "14", "19", "12", "1", "3", "x"], ["15", "1", "3", "17", "4", "18", "x", "18", "2", "7", "12", "x"], ["19", "x", "13", "17", "2", "14", "8", "x", "x", "8", "16", "x"], ["x", "19", "x", "15", "x", "18", "x", "13", "x", "13", "x", "x"], ["7", "14", "2", "x", "10", "3", "x", "x", "2", "5", "10", "x"]]]
[[["x", "3", "11", "7", "x", "x", "1", "3", "x", "x", "x", "3"], ["x", "10", "x", "x", "3", "9", "7", "8", "x", "2", "x", "17"], ["6", "16", "x", "18", "10", "5", "x", "6", "x", "x", "7", "x"], ["x", "10", "x", "8", "13", "10", "x", "x", "x", "x", "6", "13"], ["6", "11", "3", "16", "8", "15", "x", "x", "x", "13", "12", "20"], ["15", "x", "16", "x", "17", "13", "x", "x", "8", "6", "19", "9"], ["14", "10", "16", "14", "x", "x", "10", "11", "19", "15", "17", "x"], ["x", "x", "x", "x", "18", "13", "14", "19", "12", "1", "3", "x"], ["15", "1", "3", "17", "4", "18", "x", "18", "2", "7", "12", "x"], ["19", "x", "13", "17", "2", "14", "8", "x", "x", "8", "16", "x"], ["x", "19", "x", "15", "x", "18", "x", "13", "x", "13", "x", "x"], ["7", "14", "2", "x", "10", "3", "x", "x", "2", "5", "10", "x"]], [8, 1], [5, 11], 4, 8]
["[['x', '3', '11', '7', 'x', 'x', '1', '3', 'x', 'x', 'x', '3'], ['x', '10', 'x', 'x', '3', '9', '7', '8', 'x', '2', 'x', '17'], ['6', '16', 'x', '18', '10', '5', 'x', '6', 'x', 'x', '7', 'x'], ['x', '10', 'x', '8', '13', '10', 'x', 'x', 'x', 'x', '6', '13'], ['6', '11', '3', '16', '8', '15', 'x', 'x', 'x', '13', '12', '20'], ['15', 'x', '16', 'x', '17', '13', 'x', 'x', '8', '6', '19', '9'], ['14', '10', '16', '14', 'x', 'x', '10', '11', '19', '15', '17', 'x'], ['x', 'x', 'x', 'x', '18', '13', '14', '19', '12', '1', '3', 'x'], ['15', '1', '3', '17', '4', '18', 'x', '18', '2', '7', '12', 'x'], ['19', 'x', '13', '17', '2', '14', '8', 'x', 'x', '8', '16', 'x'], ['x', '19', 'x', '15', 'x', '18', 'x', '13', 'x', '13', 'x', 'x'], ['7', '14', '2', 'x', '10', '3', 'x', 'x', '2', '5', '10', 'x']]", "(8, 1)", "(5, 11)", "4", "8"]
52
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. 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 4 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 (1, 11). 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 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 1 1 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 1 0 1 1 0 0 1 0 1 1 0 0 0 1 1 1 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 1 1 1 1 1 0 1 1 1 0
trampoline_matrix
pathfinding
12
[[8, 1], [7, 1], [7, 2], [7, 3], [7, 4], [6, 5], [5, 5], [4, 5], [3, 6], [3, 7], [2, 7], [1, 7], [0, 8], [0, 9], [0, 10], [1, 11]]
16
0.023190736770629883
16
8
2
["[[1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1], [0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0], [1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]]", 4]
["[[1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1], [0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0], [1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]]", [8, 1], [1, 11], 4]
["[[1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1], [0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0], [1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]]", "(8, 1)", "(1, 11)", "4"]
52
Given 9 labeled water jugs with capacities 45, 141, 50, 114, 104, 19, 78, 18, 23, 133 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 253, 337, 385 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 114, 3], ["+", 133, 3], ["+", 133, 3], ["-", 18, 3], ["+", 23, 3], ["+", 45, 2], ["+", 133, 2], ["+", 18, 2], ["+", 141, 2], ["+", 104, 1], ["+", 104, 1], ["+", 45, 1]]
12
0.03950142860412598
12
60
3
[[45, 141, 50, 114, 104, 19, 78, 18, 23, 133], [253, 337, 385]]
[[45, 141, 50, 114, 104, 19, 78, 18, 23, 133], [253, 337, 385]]
["[45, 141, 50, 114, 104, 19, 78, 18, 23, 133]", "[253, 337, 385]"]
53
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: [[38, 98, 84, 33], [63, 30, 61, 93], [73, 89, 85, '_']]
8_puzzle
puzzle
6
[85, 61, 84, 33, 93, 85, 61, 84, 30, 89, 84, 30, 33, 93, 85, 61, 30, 33, 89, 63, 38, 98, 93, 89, 63, 84, 73, 38, 84, 73, 33, 30]
32
0.45055198669433594
32
4
12
[[[38, 98, 84, 33], [63, 30, 61, 93], [73, 89, 85, "_"]]]
[[[38, 98, 84, 33], [63, 30, 61, 93], [73, 89, 85, "_"]]]
["[[38, 98, 84, 33], [63, 30, 61, 93], [73, 89, 85, '_']]"]
53
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: limen, somers, spooky, dogtie The initial board: [['o', 'l', 's', 'm', '_', 'n'], ['s', 'o', 'm', 'e', 'r', 'k'], ['s', 'p', 'i', 'o', 'e', 'y'], ['d', 'o', 'g', 't', 'i', 'e']]
8_puzzle_words
puzzle
3
["down-right", "down-left", "down-left", "up-left", "up-right", "up-left", "down-left", "down-right", "down-right", "up-right", "up-left", "up-right", "down-right", "down-left", "up-left", "down-left", "up-left", "up-right", "down-right", "down-left", "up-left", "up-left"]
22
0.7115309238433838
22
4
24
[[["o", "l", "s", "m", "_", "n"], ["s", "o", "m", "e", "r", "k"], ["s", "p", "i", "o", "e", "y"], ["d", "o", "g", "t", "i", "e"]]]
[[["o", "l", "s", "m", "_", "n"], ["s", "o", "m", "e", "r", "k"], ["s", "p", "i", "o", "e", "y"], ["d", "o", "g", "t", "i", "e"]], ["limen", "somers", "spooky", "dogtie"]]
["[['o', 'l', 's', 'm', '_', 'n'], ['s', 'o', 'm', 'e', 'r', 'k'], ['s', 'p', 'i', 'o', 'e', 'y'], ['d', 'o', 'g', 't', 'i', 'e']]", "['limen', 'somers', 'spooky', 'dogtie']"]
53
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 'A'. Our task is to visit city D and city E excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from E and 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 M F X G A Q O U R N K E D 0 0 0 0 1 0 1 0 0 1 1 1 0 M 1 0 0 0 0 0 0 0 0 0 0 0 1 F 0 0 0 1 0 0 0 1 0 0 0 0 0 X 0 1 0 0 0 0 0 0 0 0 0 1 1 G 0 0 0 0 0 0 0 0 0 1 1 0 0 A 0 0 0 0 1 0 0 0 0 0 1 0 0 Q 0 0 1 0 1 0 0 0 0 0 0 0 0 O 1 1 0 1 0 1 0 0 1 0 0 0 0 U 1 0 1 1 1 0 0 0 0 0 0 0 0 R 0 0 0 0 0 0 0 0 0 0 0 0 1 N 0 0 0 0 0 0 0 0 1 1 0 1 0 K 0 1 1 0 0 0 0 0 1 0 0 0 0 E 1 0 0 0 0 0 0 1 1 0 0 0 0
city_directed_graph
pathfinding
13
["A", "G", "R", "E", "D", "K", "M", "E", "D"]
9
0.030630111694335938
9
13
16
[[[0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0]], ["D", "M", "F", "X", "G", "A", "Q", "O", "U", "R", "N", "K", "E"], "D", "E"]
[[[0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0]], ["D", "M", "F", "X", "G", "A", "Q", "O", "U", "R", "N", "K", "E"], "A", "D", "E"]
["[[0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0]]", "['D', 'M', 'F', 'X', 'G', 'A', 'Q', 'O', 'U', 'R', 'N', 'K', 'E']", "['A']", "['D', 'E']"]
53
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [23, 10, 22, 30, 5, 16, 2, 28, 25, 26, 30, 25, 35, 32, 10, 4, 24, 32, 34, 12, 11, 5, 5, 18, 16, 24, 3, 12, 11, 5, 2, 7, 19, 34, 7, 30, 17, 11, 16, 10, 31, 31, 34, 27, 3, 24], such that the sum of the chosen coins adds up to 359. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {24: 9, 26: 11, 17: 7, 7: 4, 12: 4, 35: 18, 5: 5, 31: 8, 2: 2, 3: 1, 27: 14, 34: 3, 30: 1, 23: 6, 4: 2, 10: 8, 18: 18, 25: 15, 28: 4, 32: 19, 11: 7, 16: 6, 19: 11, 22: 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
25
[34, 30, 31, 30, 28, 22, 31, 30, 35, 34, 2, 17, 23, 12]
71
0.057801008224487305
14
46
46
[[23, 10, 22, 30, 5, 16, 2, 28, 25, 26, 30, 25, 35, 32, 10, 4, 24, 32, 34, 12, 11, 5, 5, 18, 16, 24, 3, 12, 11, 5, 2, 7, 19, 34, 7, 30, 17, 11, 16, 10, 31, 31, 34, 27, 3, 24]]
[[23, 10, 22, 30, 5, 16, 2, 28, 25, 26, 30, 25, 35, 32, 10, 4, 24, 32, 34, 12, 11, 5, 5, 18, 16, 24, 3, 12, 11, 5, 2, 7, 19, 34, 7, 30, 17, 11, 16, 10, 31, 31, 34, 27, 3, 24], {"24": 9, "26": 11, "17": 7, "7": 4, "12": 4, "35": 18, "5": 5, "31": 8, "2": 2, "3": 1, "27": 14, "34": 3, "30": 1, "23": 6, "4": 2, "10": 8, "18": 18, "25": 15, "28": 4, "32": 19, "11": 7, "16": 6, "19": 11, "22": 5}, 359]
["[23, 10, 22, 30, 5, 16, 2, 28, 25, 26, 30, 25, 35, 32, 10, 4, 24, 32, 34, 12, 11, 5, 5, 18, 16, 24, 3, 12, 11, 5, 2, 7, 19, 34, 7, 30, 17, 11, 16, 10, 31, 31, 34, 27, 3, 24]", "{24: 9, 26: 11, 17: 7, 7: 4, 12: 4, 35: 18, 5: 5, 31: 8, 2: 2, 3: 1, 27: 14, 34: 3, 30: 1, 23: 6, 4: 2, 10: 8, 18: 18, 25: 15, 28: 4, 32: 19, 11: 7, 16: 6, 19: 11, 22: 5}", "359"]
53
The game of 'Sort It' begins with 3 tubes, each filled with 5 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 8 balls. It is not allowed to place a ball in a tube that already has 8 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', 'Green'], ['Blue', 'Green', 'Green', 'Green', 'Blue'], ['Red', 'Green', 'Blue', 'Red', 'Red']]
color_sorting
sorting
9
[[0, 1], [2, 1], [2, 0], [2, 0], [1, 2], [1, 2], [1, 0], [1, 2], [1, 2], [1, 2], [0, 1], [0, 1], [0, 2], [0, 1], [0, 1], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2]]
21
11.96505355834961
21
6
15
[[["Red", "Blue", "Blue", "Red", "Green"], ["Blue", "Green", "Green", "Green", "Blue"], ["Red", "Green", "Blue", "Red", "Red"]], 8]
[[["Red", "Blue", "Blue", "Red", "Green"], ["Blue", "Green", "Green", "Green", "Blue"], ["Red", "Green", "Blue", "Red", "Red"]], 8]
["[['Red', 'Blue', 'Blue', 'Red', 'Green'], ['Blue', 'Green', 'Green', 'Green', 'Blue'], ['Red', 'Green', 'Blue', 'Red', 'Red']]", "8"]
53
We have a 4x4 numerical grid, with numbers ranging from 44 to 84 (44 included in the range but 84 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth 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: [['45' '55' '59' 'x'] ['x' '67' 'x' 'x'] ['60' 'x' '79' '80'] ['x' 'x' 'x' '83']]
consecutive_grid
underdetermined_system
12
[[0, 3, 61], [1, 0, 46], [1, 2, 68], [1, 3, 69], [2, 1, 70], [3, 0, 62], [3, 1, 71], [3, 2, 81]]
787
0.4855637550354004
8
40
16
["[['45', '55', '59', ''], ['', '67', '', ''], ['60', '', '79', '80'], ['', '', '', '83']]", 44, 84]
["[['45', '55', '59', ''], ['', '67', '', ''], ['60', '', '79', '80'], ['', '', '', '83']]", 44, 84]
["[['45', '55', '59', ''], ['', '67', '', ''], ['60', '', '79', '80'], ['', '', '', '83']]", "44", "84"]
53
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 9 to 40. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 116, 78, None for columns 1 to 2 respectively, and the sums of rows must be None, 94, 111, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 70. 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' '22' '23'] ['x' 'x' '15' '25'] ['31' 'x' 'x' 'x'] ['12' '36' 'x' '13']]
magic_square
underdetermined_system
8
[[0, 0, 10], [0, 1, 27], [1, 0, 21], [1, 1, 33], [2, 1, 20], [2, 2, 32], [2, 3, 28], [3, 2, 9]]
357
0.4937326908111572
8
49
9
["[['', '', '22', '23'], ['', '', '15', '25'], ['31', '', '', ''], ['12', '36', '', '13']]", 4, 9, 40]
["[['', '', '22', '23'], ['', '', '15', '25'], ['31', '', '', ''], ['12', '36', '', '13']]", 9, 40, [1, 3], [1, 3], [116, 78], [94, 111], 70]
["[['', '', '22', '23'], ['', '', '15', '25'], ['31', '', '', ''], ['12', '36', '', '13']]", "9", "40", "[None, 116, 78, None]", "[None, 94, 111, None]", "70"]
53
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 7, 1: 4, 2: 1, 3: 2, 4: 6, 5: 8, 6: 7, 7: 6}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], ['Blue', 'Green', 'Red', 'Yellow', 'Blue'], ['Green', 'Blue', 'Yellow', 'Black', 'Red'], [], ['Red', 'Yellow', 'Yellow', 'Black', 'Black'], ['Green', 'Blue', 'Green', 'Black', 'Red'], [], []]
restricted_sorting
sorting
2
[[1, 3], [1, 7], [1, 0], [1, 6], [4, 0], [4, 6], [4, 6], [2, 7], [2, 1], [2, 6], [2, 4], [5, 7], [5, 1], [5, 7], [5, 4], [3, 1], [0, 2], [0, 2], [5, 2]]
95
5.887192726135254
19
56
20
[[[], ["Blue", "Green", "Red", "Yellow", "Blue"], ["Green", "Blue", "Yellow", "Black", "Red"], [], ["Red", "Yellow", "Yellow", "Black", "Black"], ["Green", "Blue", "Green", "Black", "Red"], [], []], 5, {"0": 7, "1": 4, "2": 1, "3": 2, "4": 6, "5": 8, "6": 7, "7": 6}]
[[[], ["Blue", "Green", "Red", "Yellow", "Blue"], ["Green", "Blue", "Yellow", "Black", "Red"], [], ["Red", "Yellow", "Yellow", "Black", "Black"], ["Green", "Blue", "Green", "Black", "Red"], [], []], 5, {"0": 7, "1": 4, "2": 1, "3": 2, "4": 6, "5": 8, "6": 7, "7": 6}, 4]
["[[], ['Blue', 'Green', 'Red', 'Yellow', 'Blue'], ['Green', 'Blue', 'Yellow', 'Black', 'Red'], [], ['Red', 'Yellow', 'Yellow', 'Black', 'Black'], ['Green', 'Blue', 'Green', 'Black', 'Red'], [], []]", "{0: 7, 1: 4, 2: 1, 3: 2, 4: 6, 5: 8, 6: 7, 7: 6}", "5", "4"]
53
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 3) to his destination workshop at index (7, 11), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 6, and district 3 covering rows 7 to 11. 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 x x 14 5 x x 5 18 x 3 x] [x x x 9 2 2 x 15 14 12 x 18] [x x 3 16 3 9 x 16 x 14 x 17] [x x x 19 7 20 x x 11 4 x 4] [7 x 8 11 x 1 15 5 x x 11 x] [x x x x x x 6 11 x x x 8] [x 15 2 x x 18 x 1 16 15 6 5] [x 4 18 8 9 x x 17 20 13 x 10] [x 16 x x 19 x 17 x 13 11 14 2] [12 x 11 x 3 x 5 3 x 13 17 6] [14 x x x x x x x x 11 x 16] [12 x x x 12 x 10 x 18 14 8 x]
traffic
pathfinding
4
[[3, 3], [3, 4], [3, 5], [4, 5], [4, 6], [4, 7], [5, 7], [6, 7], [6, 8], [6, 9], [6, 10], [6, 11], [7, 11]]
112
0.026072263717651367
13
4
4
[[["18", "x", "x", "14", "5", "x", "x", "5", "18", "x", "3", "x"], ["x", "x", "x", "9", "2", "2", "x", "15", "14", "12", "x", "18"], ["x", "x", "3", "16", "3", "9", "x", "16", "x", "14", "x", "17"], ["x", "x", "x", "19", "7", "20", "x", "x", "11", "4", "x", "4"], ["7", "x", "8", "11", "x", "1", "15", "5", "x", "x", "11", "x"], ["x", "x", "x", "x", "x", "x", "6", "11", "x", "x", "x", "8"], ["x", "15", "2", "x", "x", "18", "x", "1", "16", "15", "6", "5"], ["x", "4", "18", "8", "9", "x", "x", "17", "20", "13", "x", "10"], ["x", "16", "x", "x", "19", "x", "17", "x", "13", "11", "14", "2"], ["12", "x", "11", "x", "3", "x", "5", "3", "x", "13", "17", "6"], ["14", "x", "x", "x", "x", "x", "x", "x", "x", "11", "x", "16"], ["12", "x", "x", "x", "12", "x", "10", "x", "18", "14", "8", "x"]]]
[[["18", "x", "x", "14", "5", "x", "x", "5", "18", "x", "3", "x"], ["x", "x", "x", "9", "2", "2", "x", "15", "14", "12", "x", "18"], ["x", "x", "3", "16", "3", "9", "x", "16", "x", "14", "x", "17"], ["x", "x", "x", "19", "7", "20", "x", "x", "11", "4", "x", "4"], ["7", "x", "8", "11", "x", "1", "15", "5", "x", "x", "11", "x"], ["x", "x", "x", "x", "x", "x", "6", "11", "x", "x", "x", "8"], ["x", "15", "2", "x", "x", "18", "x", "1", "16", "15", "6", "5"], ["x", "4", "18", "8", "9", "x", "x", "17", "20", "13", "x", "10"], ["x", "16", "x", "x", "19", "x", "17", "x", "13", "11", "14", "2"], ["12", "x", "11", "x", "3", "x", "5", "3", "x", "13", "17", "6"], ["14", "x", "x", "x", "x", "x", "x", "x", "x", "11", "x", "16"], ["12", "x", "x", "x", "12", "x", "10", "x", "18", "14", "8", "x"]], [3, 3], [7, 11], 3, 6]
["[['18', 'x', 'x', '14', '5', 'x', 'x', '5', '18', 'x', '3', 'x'], ['x', 'x', 'x', '9', '2', '2', 'x', '15', '14', '12', 'x', '18'], ['x', 'x', '3', '16', '3', '9', 'x', '16', 'x', '14', 'x', '17'], ['x', 'x', 'x', '19', '7', '20', 'x', 'x', '11', '4', 'x', '4'], ['7', 'x', '8', '11', 'x', '1', '15', '5', 'x', 'x', '11', 'x'], ['x', 'x', 'x', 'x', 'x', 'x', '6', '11', 'x', 'x', 'x', '8'], ['x', '15', '2', 'x', 'x', '18', 'x', '1', '16', '15', '6', '5'], ['x', '4', '18', '8', '9', 'x', 'x', '17', '20', '13', 'x', '10'], ['x', '16', 'x', 'x', '19', 'x', '17', 'x', '13', '11', '14', '2'], ['12', 'x', '11', 'x', '3', 'x', '5', '3', 'x', '13', '17', '6'], ['14', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', '11', 'x', '16'], ['12', 'x', 'x', 'x', '12', 'x', '10', 'x', '18', '14', '8', 'x']]", "(3, 3)", "(7, 11)", "3", "6"]
53
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. 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 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (2, 11) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (8, 1). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 0 0 0 1 0 0 0 1 1 0 1 0 0 0 0 0 1 1 0 0 0 1 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 1 1 0 1 0 1 1 1 0 0 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 1 1 0 0 1 1 1 1 0 1 1 0 0 1 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 0 1 1
trampoline_matrix
pathfinding
12
[[2, 11], [2, 10], [2, 9], [2, 8], [2, 7], [3, 7], [4, 6], [4, 5], [5, 4], [6, 4], [7, 3], [7, 2], [8, 1]]
13
0.025552034378051758
13
8
2
["[[1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1], [1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1], [1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1], [0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0], [1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1]]", 4]
["[[1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1], [1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1], [1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1], [0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0], [1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1]]", [2, 11], [8, 1], 4]
["[[1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1], [1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1], [1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1], [0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0], [1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1]]", "(2, 11)", "(8, 1)", "4"]
53
Given 9 labeled water jugs with capacities 139, 143, 17, 138, 133, 19, 126, 102, 65 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 349, 415, 458 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 17, 3], ["+", 138, 3], ["+", 143, 3], ["+", 17, 3], ["+", 143, 3], ["+", 133, 2], ["+", 139, 2], ["+", 143, 2], ["+", 65, 1], ["+", 126, 1], ["+", 19, 1], ["+", 139, 1]]
12
0.036029815673828125
12
54
3
[[139, 143, 17, 138, 133, 19, 126, 102, 65], [349, 415, 458]]
[[139, 143, 17, 138, 133, 19, 126, 102, 65], [349, 415, 458]]
["[139, 143, 17, 138, 133, 19, 126, 102, 65]", "[349, 415, 458]"]
54
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: [[100, '_', 99, 84], [59, 20, 56, 64], [74, 6, 57, 83]]
8_puzzle
puzzle
6
[20, 56, 64, 83, 57, 6, 56, 59, 74, 56, 59, 20, 99, 84, 83, 57, 6, 59, 20, 64, 59, 6]
22
0.07044315338134766
22
4
12
[[[100, "_", 99, 84], [59, 20, 56, 64], [74, 6, 57, 83]]]
[[[100, "_", 99, 84], [59, 20, 56, 64], [74, 6, 57, 83]]]
["[[100, '_', 99, 84], [59, 20, 56, 64], [74, 6, 57, 83]]"]
54
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: unfew, brolly, bright, uproot The initial board: [['r', 'u', 'p', 'f', 'y', 'w'], ['b', 'l', 'o', 'e', 'l', 'o'], ['n', 'r', '_', 'g', 'h', 't'], ['u', 'b', 'r', 'i', 'o', 't']]
8_puzzle_words
puzzle
3
["up-left", "up-right", "down-right", "down-left", "up-left", "down-left", "down-right", "up-right", "down-right", "up-right", "up-left", "up-left", "down-left", "down-right", "down-right", "up-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-left", "down-left", "up-left", "up-left"]
26
1.347020149230957
26
4
24
[[["r", "u", "p", "f", "y", "w"], ["b", "l", "o", "e", "l", "o"], ["n", "r", "_", "g", "h", "t"], ["u", "b", "r", "i", "o", "t"]]]
[[["r", "u", "p", "f", "y", "w"], ["b", "l", "o", "e", "l", "o"], ["n", "r", "_", "g", "h", "t"], ["u", "b", "r", "i", "o", "t"]], ["unfew", "brolly", "bright", "uproot"]]
["[['r', 'u', 'p', 'f', 'y', 'w'], ['b', 'l', 'o', 'e', 'l', 'o'], ['n', 'r', '_', 'g', 'h', 't'], ['u', 'b', 'r', 'i', 'o', 't']]", "['unfew', 'brolly', 'bright', 'uproot']"]
54
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 'R'. Our task is to visit city Y and city A excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from A and Y, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. G T M U K Y D A P R E S I G 0 1 0 0 1 1 0 0 1 0 0 0 0 T 0 0 0 0 0 0 0 1 0 0 1 0 0 M 1 1 0 0 0 0 0 0 0 0 0 0 0 U 1 0 1 0 0 0 0 0 0 0 0 0 0 K 0 1 0 1 0 0 1 0 1 0 0 0 1 Y 0 0 1 1 1 0 1 0 0 0 0 0 0 D 0 0 1 0 0 0 0 0 0 0 0 1 1 A 1 0 0 1 0 1 1 0 0 0 0 0 0 P 0 0 1 0 0 0 1 1 0 0 0 0 1 R 0 0 0 1 0 0 0 0 0 0 1 0 0 E 0 0 0 0 1 0 0 0 0 1 0 0 0 S 0 1 0 0 1 0 0 0 1 0 0 0 0 I 0 0 0 1 0 1 0 0 0 0 1 0 0
city_directed_graph
pathfinding
13
["R", "E", "K", "P", "A", "Y", "M", "T", "A", "Y"]
10
0.03291726112365723
10
13
16
[[[0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [1, 1, 0, 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, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0]], ["G", "T", "M", "U", "K", "Y", "D", "A", "P", "R", "E", "S", "I"], "Y", "A"]
[[[0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [1, 1, 0, 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, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0]], ["G", "T", "M", "U", "K", "Y", "D", "A", "P", "R", "E", "S", "I"], "R", "Y", "A"]
["[[0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [1, 1, 0, 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, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0]]", "['G', 'T', 'M', 'U', 'K', 'Y', 'D', 'A', 'P', 'R', 'E', 'S', 'I']", "['R']", "['Y', 'A']"]
54
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [4, 17, 14, 12, 1, 3, 12, 10, 14, 9, 30, 20, 11, 17, 11, 16, 22, 17, 30, 5, 10, 16, 19, 27, 6, 18, 20, 19, 32, 25, 30, 15, 30, 21, 19, 25, 31, 33, 19, 10, 8, 16, 8], such that the sum of the chosen coins adds up to 328. 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 {1: 1, 31: 13, 25: 13, 11: 3, 3: 1, 10: 8, 33: 14, 8: 4, 9: 9, 4: 1, 20: 4, 12: 8, 27: 13, 30: 14, 16: 10, 18: 9, 32: 5, 21: 20, 6: 4, 5: 5, 22: 11, 17: 11, 19: 2, 14: 10, 15: 6}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
26
[19, 19, 19, 4, 11, 33, 32, 20, 8, 11, 15, 19, 18, 31, 22, 20, 27]
98
0.053559064865112305
17
43
43
[[4, 17, 14, 12, 1, 3, 12, 10, 14, 9, 30, 20, 11, 17, 11, 16, 22, 17, 30, 5, 10, 16, 19, 27, 6, 18, 20, 19, 32, 25, 30, 15, 30, 21, 19, 25, 31, 33, 19, 10, 8, 16, 8]]
[[4, 17, 14, 12, 1, 3, 12, 10, 14, 9, 30, 20, 11, 17, 11, 16, 22, 17, 30, 5, 10, 16, 19, 27, 6, 18, 20, 19, 32, 25, 30, 15, 30, 21, 19, 25, 31, 33, 19, 10, 8, 16, 8], {"1": 1, "31": 13, "25": 13, "11": 3, "3": 1, "10": 8, "33": 14, "8": 4, "9": 9, "4": 1, "20": 4, "12": 8, "27": 13, "30": 14, "16": 10, "18": 9, "32": 5, "21": 20, "6": 4, "5": 5, "22": 11, "17": 11, "19": 2, "14": 10, "15": 6}, 328]
["[4, 17, 14, 12, 1, 3, 12, 10, 14, 9, 30, 20, 11, 17, 11, 16, 22, 17, 30, 5, 10, 16, 19, 27, 6, 18, 20, 19, 32, 25, 30, 15, 30, 21, 19, 25, 31, 33, 19, 10, 8, 16, 8]", "{1: 1, 31: 13, 25: 13, 11: 3, 3: 1, 10: 8, 33: 14, 8: 4, 9: 9, 4: 1, 20: 4, 12: 8, 27: 13, 30: 14, 16: 10, 18: 9, 32: 5, 21: 20, 6: 4, 5: 5, 22: 11, 17: 11, 19: 2, 14: 10, 15: 6}", "328"]
54
The game of 'Sort It' begins with 3 tubes, each filled with 5 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 8 balls. It is not allowed to place a ball in a tube that already has 8 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Green', 'Blue', 'Red', 'Green'], ['Green', 'Red', 'Green', 'Red', 'Blue'], ['Blue', 'Red', 'Green', 'Blue', 'Blue']]
color_sorting
sorting
9
[[0, 2], [1, 0], [1, 2], [1, 0], [1, 2], [1, 0], [2, 1], [2, 1], [2, 1], [2, 0], [2, 1], [2, 1], [0, 2], [0, 2], [0, 1], [0, 1], [0, 1], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [2, 1]]
24
54.056875705718994
24
6
15
[[["Red", "Green", "Blue", "Red", "Green"], ["Green", "Red", "Green", "Red", "Blue"], ["Blue", "Red", "Green", "Blue", "Blue"]], 8]
[[["Red", "Green", "Blue", "Red", "Green"], ["Green", "Red", "Green", "Red", "Blue"], ["Blue", "Red", "Green", "Blue", "Blue"]], 8]
["[['Red', 'Green', 'Blue', 'Red', 'Green'], ['Green', 'Red', 'Green', 'Red', 'Blue'], ['Blue', 'Red', 'Green', 'Blue', 'Blue']]", "8"]
54
We have a 4x4 numerical grid, with numbers ranging from 13 to 53 (13 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 > fourth or first < second < third < fourth 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' '25' '28'] ['x' 'x' '28' '31'] ['15' 'x' '34' 'x'] ['13' '34' 'x' 'x']]
consecutive_grid
underdetermined_system
12
[[0, 0, 17], [0, 1, 18], [1, 0, 16], [1, 1, 19], [2, 1, 20], [2, 3, 35], [3, 2, 36], [3, 3, 37]]
326
138.72793531417847
8
40
16
["[['', '', '25', '28'], ['', '', '28', '31'], ['15', '', '34', ''], ['13', '34', '', '']]", 13, 53]
["[['', '', '25', '28'], ['', '', '28', '31'], ['15', '', '34', ''], ['13', '34', '', '']]", 13, 53]
["[['', '', '25', '28'], ['', '', '28', '31'], ['15', '', '34', ''], ['13', '34', '', '']]", "13", "53"]
54
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 28 to 59. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 208, 157, None for columns 1 to 2 respectively, and the sums of rows must be None, 196, 162, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 166. 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: [['30' 'x' 'x' '37'] ['41' '56' 'x' 'x'] ['x' 'x' '29' '55'] ['x' 'x' 'x' '42']]
magic_square
underdetermined_system
8
[[0, 1, 48], [0, 2, 34], [1, 2, 54], [1, 3, 45], [2, 0, 31], [2, 1, 47], [3, 0, 28], [3, 1, 57], [3, 2, 40]]
674
18.105977296829224
9
49
9
["[['30', '', '', '37'], ['41', '56', '', ''], ['', '', '29', '55'], ['', '', '', '42']]", 4, 28, 59]
["[['30', '', '', '37'], ['41', '56', '', ''], ['', '', '29', '55'], ['', '', '', '42']]", 28, 59, [1, 3], [1, 3], [208, 157], [196, 162], 166]
["[['30', '', '', '37'], ['41', '56', '', ''], ['', '', '29', '55'], ['', '', '', '42']]", "28", "59", "[None, 208, 157, None]", "[None, 196, 162, None]", "166"]
54
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 8, 1: 8, 2: 2, 3: 7, 4: 9, 5: 5, 6: 2, 7: 7}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], ['Green', 'Yellow', 'Blue', 'Yellow', 'Green'], ['Black', 'Yellow', 'Blue', 'Green', 'Red'], ['Red', 'Black', 'Blue', 'Red', 'Black'], [], ['Red', 'Green', 'Yellow', 'Black', 'Blue'], [], []]
restricted_sorting
sorting
2
[[3, 6], [5, 6], [1, 7], [5, 7], [2, 0], [2, 4], [5, 4], [5, 0], [2, 5], [2, 7], [3, 0], [3, 5], [3, 6], [3, 0], [2, 3], [1, 2], [1, 5], [1, 2], [1, 7], [3, 6], [4, 2], [4, 2]]
116
0.24997472763061523
22
56
20
[[[], ["Green", "Yellow", "Blue", "Yellow", "Green"], ["Black", "Yellow", "Blue", "Green", "Red"], ["Red", "Black", "Blue", "Red", "Black"], [], ["Red", "Green", "Yellow", "Black", "Blue"], [], []], 5, {"0": 8, "1": 8, "2": 2, "3": 7, "4": 9, "5": 5, "6": 2, "7": 7}]
[[[], ["Green", "Yellow", "Blue", "Yellow", "Green"], ["Black", "Yellow", "Blue", "Green", "Red"], ["Red", "Black", "Blue", "Red", "Black"], [], ["Red", "Green", "Yellow", "Black", "Blue"], [], []], 5, {"0": 8, "1": 8, "2": 2, "3": 7, "4": 9, "5": 5, "6": 2, "7": 7}, 4]
["[[], ['Green', 'Yellow', 'Blue', 'Yellow', 'Green'], ['Black', 'Yellow', 'Blue', 'Green', 'Red'], ['Red', 'Black', 'Blue', 'Red', 'Black'], [], ['Red', 'Green', 'Yellow', 'Black', 'Blue'], [], []]", "{0: 8, 1: 8, 2: 2, 3: 7, 4: 9, 5: 5, 6: 2, 7: 7}", "5", "4"]
54
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 (4, 11) to his destination workshop at index (9, 2), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 8, and district 3 covering rows 9 to 11. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [19 14 16 4 15 16 15 x 9 x x x] [x 7 12 6 x 12 x 3 x 14 5 9] [1 12 x x 12 x x x x x 10 1] [x 1 15 14 x 2 13 x x x 10 9] [7 x 13 x 14 1 14 8 x x 8 5] [18 x 8 13 12 13 x 12 3 x 14 x] [x 15 x x x x x x x x 17 10] [x 5 x 4 x x x 3 5 6 6 11] [x 15 6 x 4 18 x x 14 10 2 8] [13 10 13 7 3 6 x x 10 17 10 15] [4 x x 7 19 4 13 13 12 x x 13] [5 x x 9 19 18 x x 16 x 2 x]
traffic
pathfinding
4
[[4, 11], [3, 11], [4, 11], [4, 10], [5, 10], [6, 10], [7, 10], [7, 9], [7, 8], [8, 8], [9, 8], [10, 8], [10, 7], [10, 6], [10, 5], [9, 5], [9, 4], [9, 3], [9, 2]]
165
0.02228689193725586
19
4
4
[[["19", "14", "16", "4", "15", "16", "15", "x", "9", "x", "x", "x"], ["x", "7", "12", "6", "x", "12", "x", "3", "x", "14", "5", "9"], ["1", "12", "x", "x", "12", "x", "x", "x", "x", "x", "10", "1"], ["x", "1", "15", "14", "x", "2", "13", "x", "x", "x", "10", "9"], ["7", "x", "13", "x", "14", "1", "14", "8", "x", "x", "8", "5"], ["18", "x", "8", "13", "12", "13", "x", "12", "3", "x", "14", "x"], ["x", "15", "x", "x", "x", "x", "x", "x", "x", "x", "17", "10"], ["x", "5", "x", "4", "x", "x", "x", "3", "5", "6", "6", "11"], ["x", "15", "6", "x", "4", "18", "x", "x", "14", "10", "2", "8"], ["13", "10", "13", "7", "3", "6", "x", "x", "10", "17", "10", "15"], ["4", "x", "x", "7", "19", "4", "13", "13", "12", "x", "x", "13"], ["5", "x", "x", "9", "19", "18", "x", "x", "16", "x", "2", "x"]]]
[[["19", "14", "16", "4", "15", "16", "15", "x", "9", "x", "x", "x"], ["x", "7", "12", "6", "x", "12", "x", "3", "x", "14", "5", "9"], ["1", "12", "x", "x", "12", "x", "x", "x", "x", "x", "10", "1"], ["x", "1", "15", "14", "x", "2", "13", "x", "x", "x", "10", "9"], ["7", "x", "13", "x", "14", "1", "14", "8", "x", "x", "8", "5"], ["18", "x", "8", "13", "12", "13", "x", "12", "3", "x", "14", "x"], ["x", "15", "x", "x", "x", "x", "x", "x", "x", "x", "17", "10"], ["x", "5", "x", "4", "x", "x", "x", "3", "5", "6", "6", "11"], ["x", "15", "6", "x", "4", "18", "x", "x", "14", "10", "2", "8"], ["13", "10", "13", "7", "3", "6", "x", "x", "10", "17", "10", "15"], ["4", "x", "x", "7", "19", "4", "13", "13", "12", "x", "x", "13"], ["5", "x", "x", "9", "19", "18", "x", "x", "16", "x", "2", "x"]], [4, 11], [9, 2], 3, 8]
["[['19', '14', '16', '4', '15', '16', '15', 'x', '9', 'x', 'x', 'x'], ['x', '7', '12', '6', 'x', '12', 'x', '3', 'x', '14', '5', '9'], ['1', '12', 'x', 'x', '12', 'x', 'x', 'x', 'x', 'x', '10', '1'], ['x', '1', '15', '14', 'x', '2', '13', 'x', 'x', 'x', '10', '9'], ['7', 'x', '13', 'x', '14', '1', '14', '8', 'x', 'x', '8', '5'], ['18', 'x', '8', '13', '12', '13', 'x', '12', '3', 'x', '14', 'x'], ['x', '15', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', '17', '10'], ['x', '5', 'x', '4', 'x', 'x', 'x', '3', '5', '6', '6', '11'], ['x', '15', '6', 'x', '4', '18', 'x', 'x', '14', '10', '2', '8'], ['13', '10', '13', '7', '3', '6', 'x', 'x', '10', '17', '10', '15'], ['4', 'x', 'x', '7', '19', '4', '13', '13', '12', 'x', 'x', '13'], ['5', 'x', 'x', '9', '19', '18', 'x', 'x', '16', 'x', '2', 'x']]", "(4, 11)", "(9, 2)", "3", "8"]
54
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. 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 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (1, 7) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (10, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 1 1 0 0 0 0 1 0 0 1 1 0 1 0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 1 1 1 1 1 0 0 0 0 1 1 0 0 1 0 1 1 1 0 0 1 0 0 1 1 0 0 1 0 1 0 0 0 1 1 1 1 1 1 0 1 0 0 0 1 1 0 1 1 1 1 0 1 0 0 0 0 1 1 1 0 1 1 0 1 1 0 0 1 1 0 1 0 0 1 1 1 0
trampoline_matrix
pathfinding
12
[[1, 7], [2, 6], [3, 5], [4, 5], [5, 5], [6, 5], [7, 4], [7, 3], [8, 2], [8, 1], [9, 1], [9, 0], [10, 0]]
13
0.029400348663330078
13
8
2
["[[1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1], [0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1], [0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1], [0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0]]", 4]
["[[1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1], [0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1], [0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1], [0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0]]", [1, 7], [10, 0], 4]
["[[1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1], [0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1], [0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1], [0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0]]", "(1, 7)", "(10, 0)", "4"]
54
Given 9 labeled water jugs with capacities 45, 67, 134, 133, 86, 66, 107, 94, 124, 122 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 229, 303, 307 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 66, 3], ["+", 107, 3], ["+", 134, 3], ["+", 124, 2], ["+", 134, 2], ["+", 45, 2], ["+", 107, 1], ["+", 122, 1]]
8
0.02436041831970215
8
60
3
[[45, 67, 134, 133, 86, 66, 107, 94, 124, 122], [229, 303, 307]]
[[45, 67, 134, 133, 86, 66, 107, 94, 124, 122], [229, 303, 307]]
["[45, 67, 134, 133, 86, 66, 107, 94, 124, 122]", "[229, 303, 307]"]
55
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: [[34, 68, 46, 20], [12, 18, '_', 5], [53, 7, 65, 47]]
8_puzzle
puzzle
7
[18, 68, 46, 18, 65, 47, 5, 20, 18, 65, 47, 7, 53, 12, 34, 46, 65, 47, 20, 18, 47, 65, 68, 53, 7, 20, 53, 34, 46, 68, 65, 53, 20, 5]
34
3.4830353260040283
34
4
12
[[[34, 68, 46, 20], [12, 18, "_", 5], [53, 7, 65, 47]]]
[[[34, 68, 46, 20], [12, 18, "_", 5], [53, 7, 65, 47]]]
["[[34, 68, 46, 20], [12, 18, '_', 5], [53, 7, 65, 47]]"]
55
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: net, toss, flip, swag, bosn The initial board: [['o', 'n', 's', 't'], ['t', 'e', 's', 'w'], ['i', 'l', 's', 'p'], ['s', 'g', 'a', 'f'], ['b', 'o', '_', 'n']]
8_puzzle_words
puzzle
2
["up-left", "up-right", "down-right", "down-left", "up-left", "up-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-left", "up-left"]
14
0.19336867332458496
14
4
20
[[["o", "n", "s", "t"], ["t", "e", "s", "w"], ["i", "l", "s", "p"], ["s", "g", "a", "f"], ["b", "o", "_", "n"]]]
[[["o", "n", "s", "t"], ["t", "e", "s", "w"], ["i", "l", "s", "p"], ["s", "g", "a", "f"], ["b", "o", "_", "n"]], ["net", "toss", "flip", "swag", "bosn"]]
["[['o', 'n', 's', 't'], ['t', 'e', 's', 'w'], ['i', 'l', 's', 'p'], ['s', 'g', 'a', 'f'], ['b', 'o', '_', 'n']]", "['net', 'toss', 'flip', 'swag', 'bosn']"]
55
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 B 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 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. D Z T X L K N H U A Q B Y D 0 1 0 1 0 0 0 0 0 1 0 0 0 Z 1 0 1 1 0 0 0 1 0 0 0 0 1 T 1 0 0 0 0 0 0 1 1 0 0 1 0 X 0 0 1 0 0 0 0 0 0 0 1 0 0 L 1 1 0 0 0 1 0 0 0 0 0 1 0 K 1 0 1 1 0 0 0 0 0 1 0 0 0 N 1 0 0 0 0 0 0 0 0 1 0 0 1 H 1 0 0 0 0 0 1 0 0 0 1 0 0 U 0 0 0 0 0 0 1 0 0 0 0 1 0 A 0 0 1 0 1 0 0 1 0 0 0 0 0 Q 0 0 0 1 1 0 1 0 1 0 0 0 0 B 1 1 1 1 0 1 0 0 0 1 1 0 1 Y 1 0 1 0 0 1 0 1 1 0 0 0 0
city_directed_graph
pathfinding
13
["H", "Q", "L", "B", "X", "T", "B", "X"]
8
0.04383373260498047
8
13
16
[[[0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0]], ["D", "Z", "T", "X", "L", "K", "N", "H", "U", "A", "Q", "B", "Y"], "B", "X"]
[[[0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0]], ["D", "Z", "T", "X", "L", "K", "N", "H", "U", "A", "Q", "B", "Y"], "H", "B", "X"]
["[[0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0]]", "['D', 'Z', 'T', 'X', 'L', 'K', 'N', 'H', 'U', 'A', 'Q', 'B', 'Y']", "['H']", "['B', 'X']"]
55
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [12, 26, 9, 14, 11, 25, 28, 17, 18, 18, 9, 16, 2, 11, 31, 25, 4, 23, 9, 3, 24, 22, 3, 14, 32, 30, 19, 7, 4, 22, 33, 13, 25, 15, 14, 28, 20, 3, 4, 3, 32, 10, 6, 29, 25], such that the sum of the chosen coins adds up to 325. 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 {29: 2, 9: 7, 17: 4, 18: 9, 26: 6, 33: 11, 16: 12, 4: 3, 31: 12, 6: 2, 11: 8, 23: 14, 7: 1, 30: 8, 12: 8, 13: 2, 20: 13, 24: 16, 14: 8, 19: 8, 10: 8, 32: 14, 3: 2, 2: 2, 25: 19, 22: 18, 15: 5, 28: 9}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
27
[30, 28, 26, 6, 13, 15, 17, 29, 33, 32, 28, 18, 19, 31]
101
0.05463528633117676
14
45
45
[[12, 26, 9, 14, 11, 25, 28, 17, 18, 18, 9, 16, 2, 11, 31, 25, 4, 23, 9, 3, 24, 22, 3, 14, 32, 30, 19, 7, 4, 22, 33, 13, 25, 15, 14, 28, 20, 3, 4, 3, 32, 10, 6, 29, 25]]
[[12, 26, 9, 14, 11, 25, 28, 17, 18, 18, 9, 16, 2, 11, 31, 25, 4, 23, 9, 3, 24, 22, 3, 14, 32, 30, 19, 7, 4, 22, 33, 13, 25, 15, 14, 28, 20, 3, 4, 3, 32, 10, 6, 29, 25], {"29": 2, "9": 7, "17": 4, "18": 9, "26": 6, "33": 11, "16": 12, "4": 3, "31": 12, "6": 2, "11": 8, "23": 14, "7": 1, "30": 8, "12": 8, "13": 2, "20": 13, "24": 16, "14": 8, "19": 8, "10": 8, "32": 14, "3": 2, "2": 2, "25": 19, "22": 18, "15": 5, "28": 9}, 325]
["[12, 26, 9, 14, 11, 25, 28, 17, 18, 18, 9, 16, 2, 11, 31, 25, 4, 23, 9, 3, 24, 22, 3, 14, 32, 30, 19, 7, 4, 22, 33, 13, 25, 15, 14, 28, 20, 3, 4, 3, 32, 10, 6, 29, 25]", "{29: 2, 9: 7, 17: 4, 18: 9, 26: 6, 33: 11, 16: 12, 4: 3, 31: 12, 6: 2, 11: 8, 23: 14, 7: 1, 30: 8, 12: 8, 13: 2, 20: 13, 24: 16, 14: 8, 19: 8, 10: 8, 32: 14, 3: 2, 2: 2, 25: 19, 22: 18, 15: 5, 28: 9}", "325"]
55
The game of 'Sort It' begins with 3 tubes, each filled with 5 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 8 balls. It is not allowed to place a ball in a tube that already has 8 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', 'Red', 'Red'], ['Green', 'Red', 'Blue', 'Green', 'Green'], ['Red', 'Green', 'Blue', 'Blue', 'Red']]
color_sorting
sorting
9
[[0, 2], [1, 2], [1, 0], [1, 0], [2, 1], [2, 1], [2, 0], [2, 1], [0, 1], [2, 0], [2, 0], [2, 1], [0, 2], [0, 2], [0, 2], [0, 1], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0]]
21
12.931140422821045
21
6
15
[[["Green", "Blue", "Blue", "Red", "Red"], ["Green", "Red", "Blue", "Green", "Green"], ["Red", "Green", "Blue", "Blue", "Red"]], 8]
[[["Green", "Blue", "Blue", "Red", "Red"], ["Green", "Red", "Blue", "Green", "Green"], ["Red", "Green", "Blue", "Blue", "Red"]], 8]
["[['Green', 'Blue', 'Blue', 'Red', 'Red'], ['Green', 'Red', 'Blue', 'Green', 'Green'], ['Red', 'Green', 'Blue', 'Blue', 'Red']]", "8"]
55
We have a 4x4 numerical grid, with numbers ranging from 10 to 50 (10 included in the range but 50 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth 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' '38' '19' 'x'] ['22' 'x' 'x' 'x'] ['x' '30' 'x' '42'] ['x' 'x' '35' '45']]
consecutive_grid
underdetermined_system
13
[[0, 0, 39], [0, 3, 10], [1, 1, 31], [1, 2, 32], [1, 3, 33], [2, 0, 12], [2, 2, 34], [3, 0, 11], [3, 1, 13]]
385
2.9997804164886475
9
40
16
["[['', '38', '19', ''], ['22', '', '', ''], ['', '30', '', '42'], ['', '', '35', '45']]", 10, 50]
["[['', '38', '19', ''], ['22', '', '', ''], ['', '30', '', '42'], ['', '', '35', '45']]", 10, 50]
["[['', '38', '19', ''], ['22', '', '', ''], ['', '30', '', '42'], ['', '', '35', '45']]", "10", "50"]