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
28
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [26, 19, 7, 24, 27, 15, 9, 9, 9, 26, 15, 23, 6, 6, 24, 8, 21, 6, 6, 7, 25, 22, 8, 2, 7, 5, 8, 18, 14, 15, 24, 10, 4, 23, 21, 8, 18, 12, 16], such that the sum of the chosen coins adds up to 267. 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: 14, 27: 10, 22: 14, 16: 7, 14: 12, 6: 3, 8: 7, 23: 6, 18: 18, 5: 3, 25: 8, 7: 6, 12: 3, 15: 8, 9: 2, 19: 15, 2: 1, 4: 1, 26: 15, 10: 8, 21: 19}, 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
[9, 9, 9, 23, 12, 23, 6, 25, 6, 27, 26, 16, 6, 15, 15, 6, 4, 5, 15, 10]
109
0.044671058654785156
20
39
39
[[26, 19, 7, 24, 27, 15, 9, 9, 9, 26, 15, 23, 6, 6, 24, 8, 21, 6, 6, 7, 25, 22, 8, 2, 7, 5, 8, 18, 14, 15, 24, 10, 4, 23, 21, 8, 18, 12, 16]]
[[26, 19, 7, 24, 27, 15, 9, 9, 9, 26, 15, 23, 6, 6, 24, 8, 21, 6, 6, 7, 25, 22, 8, 2, 7, 5, 8, 18, 14, 15, 24, 10, 4, 23, 21, 8, 18, 12, 16], {"24": 14, "27": 10, "22": 14, "16": 7, "14": 12, "6": 3, "8": 7, "23": 6, "18": 18, "5": 3, "25": 8, "7": 6, "12": 3, "15": 8, "9": 2, "19": 15, "2": 1, "4": 1, "26": 15, "10": 8, "21": 19}, 267]
["[26, 19, 7, 24, 27, 15, 9, 9, 9, 26, 15, 23, 6, 6, 24, 8, 21, 6, 6, 7, 25, 22, 8, 2, 7, 5, 8, 18, 14, 15, 24, 10, 4, 23, 21, 8, 18, 12, 16]", "{24: 14, 27: 10, 22: 14, 16: 7, 14: 12, 6: 3, 8: 7, 23: 6, 18: 18, 5: 3, 25: 8, 7: 6, 12: 3, 15: 8, 9: 2, 19: 15, 2: 1, 4: 1, 26: 15, 10: 8, 21: 19}", "267"]
28
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Green', 'Green', 'Blue'], ['Blue', 'Red', 'Red', 'Red'], ['Blue', 'Green', 'Green', 'Blue']]
color_sorting
sorting
8
[[0, 1], [0, 2], [0, 2], [0, 1], [2, 0], [2, 0], [2, 1], [2, 0], [2, 0], [1, 2], [1, 2], [1, 0], [1, 2], [0, 1]]
14
0.5192186832427979
14
6
12
[[["Red", "Green", "Green", "Blue"], ["Blue", "Red", "Red", "Red"], ["Blue", "Green", "Green", "Blue"]], 7]
[[["Red", "Green", "Green", "Blue"], ["Blue", "Red", "Red", "Red"], ["Blue", "Green", "Green", "Blue"]], 7]
["[['Red', 'Green', 'Green', 'Blue'], ['Blue', 'Red', 'Red', 'Red'], ['Blue', 'Green', 'Green', 'Blue']]", "7"]
28
We have a 3x3 numerical grid, with numbers ranging from 12 to 60 (12 included in the range but 60 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['12' 'x' 'x'] ['18' 'x' '52'] ['22' 'x' '31']]
consecutive_grid
underdetermined_system
8
[[0, 1, 13], [0, 2, 53], [1, 1, 19], [2, 1, 23]]
276
0.17951035499572754
4
48
9
["[['12', '', ''], ['18', '', '52'], ['22', '', '31']]", 12, 60]
["[['12', '', ''], ['18', '', '52'], ['22', '', '31']]", 12, 60]
["[['12', '', ''], ['18', '', '52'], ['22', '', '31']]", "12", "60"]
28
In the magic square problem, a 3x3 grid is filled with unique integers ranging from 26 to 65. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 107, and sum of row 1 must be 124. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 108. 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: [['51' 'x' 'x'] ['x' 'x' 'x'] ['x' 'x' 'x']]
magic_square
underdetermined_system
6
[[0, 1, 27], [0, 2, 26], [1, 0, 31], [1, 1, 52], [1, 2, 41], [2, 0, 30], [2, 1, 28], [2, 2, 29]]
315
4.654482126235962
8
34
9
["[['51', '', ''], ['', '', ''], ['', '', '']]", 3, 26, 65]
["[['51', '', ''], ['', '', ''], ['', '', '']]", 26, 65, [1, 2], [1, 2], [107], [124], 108]
["[['51', '', ''], ['', '', ''], ['', '', '']]", "26", "65", "[None, 107, None]", "[None, 124, None]", "108"]
28
In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 3 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 3, 1: 7, 2: 7, 3: 7, 4: 2, 5: 4}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Green', 'Yellow', 'Red', 'Red'], [], ['Yellow', 'Green', 'Blue', 'Yellow'], [], [], ['Red', 'Blue', 'Green', 'Blue']]
restricted_sorting
sorting
1
[[0, 4], [0, 1], [5, 0], [2, 1], [2, 4], [2, 3], [5, 3], [5, 4], [2, 1], [3, 5], [3, 5]]
52
0.031346797943115234
11
30
12
[[["Green", "Yellow", "Red", "Red"], [], ["Yellow", "Green", "Blue", "Yellow"], [], [], ["Red", "Blue", "Green", "Blue"]], 4, {"0": 3, "1": 7, "2": 7, "3": 7, "4": 2, "5": 4}]
[[["Green", "Yellow", "Red", "Red"], [], ["Yellow", "Green", "Blue", "Yellow"], [], [], ["Red", "Blue", "Green", "Blue"]], 4, {"0": 3, "1": 7, "2": 7, "3": 7, "4": 2, "5": 4}, 3]
["[['Green', 'Yellow', 'Red', 'Red'], [], ['Yellow', 'Green', 'Blue', 'Yellow'], [], [], ['Red', 'Blue', 'Green', 'Blue']]", "{0: 3, 1: 7, 2: 7, 3: 7, 4: 2, 5: 4}", "4", "3"]
28
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (5, 0) to his destination workshop at index (3, 8), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 4, and district 3 covering rows 5 to 9. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [15 x 8 x 6 9 x x x x] [14 x 8 x 14 x 5 11 x 9] [x 17 8 x 17 15 12 x x 13] [x 13 x x 2 x 17 17 1 x] [6 x 1 5 17 x 2 18 11 7] [12 8 17 10 x x x 15 x 16] [12 12 x 4 x 13 x 10 x 16] [x x 10 x 6 x x x 8 5] [x 2 11 18 15 x 11 x x 12] [x x 14 x x 7 14 15 18 9]
traffic
pathfinding
2
[[5, 0], [5, 1], [5, 2], [4, 2], [4, 3], [4, 4], [3, 4], [2, 4], [2, 5], [2, 6], [3, 6], [3, 7], [3, 8]]
129
0.028196334838867188
13
4
4
[[["15", "x", "8", "x", "6", "9", "x", "x", "x", "x"], ["14", "x", "8", "x", "14", "x", "5", "11", "x", "9"], ["x", "17", "8", "x", "17", "15", "12", "x", "x", "13"], ["x", "13", "x", "x", "2", "x", "17", "17", "1", "x"], ["6", "x", "1", "5", "17", "x", "2", "18", "11", "7"], ["12", "8", "17", "10", "x", "x", "x", "15", "x", "16"], ["12", "12", "x", "4", "x", "13", "x", "10", "x", "16"], ["x", "x", "10", "x", "6", "x", "x", "x", "8", "5"], ["x", "2", "11", "18", "15", "x", "11", "x", "x", "12"], ["x", "x", "14", "x", "x", "7", "14", "15", "18", "9"]]]
[[["15", "x", "8", "x", "6", "9", "x", "x", "x", "x"], ["14", "x", "8", "x", "14", "x", "5", "11", "x", "9"], ["x", "17", "8", "x", "17", "15", "12", "x", "x", "13"], ["x", "13", "x", "x", "2", "x", "17", "17", "1", "x"], ["6", "x", "1", "5", "17", "x", "2", "18", "11", "7"], ["12", "8", "17", "10", "x", "x", "x", "15", "x", "16"], ["12", "12", "x", "4", "x", "13", "x", "10", "x", "16"], ["x", "x", "10", "x", "6", "x", "x", "x", "8", "5"], ["x", "2", "11", "18", "15", "x", "11", "x", "x", "12"], ["x", "x", "14", "x", "x", "7", "14", "15", "18", "9"]], [5, 0], [3, 8], 3, 4]
["[['15', 'x', '8', 'x', '6', '9', 'x', 'x', 'x', 'x'], ['14', 'x', '8', 'x', '14', 'x', '5', '11', 'x', '9'], ['x', '17', '8', 'x', '17', '15', '12', 'x', 'x', '13'], ['x', '13', 'x', 'x', '2', 'x', '17', '17', '1', 'x'], ['6', 'x', '1', '5', '17', 'x', '2', '18', '11', '7'], ['12', '8', '17', '10', 'x', 'x', 'x', '15', 'x', '16'], ['12', '12', 'x', '4', 'x', '13', 'x', '10', 'x', '16'], ['x', 'x', '10', 'x', '6', 'x', 'x', 'x', '8', '5'], ['x', '2', '11', '18', '15', 'x', '11', 'x', 'x', '12'], ['x', 'x', '14', 'x', 'x', '7', '14', '15', '18', '9']]", "(5, 0)", "(3, 8)", "3", "4"]
28
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (8, 0) (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 0 1 1 1 0 1 1 0 1 0 0 0 0 0 0 1 1 1 0 1 0 1 0 0 0 0 1 0 0 0 0 0 1 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 0 1 0 1 1 1 1 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1 1 1 1 0 1 1 1 0 0 1 0 1 1 0 0 0 1 0 0 1 0 1 0 1 1 0 1
trampoline_matrix
pathfinding
10
[[8, 0], [7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [3, 1], [3, 2], [3, 3], [2, 4], [1, 5], [0, 6]]
12
0.031847238540649414
12
8
2
["[[1, 0, 0, 1, 1, 1, 0, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 1, 1, 0, 0, 1, 1, 1, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0, 1, 1, 1], [0, 0, 1, 0, 1, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0, 1, 1, 0, 1]]", 3]
["[[1, 0, 0, 1, 1, 1, 0, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 1, 1, 0, 0, 1, 1, 1, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0, 1, 1, 1], [0, 0, 1, 0, 1, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0, 1, 1, 0, 1]]", [8, 0], [0, 6], 3]
["[[1, 0, 0, 1, 1, 1, 0, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 1, 1, 0, 0, 1, 1, 1, 1, 0], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0, 1, 1, 1], [0, 0, 1, 0, 1, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0, 1, 1, 0, 1]]", "(8, 0)", "(0, 6)", "3"]
28
Given 7 labeled water jugs with capacities 149, 128, 67, 43, 55, 38, 129 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 385, 387, 491 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
5
[["+", 128, 3], ["+", 129, 3], ["+", 67, 3], ["+", 129, 3], ["+", 38, 3], ["+", 129, 2], ["+", 129, 2], ["+", 129, 2], ["+", 128, 1], ["+", 128, 1], ["+", 129, 1]]
11
0.039963722229003906
11
42
3
[[149, 128, 67, 43, 55, 38, 129], [385, 387, 491]]
[[149, 128, 67, 43, 55, 38, 129], [385, 387, 491]]
["[149, 128, 67, 43, 55, 38, 129]", "[385, 387, 491]"]
29
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[30, 12, 67], [21, '_', 28], [80, 16, 37]]
8_puzzle
puzzle
6
[12, 30, 21, 80, 16, 12, 30, 21, 80, 30, 28, 37, 12, 28, 21, 67, 37, 21, 28, 12]
20
0.03293919563293457
20
4
9
[[[30, 12, 67], [21, "_", 28], [80, 16, 37]]]
[[[30, 12, 67], [21, "_", 28], [80, 16, 37]]]
["[[30, 12, 67], [21, '_', 28], [80, 16, 37]]"]
29
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: tala, udasi, glair, wench The initial board: [['d', 't', 's', 'l', 'a'], ['u', 'a', 'a', 'e', 'i'], ['_', 'l', 'g', 'i', 'a'], ['w', 'r', 'n', 'c', 'h']]
8_puzzle_words
puzzle
2
["down-right", "up-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-right", "down-right", "down-left", "up-left", "up-left", "up-right", "down-right", "down-left", "down-right", "up-right", "up-left", "down-left", "up-left", "up-left"]
22
0.3418314456939697
22
4
20
[[["d", "t", "s", "l", "a"], ["u", "a", "a", "e", "i"], ["_", "l", "g", "i", "a"], ["w", "r", "n", "c", "h"]]]
[[["d", "t", "s", "l", "a"], ["u", "a", "a", "e", "i"], ["_", "l", "g", "i", "a"], ["w", "r", "n", "c", "h"]], ["tala", "udasi", "glair", "wench"]]
["[['d', 't', 's', 'l', 'a'], ['u', 'a', 'a', 'e', 'i'], ['_', 'l', 'g', 'i', 'a'], ['w', 'r', 'n', 'c', 'h']]", "['tala', 'udasi', 'glair', 'wench']"]
29
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 S 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 S, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. R S W B P G Q E N D J R 0 0 0 0 0 0 0 1 0 1 1 S 0 0 1 0 0 1 0 0 1 0 1 W 1 0 0 0 0 0 0 0 0 0 0 B 0 0 0 0 1 0 0 0 0 0 1 P 0 1 0 0 0 0 0 0 0 1 0 G 0 0 0 1 0 0 0 0 0 0 0 Q 0 0 1 1 1 0 0 0 1 1 0 E 1 1 0 0 1 1 1 0 0 0 0 N 0 0 0 0 1 1 0 0 0 1 0 D 0 0 1 0 0 0 0 1 0 0 0 J 0 1 0 0 1 0 1 0 0 0 0
city_directed_graph
pathfinding
11
["G", "B", "J", "S", "N", "D", "E", "R", "E", "S"]
10
0.029485225677490234
10
11
14
[[[0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0], [1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0]], ["R", "S", "W", "B", "P", "G", "Q", "E", "N", "D", "J"], "S", "E"]
[[[0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0], [1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0]], ["R", "S", "W", "B", "P", "G", "Q", "E", "N", "D", "J"], "G", "S", "E"]
["[[0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0], [1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0]]", "['R', 'S', 'W', 'B', 'P', 'G', 'Q', 'E', 'N', 'D', 'J']", "['G']", "['S', 'E']"]
29
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [5, 21, 4, 18, 17, 13, 27, 10, 27, 21, 25, 22, 27, 29, 28, 15, 16, 12, 7, 19, 8, 19, 9, 21, 29, 15, 15, 23, 8, 13, 20, 9, 13, 16, 3, 14, 11, 15, 2, 23, 18, 4], such that the sum of the chosen coins adds up to 295. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {14: 2, 12: 11, 20: 5, 4: 2, 23: 12, 28: 1, 25: 8, 27: 3, 19: 1, 21: 6, 16: 2, 29: 7, 13: 5, 17: 2, 22: 15, 10: 1, 15: 1, 3: 2, 8: 5, 5: 4, 9: 1, 7: 2, 2: 2, 18: 17, 11: 1}, 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
[28, 14, 15, 19, 10, 15, 15, 15, 27, 16, 19, 27, 27, 4, 11, 17, 16]
28
0.045546770095825195
17
42
42
[[5, 21, 4, 18, 17, 13, 27, 10, 27, 21, 25, 22, 27, 29, 28, 15, 16, 12, 7, 19, 8, 19, 9, 21, 29, 15, 15, 23, 8, 13, 20, 9, 13, 16, 3, 14, 11, 15, 2, 23, 18, 4]]
[[5, 21, 4, 18, 17, 13, 27, 10, 27, 21, 25, 22, 27, 29, 28, 15, 16, 12, 7, 19, 8, 19, 9, 21, 29, 15, 15, 23, 8, 13, 20, 9, 13, 16, 3, 14, 11, 15, 2, 23, 18, 4], {"14": 2, "12": 11, "20": 5, "4": 2, "23": 12, "28": 1, "25": 8, "27": 3, "19": 1, "21": 6, "16": 2, "29": 7, "13": 5, "17": 2, "22": 15, "10": 1, "15": 1, "3": 2, "8": 5, "5": 4, "9": 1, "7": 2, "2": 2, "18": 17, "11": 1}, 295]
["[5, 21, 4, 18, 17, 13, 27, 10, 27, 21, 25, 22, 27, 29, 28, 15, 16, 12, 7, 19, 8, 19, 9, 21, 29, 15, 15, 23, 8, 13, 20, 9, 13, 16, 3, 14, 11, 15, 2, 23, 18, 4]", "{14: 2, 12: 11, 20: 5, 4: 2, 23: 12, 28: 1, 25: 8, 27: 3, 19: 1, 21: 6, 16: 2, 29: 7, 13: 5, 17: 2, 22: 15, 10: 1, 15: 1, 3: 2, 8: 5, 5: 4, 9: 1, 7: 2, 2: 2, 18: 17, 11: 1}", "295"]
29
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
1.9683549404144287
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"]
29
We have a 3x3 numerical grid, with numbers ranging from 40 to 88 (40 included in the range but 88 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' 'x' '65'] ['x' '47' '56'] ['48' '44' 'x']]
consecutive_grid
underdetermined_system
8
[[0, 0, 40], [0, 1, 49], [1, 0, 42], [2, 2, 41]]
444
0.1726534366607666
4
48
9
["[['', '', '65'], ['', '47', '56'], ['48', '44', '']]", 40, 88]
["[['', '', '65'], ['', '47', '56'], ['48', '44', '']]", 40, 88]
["[['', '', '65'], ['', '47', '56'], ['48', '44', '']]", "40", "88"]
29
In the magic square problem, a 3x3 grid is filled with unique integers ranging from 34 to 78. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 180, and sum of row 1 must be 156. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 127. 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' '77' 'x'] ['49' 'x' 'x'] ['x' 'x' 'x']]
magic_square
underdetermined_system
7
[[0, 0, 35], [0, 2, 34], [1, 1, 57], [1, 2, 50], [2, 0, 36], [2, 1, 46], [2, 2, 37]]
421
1.5807371139526367
7
34
9
["[['', '77', ''], ['49', '', ''], ['', '', '']]", 3, 34, 78]
["[['', '77', ''], ['49', '', ''], ['', '', '']]", 34, 78, [1, 2], [1, 2], [180], [156], 127]
["[['', '77', ''], ['49', '', ''], ['', '', '']]", "34", "78", "[None, 180, None]", "[None, 156, None]", "127"]
29
In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 3 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 1, 1: 5, 2: 6, 3: 7, 4: 7, 5: 5}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Yellow', 'Green', 'Green', 'Blue'], [], [], ['Red', 'Green', 'Blue', 'Yellow'], [], ['Yellow', 'Blue', 'Red', 'Red']]
restricted_sorting
sorting
1
[[0, 1], [0, 2], [0, 2], [5, 1], [5, 0], [3, 5], [3, 2], [3, 0], [3, 1]]
40
0.0707550048828125
9
30
12
[[["Yellow", "Green", "Green", "Blue"], [], [], ["Red", "Green", "Blue", "Yellow"], [], ["Yellow", "Blue", "Red", "Red"]], 4, {"0": 1, "1": 5, "2": 6, "3": 7, "4": 7, "5": 5}]
[[["Yellow", "Green", "Green", "Blue"], [], [], ["Red", "Green", "Blue", "Yellow"], [], ["Yellow", "Blue", "Red", "Red"]], 4, {"0": 1, "1": 5, "2": 6, "3": 7, "4": 7, "5": 5}, 3]
["[['Yellow', 'Green', 'Green', 'Blue'], [], [], ['Red', 'Green', 'Blue', 'Yellow'], [], ['Yellow', 'Blue', 'Red', 'Red']]", "{0: 1, 1: 5, 2: 6, 3: 7, 4: 7, 5: 5}", "4", "3"]
29
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 (6, 1), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 5, and district 3 covering rows 6 to 9. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x x x 4 6 x 9 15 11 2] [19 x 14 3 10 18 x x x 1] [x 9 x 11 7 14 x x 16 18] [x 5 4 5 2 4 7 5 19 14] [x 3 20 x 5 16 x x 1 9] [x 3 15 9 4 x x x x 4] [11 18 19 8 17 9 x 10 10 19] [x x x 17 7 x x 7 12 8] [x x 11 19 x 13 10 13 x x] [18 x x x 6 10 7 x 8 x]
traffic
pathfinding
2
[[3, 9], [3, 8], [3, 7], [3, 6], [3, 5], [3, 4], [3, 3], [3, 2], [3, 1], [4, 1], [5, 1], [6, 1]]
75
0.03969311714172363
12
4
4
[[["x", "x", "x", "4", "6", "x", "9", "15", "11", "2"], ["19", "x", "14", "3", "10", "18", "x", "x", "x", "1"], ["x", "9", "x", "11", "7", "14", "x", "x", "16", "18"], ["x", "5", "4", "5", "2", "4", "7", "5", "19", "14"], ["x", "3", "20", "x", "5", "16", "x", "x", "1", "9"], ["x", "3", "15", "9", "4", "x", "x", "x", "x", "4"], ["11", "18", "19", "8", "17", "9", "x", "10", "10", "19"], ["x", "x", "x", "17", "7", "x", "x", "7", "12", "8"], ["x", "x", "11", "19", "x", "13", "10", "13", "x", "x"], ["18", "x", "x", "x", "6", "10", "7", "x", "8", "x"]]]
[[["x", "x", "x", "4", "6", "x", "9", "15", "11", "2"], ["19", "x", "14", "3", "10", "18", "x", "x", "x", "1"], ["x", "9", "x", "11", "7", "14", "x", "x", "16", "18"], ["x", "5", "4", "5", "2", "4", "7", "5", "19", "14"], ["x", "3", "20", "x", "5", "16", "x", "x", "1", "9"], ["x", "3", "15", "9", "4", "x", "x", "x", "x", "4"], ["11", "18", "19", "8", "17", "9", "x", "10", "10", "19"], ["x", "x", "x", "17", "7", "x", "x", "7", "12", "8"], ["x", "x", "11", "19", "x", "13", "10", "13", "x", "x"], ["18", "x", "x", "x", "6", "10", "7", "x", "8", "x"]], [3, 9], [6, 1], 3, 5]
["[['x', 'x', 'x', '4', '6', 'x', '9', '15', '11', '2'], ['19', 'x', '14', '3', '10', '18', 'x', 'x', 'x', '1'], ['x', '9', 'x', '11', '7', '14', 'x', 'x', '16', '18'], ['x', '5', '4', '5', '2', '4', '7', '5', '19', '14'], ['x', '3', '20', 'x', '5', '16', 'x', 'x', '1', '9'], ['x', '3', '15', '9', '4', 'x', 'x', 'x', 'x', '4'], ['11', '18', '19', '8', '17', '9', 'x', '10', '10', '19'], ['x', 'x', 'x', '17', '7', 'x', 'x', '7', '12', '8'], ['x', 'x', '11', '19', 'x', '13', '10', '13', 'x', 'x'], ['18', 'x', 'x', 'x', '6', '10', '7', 'x', '8', 'x']]", "(3, 9)", "(6, 1)", "3", "5"]
29
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (9, 0) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (1, 5). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 1 0 0 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 0 1 0 1 1 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 0 1 1 1 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 1 0 1 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 0 0 1 1
trampoline_matrix
pathfinding
10
[[9, 0], [8, 1], [7, 2], [6, 2], [5, 2], [4, 2], [3, 2], [3, 3], [3, 4], [2, 5], [1, 5]]
11
0.029387712478637695
11
8
2
["[[1, 1, 1, 0, 0, 0, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 0, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 0, 0, 0, 1, 1, 1, 0, 1], [1, 1, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0, 1, 1]]", 3]
["[[1, 1, 1, 0, 0, 0, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 0, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 0, 0, 0, 1, 1, 1, 0, 1], [1, 1, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0, 1, 1]]", [9, 0], [1, 5], 3]
["[[1, 1, 1, 0, 0, 0, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 0, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 0, 0, 0, 1, 1, 1, 0, 1], [1, 1, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0, 1, 1]]", "(9, 0)", "(1, 5)", "3"]
29
Given 7 labeled water jugs with capacities 150, 84, 29, 140, 98, 83, 32 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 243, 250, 446 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
5
[["+", 140, 3], ["+", 140, 3], ["+", 83, 3], ["+", 83, 3], ["+", 83, 2], ["+", 83, 2], ["+", 84, 2], ["+", 83, 1], ["+", 150, 1], ["-", 140, 1], ["+", 150, 1]]
11
0.039078712463378906
11
42
3
[[150, 84, 29, 140, 98, 83, 32], [243, 250, 446]]
[[150, 84, 29, 140, 98, 83, 32], [243, 250, 446]]
["[150, 84, 29, 140, 98, 83, 32]", "[243, 250, 446]"]
30
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[78, 69, '_'], [68, 49, 95], [74, 15, 39]]
8_puzzle
puzzle
6
[95, 49, 15, 74, 68, 15, 74, 39, 49, 74, 15, 68, 39, 15, 68, 78, 69, 95, 74, 68, 78, 69, 95, 78, 68, 49]
26
0.1302354335784912
26
4
9
[[[78, 69, "_"], [68, 49, 95], [74, 15, 39]]]
[[[78, 69, "_"], [68, 49, 95], [74, 15, 39]]]
["[[78, 69, '_'], [68, 49, 95], [74, 15, 39]]"]
30
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: lete, sarus, bryan, whing The initial board: [['a', 'l', '_', 't', 'e'], ['s', 'h', 'r', 'b', 's'], ['e', 'r', 'u', 'a', 'n'], ['w', 'y', 'i', 'n', 'g']]
8_puzzle_words
puzzle
2
["down-left", "down-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-left", "up-left"]
16
0.23216724395751953
16
4
20
[[["a", "l", "_", "t", "e"], ["s", "h", "r", "b", "s"], ["e", "r", "u", "a", "n"], ["w", "y", "i", "n", "g"]]]
[[["a", "l", "_", "t", "e"], ["s", "h", "r", "b", "s"], ["e", "r", "u", "a", "n"], ["w", "y", "i", "n", "g"]], ["lete", "sarus", "bryan", "whing"]]
["[['a', 'l', '_', 't', 'e'], ['s', 'h', 'r', 'b', 's'], ['e', 'r', 'u', 'a', 'n'], ['w', 'y', 'i', 'n', 'g']]", "['lete', 'sarus', 'bryan', 'whing']"]
30
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 P and city H excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from H and P, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. S V U W G E H P T Q Z S 0 1 1 0 0 1 1 0 0 0 0 V 0 0 0 0 0 0 0 1 0 0 0 U 0 1 0 0 0 0 0 1 0 1 0 W 1 1 0 0 0 0 0 0 0 0 1 G 0 1 1 0 0 0 0 0 0 0 0 E 1 0 0 0 0 0 0 0 1 0 0 H 0 1 0 1 0 0 0 0 0 0 1 P 0 0 0 0 0 1 1 0 1 0 0 T 0 0 0 0 1 0 0 1 0 1 0 Q 0 0 0 0 0 0 1 1 0 0 0 Z 0 1 0 0 0 0 0 1 0 1 0
city_directed_graph
pathfinding
11
["G", "U", "P", "H", "V", "P", "H"]
7
0.02849578857421875
7
11
14
[[[0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 1, 0, 0, 0, 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, 1], [0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0]], ["S", "V", "U", "W", "G", "E", "H", "P", "T", "Q", "Z"], "P", "H"]
[[[0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 1, 0, 0, 0, 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, 1], [0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0]], ["S", "V", "U", "W", "G", "E", "H", "P", "T", "Q", "Z"], "G", "P", "H"]
["[[0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 1, 0, 0, 0, 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, 1], [0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0]]", "['S', 'V', 'U', 'W', 'G', 'E', 'H', 'P', 'T', 'Q', 'Z']", "['G']", "['P', 'H']"]
30
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [46, 10, 4, 8, 2, 22, 26, 49, 4, 19, 2, 9, 23, 28, 6, 21, 9, 14, 15, 21, 22, 3, 14, 2, 28, 13, 20, 2, 28, 7, 16, 27, 22, 18, 28, 10, 14, 14, 4, 20, 18], such that the sum of the chosen coins adds up to 294. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {21: 14, 19: 16, 4: 3, 23: 10, 10: 3, 18: 7, 9: 3, 27: 13, 20: 12, 13: 9, 26: 17, 3: 3, 6: 6, 49: 16, 2: 2, 15: 7, 28: 13, 46: 10, 8: 3, 7: 6, 22: 20, 14: 5, 16: 8}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
23
[14, 10, 8, 9, 49, 46, 18, 14, 23, 18, 14, 10, 27, 16, 14, 4]
106
0.04515695571899414
16
41
41
[[46, 10, 4, 8, 2, 22, 26, 49, 4, 19, 2, 9, 23, 28, 6, 21, 9, 14, 15, 21, 22, 3, 14, 2, 28, 13, 20, 2, 28, 7, 16, 27, 22, 18, 28, 10, 14, 14, 4, 20, 18]]
[[46, 10, 4, 8, 2, 22, 26, 49, 4, 19, 2, 9, 23, 28, 6, 21, 9, 14, 15, 21, 22, 3, 14, 2, 28, 13, 20, 2, 28, 7, 16, 27, 22, 18, 28, 10, 14, 14, 4, 20, 18], {"21": 14, "19": 16, "4": 3, "23": 10, "10": 3, "18": 7, "9": 3, "27": 13, "20": 12, "13": 9, "26": 17, "3": 3, "6": 6, "49": 16, "2": 2, "15": 7, "28": 13, "46": 10, "8": 3, "7": 6, "22": 20, "14": 5, "16": 8}, 294]
["[46, 10, 4, 8, 2, 22, 26, 49, 4, 19, 2, 9, 23, 28, 6, 21, 9, 14, 15, 21, 22, 3, 14, 2, 28, 13, 20, 2, 28, 7, 16, 27, 22, 18, 28, 10, 14, 14, 4, 20, 18]", "{21: 14, 19: 16, 4: 3, 23: 10, 10: 3, 18: 7, 9: 3, 27: 13, 20: 12, 13: 9, 26: 17, 3: 3, 6: 6, 49: 16, 2: 2, 15: 7, 28: 13, 46: 10, 8: 3, 7: 6, 22: 20, 14: 5, 16: 8}", "294"]
30
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', 'Green', 'Green'], ['Blue', 'Red', 'Green', 'Blue'], ['Green', 'Blue', 'Red', 'Red']]
color_sorting
sorting
8
[[0, 1], [0, 1], [2, 0], [2, 0], [1, 0], [1, 2], [1, 0], [1, 2], [1, 2], [0, 1], [0, 1], [0, 1], [2, 0]]
13
0.31441617012023926
13
6
12
[[["Red", "Blue", "Green", "Green"], ["Blue", "Red", "Green", "Blue"], ["Green", "Blue", "Red", "Red"]], 7]
[[["Red", "Blue", "Green", "Green"], ["Blue", "Red", "Green", "Blue"], ["Green", "Blue", "Red", "Red"]], 7]
["[['Red', 'Blue', 'Green', 'Green'], ['Blue', 'Red', 'Green', 'Blue'], ['Green', 'Blue', 'Red', 'Red']]", "7"]
30
We have a 3x3 numerical grid, with numbers ranging from 39 to 87 (39 included in the range but 87 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' '57' 'x'] ['42' 'x' '72'] ['39' 'x' '73']]
consecutive_grid
underdetermined_system
8
[[0, 0, 58], [0, 2, 40], [1, 1, 43], [2, 1, 41]]
514
0.1707303524017334
4
48
9
["[['', '57', ''], ['42', '', '72'], ['39', '', '73']]", 39, 87]
["[['', '57', ''], ['42', '', '72'], ['39', '', '73']]", 39, 87]
["[['', '57', ''], ['42', '', '72'], ['39', '', '73']]", "39", "87"]
30
In the magic square problem, a 3x3 grid is filled with unique integers ranging from 34 to 78. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 172, and sum of row 1 must be 212. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 165. 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' '59'] ['x' 'x' 'x'] ['38' 'x' 'x']]
magic_square
underdetermined_system
7
[[0, 0, 34], [0, 1, 37], [1, 0, 69], [1, 1, 68], [1, 2, 75], [2, 1, 67], [2, 2, 35]]
482
8.460258960723877
7
34
9
["[['', '', '59'], ['', '', ''], ['38', '', '']]", 3, 34, 78]
["[['', '', '59'], ['', '', ''], ['38', '', '']]", 34, 78, [1, 2], [1, 2], [172], [212], 165]
["[['', '', '59'], ['', '', ''], ['38', '', '']]", "34", "78", "[None, 172, None]", "[None, 212, None]", "165"]
30
In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 3 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 3, 1: 6, 2: 3, 3: 2, 4: 1, 5: 1}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], ['Blue', 'Red', 'Blue', 'Red'], [], ['Green', 'Green', 'Green', 'Red'], ['Yellow', 'Yellow', 'Yellow', 'Blue'], []]
restricted_sorting
sorting
1
[[3, 0], [3, 0], [3, 0], [4, 2], [4, 2], [4, 2], [1, 4], [1, 3], [1, 4], [1, 3]]
24
0.20731306076049805
10
30
12
[[[], ["Blue", "Red", "Blue", "Red"], [], ["Green", "Green", "Green", "Red"], ["Yellow", "Yellow", "Yellow", "Blue"], []], 4, {"0": 3, "1": 6, "2": 3, "3": 2, "4": 1, "5": 1}]
[[[], ["Blue", "Red", "Blue", "Red"], [], ["Green", "Green", "Green", "Red"], ["Yellow", "Yellow", "Yellow", "Blue"], []], 4, {"0": 3, "1": 6, "2": 3, "3": 2, "4": 1, "5": 1}, 3]
["[[], ['Blue', 'Red', 'Blue', 'Red'], [], ['Green', 'Green', 'Green', 'Red'], ['Yellow', 'Yellow', 'Yellow', 'Blue'], []]", "{0: 3, 1: 6, 2: 3, 3: 2, 4: 1, 5: 1}", "4", "3"]
30
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, 9) to his destination workshop at index (6, 1), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 5, and district 3 covering rows 6 to 9. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [8 x x 9 15 13 11 2 x x] [13 x x x 5 x x 7 x x] [12 3 x x x x x 10 x x] [12 x x 9 15 9 11 5 17 x] [3 5 12 x 11 5 x 15 1 18] [14 3 x x 18 14 19 19 12 15] [x 20 17 15 11 x x x x x] [12 13 18 x x 5 x 2 x 13] [x x 13 19 4 x 12 x x 8] [x x 10 x x x 15 x 4 16]
traffic
pathfinding
2
[[4, 9], [4, 8], [4, 7], [3, 7], [3, 6], [3, 5], [4, 5], [4, 4], [5, 4], [6, 4], [6, 3], [6, 2], [6, 1]]
138
0.0320286750793457
13
4
4
[[["8", "x", "x", "9", "15", "13", "11", "2", "x", "x"], ["13", "x", "x", "x", "5", "x", "x", "7", "x", "x"], ["12", "3", "x", "x", "x", "x", "x", "10", "x", "x"], ["12", "x", "x", "9", "15", "9", "11", "5", "17", "x"], ["3", "5", "12", "x", "11", "5", "x", "15", "1", "18"], ["14", "3", "x", "x", "18", "14", "19", "19", "12", "15"], ["x", "20", "17", "15", "11", "x", "x", "x", "x", "x"], ["12", "13", "18", "x", "x", "5", "x", "2", "x", "13"], ["x", "x", "13", "19", "4", "x", "12", "x", "x", "8"], ["x", "x", "10", "x", "x", "x", "15", "x", "4", "16"]]]
[[["8", "x", "x", "9", "15", "13", "11", "2", "x", "x"], ["13", "x", "x", "x", "5", "x", "x", "7", "x", "x"], ["12", "3", "x", "x", "x", "x", "x", "10", "x", "x"], ["12", "x", "x", "9", "15", "9", "11", "5", "17", "x"], ["3", "5", "12", "x", "11", "5", "x", "15", "1", "18"], ["14", "3", "x", "x", "18", "14", "19", "19", "12", "15"], ["x", "20", "17", "15", "11", "x", "x", "x", "x", "x"], ["12", "13", "18", "x", "x", "5", "x", "2", "x", "13"], ["x", "x", "13", "19", "4", "x", "12", "x", "x", "8"], ["x", "x", "10", "x", "x", "x", "15", "x", "4", "16"]], [4, 9], [6, 1], 3, 5]
["[['8', 'x', 'x', '9', '15', '13', '11', '2', 'x', 'x'], ['13', 'x', 'x', 'x', '5', 'x', 'x', '7', 'x', 'x'], ['12', '3', 'x', 'x', 'x', 'x', 'x', '10', 'x', 'x'], ['12', 'x', 'x', '9', '15', '9', '11', '5', '17', 'x'], ['3', '5', '12', 'x', '11', '5', 'x', '15', '1', '18'], ['14', '3', 'x', 'x', '18', '14', '19', '19', '12', '15'], ['x', '20', '17', '15', '11', 'x', 'x', 'x', 'x', 'x'], ['12', '13', '18', 'x', 'x', '5', 'x', '2', 'x', '13'], ['x', 'x', '13', '19', '4', 'x', '12', 'x', 'x', '8'], ['x', 'x', '10', 'x', 'x', 'x', '15', 'x', '4', '16']]", "(4, 9)", "(6, 1)", "3", "5"]
30
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (0, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (7, 3). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 1 0 1 0 0 0 0 0 0 1 1 0 1 0 0 1 0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 0 0 0 1 1 1 0 0 1 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0
trampoline_matrix
pathfinding
10
[[0, 9], [1, 8], [1, 7], [2, 7], [2, 6], [3, 6], [4, 6], [4, 5], [5, 5], [6, 4], [7, 3]]
11
0.02998661994934082
11
8
2
["[[0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 0, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 0, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 0, 0, 0, 1], [1, 1, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1], [0, 1, 0, 0, 1, 0, 0, 1, 0, 0]]", 3]
["[[0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 0, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 0, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 0, 0, 0, 1], [1, 1, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1], [0, 1, 0, 0, 1, 0, 0, 1, 0, 0]]", [0, 9], [7, 3], 3]
["[[0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 0, 0, 1, 0, 1], [1, 1, 1, 0, 0, 0, 0, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 0, 0, 0, 1], [1, 1, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1], [0, 1, 0, 0, 1, 0, 0, 1, 0, 0]]", "(0, 9)", "(7, 3)", "3"]
30
Given 7 labeled water jugs with capacities 111, 84, 17, 22, 63, 75, 148, 64 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 253, 280, 448 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
5
[["+", 63, 3], ["+", 111, 3], ["+", 148, 3], ["-", 22, 3], ["+", 148, 3], ["+", 22, 2], ["+", 84, 2], ["+", 111, 2], ["+", 63, 2], ["+", 75, 1], ["+", 84, 1], ["-", 17, 1], ["+", 111, 1]]
13
0.0519099235534668
13
48
3
[[111, 84, 17, 22, 63, 75, 148, 64], [253, 280, 448]]
[[111, 84, 17, 22, 63, 75, 148, 64], [253, 280, 448]]
["[111, 84, 17, 22, 63, 75, 148, 64]", "[253, 280, 448]"]
31
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[75, 53, 73, 62], ['_', 14, 90, 43], [21, 17, 51, 27]]
8_puzzle
puzzle
3
[21, 17, 14, 90, 51, 14, 17, 21, 90, 53, 75, 90, 53, 51, 43, 27]
16
0.03641033172607422
16
4
12
[[[75, 53, 73, 62], ["_", 14, 90, 43], [21, 17, 51, 27]]]
[[[75, 53, 73, 62], ["_", 14, 90, 43], [21, 17, 51, 27]]]
["[[75, 53, 73, 62], ['_', 14, 90, 43], [21, 17, 51, 27]]"]
31
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: dyke, atoll, amuze, niuan The initial board: [['t', 'd', 'u', 'k', 'e'], ['a', 'a', 'o', 'l', 'l'], ['a', 'm', '_', 'z', 'i'], ['n', 'e', 'u', 'y', 'n']]
8_puzzle_words
puzzle
2
["down-left", "up-left", "up-right", "up-right", "down-right", "down-right", "down-left", "up-left", "down-left", "up-left", "up-right", "up-right", "down-right", "down-right", "down-left", "up-left", "up-left", "up-right", "down-right", "down-left", "up-left", "down-left", "down-right", "up-right", "up-left", "up-left"]
26
0.4536299705505371
26
4
20
[[["t", "d", "u", "k", "e"], ["a", "a", "o", "l", "l"], ["a", "m", "_", "z", "i"], ["n", "e", "u", "y", "n"]]]
[[["t", "d", "u", "k", "e"], ["a", "a", "o", "l", "l"], ["a", "m", "_", "z", "i"], ["n", "e", "u", "y", "n"]], ["dyke", "atoll", "amuze", "niuan"]]
["[['t', 'd', 'u', 'k', 'e'], ['a', 'a', 'o', 'l', 'l'], ['a', 'm', '_', 'z', 'i'], ['n', 'e', 'u', 'y', 'n']]", "['dyke', 'atoll', 'amuze', 'niuan']"]
31
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 'J'. Our task is to visit city U 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 U, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. S A J U E B N P L X F S 0 0 0 0 1 0 0 0 0 0 0 A 0 0 0 1 0 1 0 0 1 0 1 J 0 0 0 0 0 1 0 0 1 0 0 U 1 0 0 0 0 0 1 1 0 0 0 E 0 1 0 0 0 0 0 0 0 0 0 B 0 0 0 0 1 0 1 1 0 1 0 N 0 1 0 1 1 1 0 0 0 1 1 P 1 0 0 0 0 0 1 0 1 0 0 L 0 0 1 0 0 1 0 0 0 1 0 X 0 0 1 1 0 0 0 0 1 0 0 F 0 1 0 1 0 0 0 0 1 0 0
city_directed_graph
pathfinding
11
["J", "B", "E", "A", "U", "N", "U", "S", "E"]
9
0.02808380126953125
9
11
14
[[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0]], ["S", "A", "J", "U", "E", "B", "N", "P", "L", "X", "F"], "U", "E"]
[[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0]], ["S", "A", "J", "U", "E", "B", "N", "P", "L", "X", "F"], "J", "U", "E"]
["[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0]]", "['S', 'A', 'J', 'U', 'E', 'B', 'N', 'P', 'L', 'X', 'F']", "['J']", "['U', 'E']"]
31
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [12, 23, 57, 18, 6, 5, 21, 15, 14, 23, 5, 16, 9, 8, 19, 8, 19, 6, 8, 3, 12, 2, 14, 3, 3, 4, 26, 6, 6, 25, 9, 13, 20, 24, 6, 26, 14, 25, 5, 26], such that the sum of the chosen coins adds up to 260. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {6: 2, 12: 3, 9: 2, 2: 1, 14: 1, 16: 12, 21: 10, 4: 1, 8: 5, 26: 7, 23: 7, 57: 11, 15: 15, 19: 13, 25: 15, 13: 4, 5: 3, 24: 4, 3: 3, 18: 4, 20: 10}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
24
[24, 14, 57, 14, 12, 6, 9, 9, 6, 23, 18, 14, 12, 23, 6, 13]
56
0.04410982131958008
16
40
40
[[12, 23, 57, 18, 6, 5, 21, 15, 14, 23, 5, 16, 9, 8, 19, 8, 19, 6, 8, 3, 12, 2, 14, 3, 3, 4, 26, 6, 6, 25, 9, 13, 20, 24, 6, 26, 14, 25, 5, 26]]
[[12, 23, 57, 18, 6, 5, 21, 15, 14, 23, 5, 16, 9, 8, 19, 8, 19, 6, 8, 3, 12, 2, 14, 3, 3, 4, 26, 6, 6, 25, 9, 13, 20, 24, 6, 26, 14, 25, 5, 26], {"6": 2, "12": 3, "9": 2, "2": 1, "14": 1, "16": 12, "21": 10, "4": 1, "8": 5, "26": 7, "23": 7, "57": 11, "15": 15, "19": 13, "25": 15, "13": 4, "5": 3, "24": 4, "3": 3, "18": 4, "20": 10}, 260]
["[12, 23, 57, 18, 6, 5, 21, 15, 14, 23, 5, 16, 9, 8, 19, 8, 19, 6, 8, 3, 12, 2, 14, 3, 3, 4, 26, 6, 6, 25, 9, 13, 20, 24, 6, 26, 14, 25, 5, 26]", "{6: 2, 12: 3, 9: 2, 2: 1, 14: 1, 16: 12, 21: 10, 4: 1, 8: 5, 26: 7, 23: 7, 57: 11, 15: 15, 19: 13, 25: 15, 13: 4, 5: 3, 24: 4, 3: 3, 18: 4, 20: 10}", "260"]
31
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Red', 'Red', 'Green'], ['Blue', 'Green', 'Green', 'Blue'], ['Blue', 'Red', 'Green', 'Blue']]
color_sorting
sorting
8
[[2, 1], [2, 0], [2, 1], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [1, 2], [1, 0], [1, 2], [1, 2], [1, 0], [1, 0], [2, 1], [2, 1], [2, 1]]
17
1.8599176406860352
17
6
12
[[["Red", "Red", "Red", "Green"], ["Blue", "Green", "Green", "Blue"], ["Blue", "Red", "Green", "Blue"]], 7]
[[["Red", "Red", "Red", "Green"], ["Blue", "Green", "Green", "Blue"], ["Blue", "Red", "Green", "Blue"]], 7]
["[['Red', 'Red', 'Red', 'Green'], ['Blue', 'Green', 'Green', 'Blue'], ['Blue', 'Red', 'Green', 'Blue']]", "7"]
31
We have a 3x3 numerical grid, with numbers ranging from 5 to 53 (5 included in the range but 53 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['10' '25' 'x'] ['x' 'x' '45'] ['x' '7' 'x']]
consecutive_grid
underdetermined_system
9
[[0, 2, 46], [1, 0, 9], [1, 1, 11], [2, 0, 8], [2, 2, 5]]
203
9.56848430633545
5
48
9
["[['10', '25', ''], ['', '', '45'], ['', '7', '']]", 5, 53]
["[['10', '25', ''], ['', '', '45'], ['', '7', '']]", 5, 53]
["[['10', '25', ''], ['', '', '45'], ['', '7', '']]", "5", "53"]
31
In the magic square problem, a 3x3 grid is filled with unique integers ranging from 34 to 78. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 177, and sum of row 1 must be 180. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 183. 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' '73' '47'] ['x' 'x' 'x']]
magic_square
underdetermined_system
7
[[0, 0, 34], [0, 1, 36], [0, 2, 38], [1, 0, 60], [2, 0, 72], [2, 1, 68], [2, 2, 35]]
463
20.116249084472656
7
34
9
["[['', '', ''], ['', '73', '47'], ['', '', '']]", 3, 34, 78]
["[['', '', ''], ['', '73', '47'], ['', '', '']]", 34, 78, [1, 2], [1, 2], [177], [180], 183]
["[['', '', ''], ['', '73', '47'], ['', '', '']]", "34", "78", "[None, 177, None]", "[None, 180, None]", "183"]
31
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: 2, 2: 1, 3: 1, 4: 9, 5: 4, 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? [[], [], ['Yellow', 'Yellow', 'Green', 'Black', 'Red'], ['Black', 'Green', 'Black', 'Blue', 'Yellow'], ['Green', 'Blue', 'Yellow', 'Red', 'Blue'], [], [], ['Black', 'Red', 'Green', 'Red', 'Blue']]
restricted_sorting
sorting
2
[[4, 5], [3, 1], [3, 5], [3, 1], [3, 6], [2, 3], [2, 3], [2, 5], [2, 1], [7, 1], [7, 2], [7, 5], [4, 6], [7, 2], [7, 6], [4, 3], [4, 2], [4, 6]]
38
7.533451795578003
18
56
20
[[[], [], ["Yellow", "Yellow", "Green", "Black", "Red"], ["Black", "Green", "Black", "Blue", "Yellow"], ["Green", "Blue", "Yellow", "Red", "Blue"], [], [], ["Black", "Red", "Green", "Red", "Blue"]], 5, {"0": 7, "1": 2, "2": 1, "3": 1, "4": 9, "5": 4, "6": 2, "7": 7}]
[[[], [], ["Yellow", "Yellow", "Green", "Black", "Red"], ["Black", "Green", "Black", "Blue", "Yellow"], ["Green", "Blue", "Yellow", "Red", "Blue"], [], [], ["Black", "Red", "Green", "Red", "Blue"]], 5, {"0": 7, "1": 2, "2": 1, "3": 1, "4": 9, "5": 4, "6": 2, "7": 7}, 4]
["[[], [], ['Yellow', 'Yellow', 'Green', 'Black', 'Red'], ['Black', 'Green', 'Black', 'Blue', 'Yellow'], ['Green', 'Blue', 'Yellow', 'Red', 'Blue'], [], [], ['Black', 'Red', 'Green', 'Red', 'Blue']]", "{0: 7, 1: 2, 2: 1, 3: 1, 4: 9, 5: 4, 6: 2, 7: 7}", "5", "4"]
31
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 7) to his destination workshop at index (7, 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 6, and district 3 covering rows 7 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [10 x 19 11 x x 6 12 x x x] [2 9 10 x x 10 17 x x 11 5] [x 15 8 9 x 7 17 20 x x 13] [1 9 15 14 9 9 13 7 12 x 10] [9 x 17 x x 7 x x 1 x 14] [16 18 11 x 14 18 9 13 x x x] [9 3 5 8 17 15 19 x 3 x 14] [2 13 x x 17 13 14 18 9 x 6] [3 x 18 6 x 14 x x x 8 19] [2 4 x x x x 3 4 x 19 x] [x x x x 11 x x x x 5 5]
traffic
pathfinding
3
[[3, 7], [3, 6], [3, 5], [2, 5], [3, 5], [4, 5], [5, 5], [5, 4], [6, 4], [6, 3], [6, 2], [6, 1], [6, 0], [7, 0]]
121
0.03958845138549805
14
4
4
[[["10", "x", "19", "11", "x", "x", "6", "12", "x", "x", "x"], ["2", "9", "10", "x", "x", "10", "17", "x", "x", "11", "5"], ["x", "15", "8", "9", "x", "7", "17", "20", "x", "x", "13"], ["1", "9", "15", "14", "9", "9", "13", "7", "12", "x", "10"], ["9", "x", "17", "x", "x", "7", "x", "x", "1", "x", "14"], ["16", "18", "11", "x", "14", "18", "9", "13", "x", "x", "x"], ["9", "3", "5", "8", "17", "15", "19", "x", "3", "x", "14"], ["2", "13", "x", "x", "17", "13", "14", "18", "9", "x", "6"], ["3", "x", "18", "6", "x", "14", "x", "x", "x", "8", "19"], ["2", "4", "x", "x", "x", "x", "3", "4", "x", "19", "x"], ["x", "x", "x", "x", "11", "x", "x", "x", "x", "5", "5"]]]
[[["10", "x", "19", "11", "x", "x", "6", "12", "x", "x", "x"], ["2", "9", "10", "x", "x", "10", "17", "x", "x", "11", "5"], ["x", "15", "8", "9", "x", "7", "17", "20", "x", "x", "13"], ["1", "9", "15", "14", "9", "9", "13", "7", "12", "x", "10"], ["9", "x", "17", "x", "x", "7", "x", "x", "1", "x", "14"], ["16", "18", "11", "x", "14", "18", "9", "13", "x", "x", "x"], ["9", "3", "5", "8", "17", "15", "19", "x", "3", "x", "14"], ["2", "13", "x", "x", "17", "13", "14", "18", "9", "x", "6"], ["3", "x", "18", "6", "x", "14", "x", "x", "x", "8", "19"], ["2", "4", "x", "x", "x", "x", "3", "4", "x", "19", "x"], ["x", "x", "x", "x", "11", "x", "x", "x", "x", "5", "5"]], [3, 7], [7, 0], 2, 6]
["[['10', 'x', '19', '11', 'x', 'x', '6', '12', 'x', 'x', 'x'], ['2', '9', '10', 'x', 'x', '10', '17', 'x', 'x', '11', '5'], ['x', '15', '8', '9', 'x', '7', '17', '20', 'x', 'x', '13'], ['1', '9', '15', '14', '9', '9', '13', '7', '12', 'x', '10'], ['9', 'x', '17', 'x', 'x', '7', 'x', 'x', '1', 'x', '14'], ['16', '18', '11', 'x', '14', '18', '9', '13', 'x', 'x', 'x'], ['9', '3', '5', '8', '17', '15', '19', 'x', '3', 'x', '14'], ['2', '13', 'x', 'x', '17', '13', '14', '18', '9', 'x', '6'], ['3', 'x', '18', '6', 'x', '14', 'x', 'x', 'x', '8', '19'], ['2', '4', 'x', 'x', 'x', 'x', '3', '4', 'x', '19', 'x'], ['x', 'x', 'x', 'x', '11', 'x', 'x', 'x', 'x', '5', '5']]", "(3, 7)", "(7, 0)", "2", "6"]
31
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (1, 10) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (9, 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 0 1 1 1 0 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 1 1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 1 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 0 0 1 0 1 1 0 1 0 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 1 0 1 1 1 1 1 0 0 0 1 0 0 1 1 1
trampoline_matrix
pathfinding
11
[[1, 10], [2, 9], [3, 8], [4, 7], [4, 6], [4, 5], [4, 4], [5, 4], [5, 3], [6, 3], [7, 3], [8, 3], [9, 3]]
13
0.029936790466308594
13
8
2
["[[1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0], [1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0], [1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1], [1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1]]", 3]
["[[1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0], [1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0], [1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1], [1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1]]", [1, 10], [9, 3], 3]
["[[1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0], [1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0], [1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1], [1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1]]", "(1, 10)", "(9, 3)", "3"]
31
Given 7 labeled water jugs with capacities 14, 46, 13, 110, 38, 21, 45, 130 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 215, 219, 262 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
5
[["+", 21, 3], ["+", 110, 3], ["+", 110, 3], ["+", 21, 3], ["+", 130, 2], ["-", 21, 2], ["+", 110, 2], ["+", 130, 1], ["-", 45, 1], ["+", 130, 1]]
10
0.0400242805480957
10
48
3
[[14, 46, 13, 110, 38, 21, 45, 130], [215, 219, 262]]
[[14, 46, 13, 110, 38, 21, 45, 130], [215, 219, 262]]
["[14, 46, 13, 110, 38, 21, 45, 130]", "[215, 219, 262]"]
32
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, 56, 8, 67], [15, 47, 44, 30], [73, '_', 24, 63]]
8_puzzle
puzzle
3
[24, 44, 30, 63, 44, 30, 8, 67, 63, 44, 30, 8, 47, 15, 73, 24, 15, 56, 69, 73, 56, 47, 44, 30]
24
0.1358938217163086
24
4
12
[[[69, 56, 8, 67], [15, 47, 44, 30], [73, "_", 24, 63]]]
[[[69, 56, 8, 67], [15, 47, 44, 30], [73, "_", 24, 63]]]
["[[69, 56, 8, 67], [15, 47, 44, 30], [73, '_', 24, 63]]"]
32
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: fack, sofia, nisse, nosey The initial board: [['o', 'f', '_', 'c', 'k'], ['s', 'n', 'f', 's', 'a'], ['o', 'i', 'i', 's', 'e'], ['n', 'e', 's', 'a', 'y']]
8_puzzle_words
puzzle
2
["down-right", "down-left", "down-right", "up-right", "up-left", "down-left", "down-left", "up-left", "up-right", "up-right", "down-right", "down-right", "down-left", "up-left", "up-left", "up-left"]
16
0.24036526679992676
16
4
20
[[["o", "f", "_", "c", "k"], ["s", "n", "f", "s", "a"], ["o", "i", "i", "s", "e"], ["n", "e", "s", "a", "y"]]]
[[["o", "f", "_", "c", "k"], ["s", "n", "f", "s", "a"], ["o", "i", "i", "s", "e"], ["n", "e", "s", "a", "y"]], ["fack", "sofia", "nisse", "nosey"]]
["[['o', 'f', '_', 'c', 'k'], ['s', 'n', 'f', 's', 'a'], ['o', 'i', 'i', 's', 'e'], ['n', 'e', 's', 'a', 'y']]", "['fack', 'sofia', 'nisse', 'nosey']"]
32
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 'J'. Our task is to visit city E 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 E, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. D T L E C J Q O K X F D 0 1 0 1 0 1 1 0 0 0 0 T 0 0 1 1 0 0 1 1 0 0 0 L 0 0 0 1 0 0 0 0 0 0 0 E 0 0 0 0 0 1 1 1 1 0 0 C 1 0 0 0 0 0 0 0 0 0 0 J 0 0 0 0 0 0 0 0 0 0 1 Q 0 0 1 0 0 0 0 1 0 0 1 O 1 0 0 0 0 1 0 0 1 1 0 K 0 1 1 0 1 0 0 0 0 1 0 X 1 0 0 0 0 0 0 0 0 0 0 F 1 1 1 0 1 1 0 0 0 0 0
city_directed_graph
pathfinding
11
["J", "F", "D", "E", "O", "D", "E"]
7
0.02650594711303711
7
11
14
[[[0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0]], ["D", "T", "L", "E", "C", "J", "Q", "O", "K", "X", "F"], "E", "D"]
[[[0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0]], ["D", "T", "L", "E", "C", "J", "Q", "O", "K", "X", "F"], "J", "E", "D"]
["[[0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0]]", "['D', 'T', 'L', 'E', 'C', 'J', 'Q', 'O', 'K', 'X', 'F']", "['J']", "['E', 'D']"]
32
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [19, 2, 25, 9, 6, 24, 4, 26, 17, 11, 11, 2, 17, 2, 5, 6, 3, 3, 3, 18, 26, 18, 21, 3, 5, 8, 12, 15, 8, 18, 24, 5, 19, 7, 18, 25, 12, 13, 12, 2, 25, 16, 17, 16, 3, 3], such that the sum of the chosen coins adds up to 264. 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 {26: 12, 25: 20, 17: 13, 13: 4, 16: 13, 11: 10, 24: 5, 5: 4, 8: 6, 7: 5, 4: 4, 12: 9, 18: 12, 3: 2, 21: 17, 19: 7, 2: 2, 9: 9, 6: 2, 15: 4}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
25
[24, 6, 13, 15, 2, 3, 19, 6, 19, 18, 12, 17, 25, 24, 18, 25, 18]
138
0.046419620513916016
17
46
46
[[19, 2, 25, 9, 6, 24, 4, 26, 17, 11, 11, 2, 17, 2, 5, 6, 3, 3, 3, 18, 26, 18, 21, 3, 5, 8, 12, 15, 8, 18, 24, 5, 19, 7, 18, 25, 12, 13, 12, 2, 25, 16, 17, 16, 3, 3]]
[[19, 2, 25, 9, 6, 24, 4, 26, 17, 11, 11, 2, 17, 2, 5, 6, 3, 3, 3, 18, 26, 18, 21, 3, 5, 8, 12, 15, 8, 18, 24, 5, 19, 7, 18, 25, 12, 13, 12, 2, 25, 16, 17, 16, 3, 3], {"26": 12, "25": 20, "17": 13, "13": 4, "16": 13, "11": 10, "24": 5, "5": 4, "8": 6, "7": 5, "4": 4, "12": 9, "18": 12, "3": 2, "21": 17, "19": 7, "2": 2, "9": 9, "6": 2, "15": 4}, 264]
["[19, 2, 25, 9, 6, 24, 4, 26, 17, 11, 11, 2, 17, 2, 5, 6, 3, 3, 3, 18, 26, 18, 21, 3, 5, 8, 12, 15, 8, 18, 24, 5, 19, 7, 18, 25, 12, 13, 12, 2, 25, 16, 17, 16, 3, 3]", "{26: 12, 25: 20, 17: 13, 13: 4, 16: 13, 11: 10, 24: 5, 5: 4, 8: 6, 7: 5, 4: 4, 12: 9, 18: 12, 3: 2, 21: 17, 19: 7, 2: 2, 9: 9, 6: 2, 15: 4}", "264"]
32
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Green', 'Red', 'Blue', 'Green'], ['Blue', 'Blue', 'Red', 'Blue'], ['Red', 'Red', 'Green', 'Green']]
color_sorting
sorting
8
[[0, 2], [0, 2], [1, 0], [1, 0], [1, 2], [0, 1], [0, 1], [0, 1], [0, 1], [2, 0], [2, 0], [2, 1], [2, 0], [2, 0], [1, 2], [1, 2]]
16
0.9227294921875
16
6
12
[[["Green", "Red", "Blue", "Green"], ["Blue", "Blue", "Red", "Blue"], ["Red", "Red", "Green", "Green"]], 7]
[[["Green", "Red", "Blue", "Green"], ["Blue", "Blue", "Red", "Blue"], ["Red", "Red", "Green", "Green"]], 7]
["[['Green', 'Red', 'Blue', 'Green'], ['Blue', 'Blue', 'Red', 'Blue'], ['Red', 'Red', 'Green', 'Green']]", "7"]
32
We have a 3x3 numerical grid, with numbers ranging from 9 to 57 (9 included in the range but 57 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['49' 'x' 'x'] ['47' 'x' '54'] ['x' '35' 'x']]
consecutive_grid
underdetermined_system
9
[[0, 1, 50], [0, 2, 55], [1, 1, 48], [2, 0, 36], [2, 2, 9]]
378
0.3984415531158447
5
48
9
["[['49', '', ''], ['47', '', '54'], ['', '35', '']]", 9, 57]
["[['49', '', ''], ['47', '', '54'], ['', '35', '']]", 9, 57]
["[['49', '', ''], ['47', '', '54'], ['', '35', '']]", "9", "57"]
32
In the magic square problem, a 3x3 grid is filled with unique integers ranging from 31 to 75. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 135, and sum of row 1 must be 134. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 122. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' 'x' 'x'] ['x' 'x' 'x'] ['41' 'x' 'x']]
magic_square
underdetermined_system
7
[[0, 0, 32], [0, 1, 34], [0, 2, 31], [1, 0, 35], [1, 1, 50], [1, 2, 49], [2, 1, 51], [2, 2, 33]]
356
31.9260516166687
8
34
9
["[['', '', ''], ['', '', ''], ['41', '', '']]", 3, 31, 75]
["[['', '', ''], ['', '', ''], ['41', '', '']]", 31, 75, [1, 2], [1, 2], [135], [134], 122]
["[['', '', ''], ['', '', ''], ['41', '', '']]", "31", "75", "[None, 135, None]", "[None, 134, None]", "122"]
32
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 5, 1: 8, 2: 1, 3: 6, 4: 8, 5: 2, 6: 1, 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? [['Black', 'Yellow', 'Blue', 'Yellow', 'Red'], [], [], [], [], ['Blue', 'Green', 'Blue', 'Green', 'Blue'], ['Yellow', 'Black', 'Green', 'Yellow', 'Black'], ['Red', 'Red', 'Red', 'Green', 'Black']]
restricted_sorting
sorting
2
[[0, 1], [5, 3], [5, 2], [5, 3], [5, 2], [5, 3], [6, 5], [6, 4], [0, 5], [0, 3], [0, 5], [7, 0], [7, 0], [7, 0], [6, 2], [6, 5], [7, 2], [1, 6], [4, 6], [7, 6]]
70
43.11308765411377
20
56
20
[[["Black", "Yellow", "Blue", "Yellow", "Red"], [], [], [], [], ["Blue", "Green", "Blue", "Green", "Blue"], ["Yellow", "Black", "Green", "Yellow", "Black"], ["Red", "Red", "Red", "Green", "Black"]], 5, {"0": 5, "1": 8, "2": 1, "3": 6, "4": 8, "5": 2, "6": 1, "7": 8}]
[[["Black", "Yellow", "Blue", "Yellow", "Red"], [], [], [], [], ["Blue", "Green", "Blue", "Green", "Blue"], ["Yellow", "Black", "Green", "Yellow", "Black"], ["Red", "Red", "Red", "Green", "Black"]], 5, {"0": 5, "1": 8, "2": 1, "3": 6, "4": 8, "5": 2, "6": 1, "7": 8}, 4]
["[['Black', 'Yellow', 'Blue', 'Yellow', 'Red'], [], [], [], [], ['Blue', 'Green', 'Blue', 'Green', 'Blue'], ['Yellow', 'Black', 'Green', 'Yellow', 'Black'], ['Red', 'Red', 'Red', 'Green', 'Black']]", "{0: 5, 1: 8, 2: 1, 3: 6, 4: 8, 5: 2, 6: 1, 7: 8}", "5", "4"]
32
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (5, 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 2, district 2 covering rows 3 to 4, and district 3 covering rows 5 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x x 13 x x 7 x 13 3 x 13] [10 4 x 4 12 2 x 3 4 x 15] [x 3 x x 15 9 x x 18 17 14] [5 x x x 3 x 11 x 17 9 17] [8 3 13 x 5 7 8 17 7 x x] [x x 13 2 2 11 6 8 x x x] [x 1 9 6 5 13 16 1 7 5 x] [4 x 13 x 10 18 3 x x 19 19] [x x x 2 5 9 13 x 7 1 x] [x x 7 x x 5 19 x x x x] [x x x 6 x 19 x x x x 1]
traffic
pathfinding
3
[[5, 2], [5, 3], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [3, 8], [3, 9], [2, 9], [2, 10]]
105
0.029694080352783203
12
4
4
[[["x", "x", "13", "x", "x", "7", "x", "13", "3", "x", "13"], ["10", "4", "x", "4", "12", "2", "x", "3", "4", "x", "15"], ["x", "3", "x", "x", "15", "9", "x", "x", "18", "17", "14"], ["5", "x", "x", "x", "3", "x", "11", "x", "17", "9", "17"], ["8", "3", "13", "x", "5", "7", "8", "17", "7", "x", "x"], ["x", "x", "13", "2", "2", "11", "6", "8", "x", "x", "x"], ["x", "1", "9", "6", "5", "13", "16", "1", "7", "5", "x"], ["4", "x", "13", "x", "10", "18", "3", "x", "x", "19", "19"], ["x", "x", "x", "2", "5", "9", "13", "x", "7", "1", "x"], ["x", "x", "7", "x", "x", "5", "19", "x", "x", "x", "x"], ["x", "x", "x", "6", "x", "19", "x", "x", "x", "x", "1"]]]
[[["x", "x", "13", "x", "x", "7", "x", "13", "3", "x", "13"], ["10", "4", "x", "4", "12", "2", "x", "3", "4", "x", "15"], ["x", "3", "x", "x", "15", "9", "x", "x", "18", "17", "14"], ["5", "x", "x", "x", "3", "x", "11", "x", "17", "9", "17"], ["8", "3", "13", "x", "5", "7", "8", "17", "7", "x", "x"], ["x", "x", "13", "2", "2", "11", "6", "8", "x", "x", "x"], ["x", "1", "9", "6", "5", "13", "16", "1", "7", "5", "x"], ["4", "x", "13", "x", "10", "18", "3", "x", "x", "19", "19"], ["x", "x", "x", "2", "5", "9", "13", "x", "7", "1", "x"], ["x", "x", "7", "x", "x", "5", "19", "x", "x", "x", "x"], ["x", "x", "x", "6", "x", "19", "x", "x", "x", "x", "1"]], [5, 2], [2, 10], 2, 4]
["[['x', 'x', '13', 'x', 'x', '7', 'x', '13', '3', 'x', '13'], ['10', '4', 'x', '4', '12', '2', 'x', '3', '4', 'x', '15'], ['x', '3', 'x', 'x', '15', '9', 'x', 'x', '18', '17', '14'], ['5', 'x', 'x', 'x', '3', 'x', '11', 'x', '17', '9', '17'], ['8', '3', '13', 'x', '5', '7', '8', '17', '7', 'x', 'x'], ['x', 'x', '13', '2', '2', '11', '6', '8', 'x', 'x', 'x'], ['x', '1', '9', '6', '5', '13', '16', '1', '7', '5', 'x'], ['4', 'x', '13', 'x', '10', '18', '3', 'x', 'x', '19', '19'], ['x', 'x', 'x', '2', '5', '9', '13', 'x', '7', '1', 'x'], ['x', 'x', '7', 'x', 'x', '5', '19', 'x', 'x', 'x', 'x'], ['x', 'x', 'x', '6', 'x', '19', 'x', 'x', 'x', 'x', '1']]", "(5, 2)", "(2, 10)", "2", "4"]
32
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (0, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (9, 2). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 1 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 1 0 1 0 1 1 0 1 0 0 0 0 0 1 0 1 0 1 0 0 1 1 1 0 0 1 1 0 0 0 0 1 0 0 1 0 1 0 1 1 0 0 1 0 1 1 0 1 0 1 1 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1
trampoline_matrix
pathfinding
11
[[0, 9], [1, 9], [2, 9], [3, 9], [4, 9], [5, 8], [6, 7], [6, 6], [7, 5], [8, 5], [9, 5], [9, 4], [9, 3], [9, 2]]
14
0.03171658515930176
14
8
2
["[[1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0], [1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1]]", 3]
["[[1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0], [1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1]]", [0, 9], [9, 2], 3]
["[[1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0], [1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1]]", "(0, 9)", "(9, 2)", "3"]
32
Given 7 labeled water jugs with capacities 137, 29, 70, 138, 47, 64, 87, 16 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 295, 327, 442 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
5
[["+", 137, 3], ["+", 138, 3], ["+", 29, 3], ["+", 138, 3], ["+", 87, 2], ["+", 87, 2], ["+", 16, 2], ["+", 137, 2], ["+", 87, 1], ["+", 138, 1], ["+", 70, 1]]
11
0.042920589447021484
11
48
3
[[137, 29, 70, 138, 47, 64, 87, 16], [295, 327, 442]]
[[137, 29, 70, 138, 47, 64, 87, 16], [295, 327, 442]]
["[137, 29, 70, 138, 47, 64, 87, 16]", "[295, 327, 442]"]
33
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, 90, 85, 67], [100, 61, '_', 15], [95, 41, 33, 73]]
8_puzzle
puzzle
3
[61, 100, 95, 41, 33, 73, 15, 61, 73, 15, 61, 67, 85, 90, 100, 95, 79, 100, 95, 73, 67, 61]
22
0.05052661895751953
22
4
12
[[[79, 90, 85, 67], [100, 61, "_", 15], [95, 41, 33, 73]]]
[[[79, 90, 85, 67], [100, 61, "_", 15], [95, 41, 33, 73]]]
["[[79, 90, 85, 67], [100, 61, '_', 15], [95, 41, 33, 73]]"]
33
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: jama, agoho, rudge, scruf The initial board: [['g', 'j', 'u', 'm', 'a'], ['a', 'r', 'o', 'e', 'o'], ['h', 'u', '_', 'g', 'd'], ['s', 'c', 'r', 'a', 'f']]
8_puzzle_words
puzzle
2
["up-right", "down-right", "down-left", "up-left", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-right", "down-right", "down-left", "up-left", "up-left", "up-right", "down-right", "down-left", "down-left", "up-left", "up-right", "up-left"]
22
0.28627824783325195
22
4
20
[[["g", "j", "u", "m", "a"], ["a", "r", "o", "e", "o"], ["h", "u", "_", "g", "d"], ["s", "c", "r", "a", "f"]]]
[[["g", "j", "u", "m", "a"], ["a", "r", "o", "e", "o"], ["h", "u", "_", "g", "d"], ["s", "c", "r", "a", "f"]], ["jama", "agoho", "rudge", "scruf"]]
["[['g', 'j', 'u', 'm', 'a'], ['a', 'r', 'o', 'e', 'o'], ['h', 'u', '_', 'g', 'd'], ['s', 'c', 'r', 'a', 'f']]", "['jama', 'agoho', 'rudge', 'scruf']"]
33
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'D'. Our task is to visit city Q and city G excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from G and Q, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. G P H I J X D V Q L Y G 0 0 0 0 0 1 1 0 0 0 1 P 0 0 1 1 1 0 0 0 0 0 0 H 1 1 0 0 0 1 0 0 1 0 0 I 1 0 0 0 0 0 0 0 0 0 0 J 1 0 1 1 0 0 0 0 0 1 0 X 0 0 0 0 0 0 0 0 1 0 1 D 0 1 0 0 0 1 0 0 0 0 1 V 1 0 0 0 0 1 1 0 0 0 1 Q 1 0 1 0 1 0 1 0 0 1 0 L 0 0 1 0 0 0 0 1 0 0 0 Y 1 0 0 1 1 1 0 0 0 1 0
city_directed_graph
pathfinding
11
["D", "P", "H", "Q", "G", "X", "Q", "G"]
8
0.026433229446411133
8
11
14
[[[0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0]], ["G", "P", "H", "I", "J", "X", "D", "V", "Q", "L", "Y"], "Q", "G"]
[[[0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0]], ["G", "P", "H", "I", "J", "X", "D", "V", "Q", "L", "Y"], "D", "Q", "G"]
["[[0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0]]", "['G', 'P', 'H', 'I', 'J', 'X', 'D', 'V', 'Q', 'L', 'Y']", "['D']", "['Q', 'G']"]
33
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [9, 11, 7, 9, 12, 19, 29, 21, 11, 10, 26, 22, 18, 29, 19, 11, 18, 23, 26, 16, 18, 4, 22, 25, 17, 18, 12, 23, 3, 17, 17, 15, 22, 25, 27, 2, 26, 22, 21, 28, 10, 23, 15], such that the sum of the chosen coins adds up to 296. 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 {28: 16, 10: 8, 21: 8, 18: 12, 27: 6, 7: 7, 2: 2, 19: 4, 17: 13, 26: 11, 12: 1, 9: 5, 25: 15, 29: 20, 11: 2, 15: 8, 22: 1, 16: 13, 4: 4, 3: 3, 23: 18}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
26
[22, 12, 27, 22, 2, 11, 11, 11, 19, 25, 22, 12, 19, 21, 25, 22, 4, 9]
75
0.041707515716552734
18
43
43
[[9, 11, 7, 9, 12, 19, 29, 21, 11, 10, 26, 22, 18, 29, 19, 11, 18, 23, 26, 16, 18, 4, 22, 25, 17, 18, 12, 23, 3, 17, 17, 15, 22, 25, 27, 2, 26, 22, 21, 28, 10, 23, 15]]
[[9, 11, 7, 9, 12, 19, 29, 21, 11, 10, 26, 22, 18, 29, 19, 11, 18, 23, 26, 16, 18, 4, 22, 25, 17, 18, 12, 23, 3, 17, 17, 15, 22, 25, 27, 2, 26, 22, 21, 28, 10, 23, 15], {"28": 16, "10": 8, "21": 8, "18": 12, "27": 6, "7": 7, "2": 2, "19": 4, "17": 13, "26": 11, "12": 1, "9": 5, "25": 15, "29": 20, "11": 2, "15": 8, "22": 1, "16": 13, "4": 4, "3": 3, "23": 18}, 296]
["[9, 11, 7, 9, 12, 19, 29, 21, 11, 10, 26, 22, 18, 29, 19, 11, 18, 23, 26, 16, 18, 4, 22, 25, 17, 18, 12, 23, 3, 17, 17, 15, 22, 25, 27, 2, 26, 22, 21, 28, 10, 23, 15]", "{28: 16, 10: 8, 21: 8, 18: 12, 27: 6, 7: 7, 2: 2, 19: 4, 17: 13, 26: 11, 12: 1, 9: 5, 25: 15, 29: 20, 11: 2, 15: 8, 22: 1, 16: 13, 4: 4, 3: 3, 23: 18}", "296"]
33
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Green', 'Green', 'Green', 'Green'], ['Red', 'Red', 'Blue', 'Blue'], ['Red', 'Blue', 'Blue', 'Red']]
color_sorting
sorting
8
[[1, 0], [1, 0], [2, 0], [2, 1], [2, 1], [0, 2], [0, 2], [0, 2]]
8
0.04319334030151367
8
6
12
[[["Green", "Green", "Green", "Green"], ["Red", "Red", "Blue", "Blue"], ["Red", "Blue", "Blue", "Red"]], 7]
[[["Green", "Green", "Green", "Green"], ["Red", "Red", "Blue", "Blue"], ["Red", "Blue", "Blue", "Red"]], 7]
["[['Green', 'Green', 'Green', 'Green'], ['Red', 'Red', 'Blue', 'Blue'], ['Red', 'Blue', 'Blue', 'Red']]", "7"]
33
We have a 3x3 numerical grid, with numbers ranging from 41 to 89 (41 included in the range but 89 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['79' '63' '43'] ['x' '68' 'x'] ['x' 'x' 'x']]
consecutive_grid
underdetermined_system
9
[[1, 0, 71], [1, 2, 42], [2, 0, 70], [2, 1, 69], [2, 2, 41]]
499
1.6186437606811523
5
48
9
["[['79', '63', '43'], ['', '68', ''], ['', '', '']]", 41, 89]
["[['79', '63', '43'], ['', '68', ''], ['', '', '']]", 41, 89]
["[['79', '63', '43'], ['', '68', ''], ['', '', '']]", "41", "89"]
33
In the magic square problem, a 3x3 grid is filled with unique integers ranging from 31 to 75. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 138, and sum of row 1 must be 171. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 145. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' 'x' 'x'] ['x' 'x' 'x'] ['x' 'x' '55']]
magic_square
underdetermined_system
6
[[0, 0, 32], [0, 1, 31], [0, 2, 34], [1, 0, 35], [1, 1, 74], [1, 2, 62], [2, 0, 37], [2, 1, 33]]
393
62.23959302902222
8
39
9
["[['', '', ''], ['', '', ''], ['', '', '55']]", 3, 31, 75]
["[['', '', ''], ['', '', ''], ['', '', '55']]", 31, 75, [1, 2], [1, 2], [138], [171], 145]
["[['', '', ''], ['', '', ''], ['', '', '55']]", "31", "75", "[None, 138, None]", "[None, 171, None]", "145"]
33
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: 6, 2: 6, 3: 2, 4: 9, 5: 2, 6: 9, 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? [['Black', 'Yellow', 'Green', 'Red', 'Black'], [], ['Red', 'Yellow', 'Green', 'Blue', 'Green'], [], ['Blue', 'Red', 'Blue', 'Green', 'Yellow'], ['Red', 'Blue', 'Yellow', 'Black', 'Black'], [], []]
restricted_sorting
sorting
2
[[2, 1], [2, 3], [2, 6], [2, 7], [4, 7], [4, 1], [4, 7], [5, 1], [5, 7], [5, 3], [0, 5], [0, 3], [0, 2], [0, 1], [0, 5], [4, 0], [4, 3], [2, 0], [2, 0], [6, 0]]
79
3.2149300575256348
20
56
20
[[["Black", "Yellow", "Green", "Red", "Black"], [], ["Red", "Yellow", "Green", "Blue", "Green"], [], ["Blue", "Red", "Blue", "Green", "Yellow"], ["Red", "Blue", "Yellow", "Black", "Black"], [], []], 5, {"0": 1, "1": 6, "2": 6, "3": 2, "4": 9, "5": 2, "6": 9, "7": 6}]
[[["Black", "Yellow", "Green", "Red", "Black"], [], ["Red", "Yellow", "Green", "Blue", "Green"], [], ["Blue", "Red", "Blue", "Green", "Yellow"], ["Red", "Blue", "Yellow", "Black", "Black"], [], []], 5, {"0": 1, "1": 6, "2": 6, "3": 2, "4": 9, "5": 2, "6": 9, "7": 6}, 4]
["[['Black', 'Yellow', 'Green', 'Red', 'Black'], [], ['Red', 'Yellow', 'Green', 'Blue', 'Green'], [], ['Blue', 'Red', 'Blue', 'Green', 'Yellow'], ['Red', 'Blue', 'Yellow', 'Black', 'Black'], [], []]", "{0: 1, 1: 6, 2: 6, 3: 2, 4: 9, 5: 2, 6: 9, 7: 6}", "5", "4"]
33
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (2, 10) to his destination workshop at index (5, 2), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 4, and district 3 covering rows 5 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [16 10 x 16 1 12 6 12 3 7 x] [x 16 10 9 12 19 7 10 12 13 7] [5 x 9 x 5 16 16 8 x 16 8] [x 4 14 x x x x x x 7 18] [13 12 16 14 x 2 4 2 x 6 3] [x 11 20 x x x 1 x x 9 x] [x x 8 10 x x 3 1 x x 6] [x 2 9 x 8 13 x x x 12 11] [12 x 2 x x 1 6 x 15 x 1] [3 x x x 17 x 18 4 1 x x] [x x 6 x x 12 x x x 15 12]
traffic
pathfinding
3
[[2, 10], [1, 10], [1, 9], [0, 9], [0, 8], [0, 7], [0, 6], [0, 5], [0, 4], [1, 4], [1, 3], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2]]
151
0.028232812881469727
16
4
4
[[["16", "10", "x", "16", "1", "12", "6", "12", "3", "7", "x"], ["x", "16", "10", "9", "12", "19", "7", "10", "12", "13", "7"], ["5", "x", "9", "x", "5", "16", "16", "8", "x", "16", "8"], ["x", "4", "14", "x", "x", "x", "x", "x", "x", "7", "18"], ["13", "12", "16", "14", "x", "2", "4", "2", "x", "6", "3"], ["x", "11", "20", "x", "x", "x", "1", "x", "x", "9", "x"], ["x", "x", "8", "10", "x", "x", "3", "1", "x", "x", "6"], ["x", "2", "9", "x", "8", "13", "x", "x", "x", "12", "11"], ["12", "x", "2", "x", "x", "1", "6", "x", "15", "x", "1"], ["3", "x", "x", "x", "17", "x", "18", "4", "1", "x", "x"], ["x", "x", "6", "x", "x", "12", "x", "x", "x", "15", "12"]]]
[[["16", "10", "x", "16", "1", "12", "6", "12", "3", "7", "x"], ["x", "16", "10", "9", "12", "19", "7", "10", "12", "13", "7"], ["5", "x", "9", "x", "5", "16", "16", "8", "x", "16", "8"], ["x", "4", "14", "x", "x", "x", "x", "x", "x", "7", "18"], ["13", "12", "16", "14", "x", "2", "4", "2", "x", "6", "3"], ["x", "11", "20", "x", "x", "x", "1", "x", "x", "9", "x"], ["x", "x", "8", "10", "x", "x", "3", "1", "x", "x", "6"], ["x", "2", "9", "x", "8", "13", "x", "x", "x", "12", "11"], ["12", "x", "2", "x", "x", "1", "6", "x", "15", "x", "1"], ["3", "x", "x", "x", "17", "x", "18", "4", "1", "x", "x"], ["x", "x", "6", "x", "x", "12", "x", "x", "x", "15", "12"]], [2, 10], [5, 2], 1, 4]
["[['16', '10', 'x', '16', '1', '12', '6', '12', '3', '7', 'x'], ['x', '16', '10', '9', '12', '19', '7', '10', '12', '13', '7'], ['5', 'x', '9', 'x', '5', '16', '16', '8', 'x', '16', '8'], ['x', '4', '14', 'x', 'x', 'x', 'x', 'x', 'x', '7', '18'], ['13', '12', '16', '14', 'x', '2', '4', '2', 'x', '6', '3'], ['x', '11', '20', 'x', 'x', 'x', '1', 'x', 'x', '9', 'x'], ['x', 'x', '8', '10', 'x', 'x', '3', '1', 'x', 'x', '6'], ['x', '2', '9', 'x', '8', '13', 'x', 'x', 'x', '12', '11'], ['12', 'x', '2', 'x', 'x', '1', '6', 'x', '15', 'x', '1'], ['3', 'x', 'x', 'x', '17', 'x', '18', '4', '1', 'x', 'x'], ['x', 'x', '6', 'x', 'x', '12', 'x', 'x', 'x', '15', '12']]", "(2, 10)", "(5, 2)", "1", "4"]
33
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (10, 10) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (0, 4). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 1 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 1 1 0 1 0 0 1 0 0 1 0 1 1 0 1 1 1 1 0 0 1 0 1 1 0 0 0 0 1 0 1 0 1 1 0 0 0 1 1 1 1 1 0 1 1 1 0 0 0
trampoline_matrix
pathfinding
11
[[10, 10], [9, 9], [8, 8], [7, 8], [6, 8], [5, 7], [5, 6], [4, 6], [4, 5], [3, 5], [2, 5], [1, 5], [0, 5], [0, 4]]
14
0.030236005783081055
14
8
2
["[[0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0], [1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1], [1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1], [1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0]]", 3]
["[[0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0], [1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1], [1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1], [1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0]]", [10, 10], [0, 4], 3]
["[[0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0], [1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1], [1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1], [1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0]]", "(10, 10)", "(0, 4)", "3"]
33
Given 7 labeled water jugs with capacities 146, 57, 69, 52, 132, 80, 145 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 456, 538, 549 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
5
[["+", 69, 3], ["+", 145, 3], ["+", 146, 3], ["+", 132, 3], ["+", 57, 3], ["+", 57, 2], ["+", 146, 2], ["+", 146, 2], ["+", 57, 2], ["+", 132, 2], ["+", 52, 1], ["+", 69, 1], ["+", 146, 1], ["+", 57, 1], ["+", 132, 1]]
15
0.0576624870300293
15
42
3
[[146, 57, 69, 52, 132, 80, 145], [456, 538, 549]]
[[146, 57, 69, 52, 132, 80, 145], [456, 538, 549]]
["[146, 57, 69, 52, 132, 80, 145]", "[456, 538, 549]"]
34
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: [[61, '_', 99, 70], [42, 81, 90, 16], [41, 54, 28, 45]]
8_puzzle
puzzle
3
[99, 90, 81, 42, 61, 99, 90, 81, 42, 54, 28, 45, 16, 42, 45, 16]
16
0.027817249298095703
16
4
12
[[[61, "_", 99, 70], [42, 81, 90, 16], [41, 54, 28, 45]]]
[[[61, "_", 99, 70], [42, 81, 90, 16], [41, 54, 28, 45]]]
["[[61, '_', 99, 70], [42, 81, 90, 16], [41, 54, 28, 45]]"]
34
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: soft, tunny, apama, forum The initial board: [['u', 's', 'o', 'f', 't'], ['t', 'a', 'n', 'n', 'y'], ['a', 'p', '_', 'm', 'o'], ['f', 'u', 'r', 'a', 'm']]
8_puzzle_words
puzzle
2
["down-left", "up-left", "up-right", "up-right", "down-right", "down-right", "down-left", "up-left", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-left", "up-left"]
16
0.2467634677886963
16
4
20
[[["u", "s", "o", "f", "t"], ["t", "a", "n", "n", "y"], ["a", "p", "_", "m", "o"], ["f", "u", "r", "a", "m"]]]
[[["u", "s", "o", "f", "t"], ["t", "a", "n", "n", "y"], ["a", "p", "_", "m", "o"], ["f", "u", "r", "a", "m"]], ["soft", "tunny", "apama", "forum"]]
["[['u', 's', 'o', 'f', 't'], ['t', 'a', 'n', 'n', 'y'], ['a', 'p', '_', 'm', 'o'], ['f', 'u', 'r', 'a', 'm']]", "['soft', 'tunny', 'apama', 'forum']"]
34
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 'T'. Our task is to visit city N and city W 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 W and N, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. J S T W G N M Z B P U J 0 0 0 0 0 1 0 0 0 0 0 S 0 0 0 1 0 0 0 1 0 0 0 T 0 0 0 0 0 0 0 0 1 0 0 W 1 1 0 0 1 0 0 0 0 1 1 G 0 1 0 1 0 0 0 1 0 0 0 N 0 0 1 1 1 0 0 0 0 1 1 M 0 0 0 1 0 0 0 0 0 0 0 Z 0 0 0 0 0 1 0 0 1 0 1 B 1 0 0 0 1 0 1 0 0 0 0 P 0 0 1 0 0 1 1 0 0 0 0 U 1 0 0 0 1 1 0 0 0 1 0
city_directed_graph
pathfinding
11
["T", "B", "J", "N", "W", "P", "N", "W"]
8
0.02652597427368164
8
11
14
[[[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0]], ["J", "S", "T", "W", "G", "N", "M", "Z", "B", "P", "U"], "N", "W"]
[[[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0]], ["J", "S", "T", "W", "G", "N", "M", "Z", "B", "P", "U"], "T", "N", "W"]
["[[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0]]", "['J', 'S', 'T', 'W', 'G', 'N', 'M', 'Z', 'B', 'P', 'U']", "['T']", "['N', 'W']"]
34
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [22, 14, 13, 18, 2, 5, 14, 26, 28, 9, 20, 26, 11, 29, 2, 15, 13, 11, 28, 12, 14, 6, 3, 25, 12, 24, 4, 28, 27, 10, 20, 6, 8, 7, 37, 18, 3, 10, 27, 20, 21, 8, 11, 13, 5, 19, 4, 2], such that the sum of the chosen coins adds up to 293. 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: 2, 14: 13, 29: 2, 13: 3, 25: 20, 28: 18, 11: 7, 9: 1, 3: 2, 15: 3, 8: 2, 7: 1, 12: 6, 26: 9, 19: 11, 24: 1, 22: 9, 27: 17, 6: 4, 18: 14, 21: 12, 4: 3, 37: 6, 20: 16, 5: 5, 10: 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
27
[3, 7, 29, 24, 8, 15, 37, 8, 9, 13, 13, 13, 27, 26, 22, 12, 6, 21]
86
0.05985426902770996
18
48
48
[[22, 14, 13, 18, 2, 5, 14, 26, 28, 9, 20, 26, 11, 29, 2, 15, 13, 11, 28, 12, 14, 6, 3, 25, 12, 24, 4, 28, 27, 10, 20, 6, 8, 7, 37, 18, 3, 10, 27, 20, 21, 8, 11, 13, 5, 19, 4, 2]]
[[22, 14, 13, 18, 2, 5, 14, 26, 28, 9, 20, 26, 11, 29, 2, 15, 13, 11, 28, 12, 14, 6, 3, 25, 12, 24, 4, 28, 27, 10, 20, 6, 8, 7, 37, 18, 3, 10, 27, 20, 21, 8, 11, 13, 5, 19, 4, 2], {"2": 2, "14": 13, "29": 2, "13": 3, "25": 20, "28": 18, "11": 7, "9": 1, "3": 2, "15": 3, "8": 2, "7": 1, "12": 6, "26": 9, "19": 11, "24": 1, "22": 9, "27": 17, "6": 4, "18": 14, "21": 12, "4": 3, "37": 6, "20": 16, "5": 5, "10": 6}, 293]
["[22, 14, 13, 18, 2, 5, 14, 26, 28, 9, 20, 26, 11, 29, 2, 15, 13, 11, 28, 12, 14, 6, 3, 25, 12, 24, 4, 28, 27, 10, 20, 6, 8, 7, 37, 18, 3, 10, 27, 20, 21, 8, 11, 13, 5, 19, 4, 2]", "{2: 2, 14: 13, 29: 2, 13: 3, 25: 20, 28: 18, 11: 7, 9: 1, 3: 2, 15: 3, 8: 2, 7: 1, 12: 6, 26: 9, 19: 11, 24: 1, 22: 9, 27: 17, 6: 4, 18: 14, 21: 12, 4: 3, 37: 6, 20: 16, 5: 5, 10: 6}", "293"]
34
The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Green', 'Blue', 'Blue'], ['Blue', 'Red', 'Green', 'Red'], ['Green', 'Blue', 'Red', 'Green']]
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.8411509990692139
15
6
12
[[["Red", "Green", "Blue", "Blue"], ["Blue", "Red", "Green", "Red"], ["Green", "Blue", "Red", "Green"]], 7]
[[["Red", "Green", "Blue", "Blue"], ["Blue", "Red", "Green", "Red"], ["Green", "Blue", "Red", "Green"]], 7]
["[['Red', 'Green', 'Blue', 'Blue'], ['Blue', 'Red', 'Green', 'Red'], ['Green', 'Blue', 'Red', 'Green']]", "7"]
34
We have a 3x3 numerical grid, with numbers ranging from 38 to 86 (38 included in the range but 86 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['38' 'x' '77'] ['x' 'x' 'x'] ['x' '52' 'x']]
consecutive_grid
underdetermined_system
10
[[0, 1, 40], [1, 0, 43], [1, 1, 42], [1, 2, 41], [2, 0, 53], [2, 2, 39]]
431
0.6136000156402588
6
48
9
["[['38', '', '77'], ['', '', ''], ['', '52', '']]", 38, 86]
["[['38', '', '77'], ['', '', ''], ['', '52', '']]", 38, 86]
["[['38', '', '77'], ['', '', ''], ['', '52', '']]", "38", "86"]
34
In the magic square problem, a 3x3 grid is filled with unique integers ranging from 40 to 89. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 183, and sum of row 1 must be 194. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 161. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' 'x' 'x'] ['x' 'x' 'x'] ['40' 'x' '71']]
magic_square
underdetermined_system
6
[[0, 0, 42], [0, 1, 43], [0, 2, 41], [1, 0, 44], [1, 1, 80], [1, 2, 70], [2, 1, 60]]
491
38.21377420425415
7
39
9
["[['', '', ''], ['', '', ''], ['40', '', '71']]", 3, 40, 89]
["[['', '', ''], ['', '', ''], ['40', '', '71']]", 40, 89, [1, 2], [1, 2], [183], [194], 161]
["[['', '', ''], ['', '', ''], ['40', '', '71']]", "40", "89", "[None, 183, None]", "[None, 194, None]", "161"]
34
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: 3, 2: 5, 3: 2, 4: 8, 5: 3, 6: 8, 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? [[], ['Yellow', 'Blue', 'Blue', 'Yellow', 'Green'], ['Black', 'Red', 'Black', 'Green', 'Red'], ['Yellow', 'Yellow', 'Red', 'Black', 'Blue'], [], ['Blue', 'Red', 'Green', 'Green', 'Black'], [], []]
restricted_sorting
sorting
2
[[5, 7], [1, 0], [1, 7], [1, 7], [1, 0], [2, 4], [5, 6], [3, 0], [3, 0], [3, 6], [5, 1], [5, 1], [3, 5], [3, 7], [2, 3], [2, 5], [2, 1], [4, 5], [2, 3], [6, 3], [6, 3]]
94
0.048551321029663086
21
56
20
[[[], ["Yellow", "Blue", "Blue", "Yellow", "Green"], ["Black", "Red", "Black", "Green", "Red"], ["Yellow", "Yellow", "Red", "Black", "Blue"], [], ["Blue", "Red", "Green", "Green", "Black"], [], []], 5, {"0": 6, "1": 3, "2": 5, "3": 2, "4": 8, "5": 3, "6": 8, "7": 5}]
[[[], ["Yellow", "Blue", "Blue", "Yellow", "Green"], ["Black", "Red", "Black", "Green", "Red"], ["Yellow", "Yellow", "Red", "Black", "Blue"], [], ["Blue", "Red", "Green", "Green", "Black"], [], []], 5, {"0": 6, "1": 3, "2": 5, "3": 2, "4": 8, "5": 3, "6": 8, "7": 5}, 4]
["[[], ['Yellow', 'Blue', 'Blue', 'Yellow', 'Green'], ['Black', 'Red', 'Black', 'Green', 'Red'], ['Yellow', 'Yellow', 'Red', 'Black', 'Blue'], [], ['Blue', 'Red', 'Green', 'Green', 'Black'], [], []]", "{0: 6, 1: 3, 2: 5, 3: 2, 4: 8, 5: 3, 6: 8, 7: 5}", "5", "4"]
34
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (7, 0) to his destination workshop at index (2, 9), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 2, district 2 covering rows 3 to 6, and district 3 covering rows 7 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [12 11 14 10 2 11 13 16 3 x 12] [10 9 x 8 x x 1 16 11 x 15] [1 18 1 x x x x x 12 9 x] [1 14 15 10 7 15 17 10 15 15 6] [18 11 x x x 15 x x 1 1 x] [14 x x x 18 14 16 7 x 1 x] [11 15 x x 15 3 11 13 x x x] [5 x x x x x 15 x 6 x x] [12 11 7 2 11 x 10 2 17 x x] [7 x x x 4 x 4 x x 5 x] [x 19 10 7 x 2 3 9 2 6 x]
traffic
pathfinding
3
[[7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [2, 8], [2, 9]]
168
0.027637958526611328
15
4
4
[[["12", "11", "14", "10", "2", "11", "13", "16", "3", "x", "12"], ["10", "9", "x", "8", "x", "x", "1", "16", "11", "x", "15"], ["1", "18", "1", "x", "x", "x", "x", "x", "12", "9", "x"], ["1", "14", "15", "10", "7", "15", "17", "10", "15", "15", "6"], ["18", "11", "x", "x", "x", "15", "x", "x", "1", "1", "x"], ["14", "x", "x", "x", "18", "14", "16", "7", "x", "1", "x"], ["11", "15", "x", "x", "15", "3", "11", "13", "x", "x", "x"], ["5", "x", "x", "x", "x", "x", "15", "x", "6", "x", "x"], ["12", "11", "7", "2", "11", "x", "10", "2", "17", "x", "x"], ["7", "x", "x", "x", "4", "x", "4", "x", "x", "5", "x"], ["x", "19", "10", "7", "x", "2", "3", "9", "2", "6", "x"]]]
[[["12", "11", "14", "10", "2", "11", "13", "16", "3", "x", "12"], ["10", "9", "x", "8", "x", "x", "1", "16", "11", "x", "15"], ["1", "18", "1", "x", "x", "x", "x", "x", "12", "9", "x"], ["1", "14", "15", "10", "7", "15", "17", "10", "15", "15", "6"], ["18", "11", "x", "x", "x", "15", "x", "x", "1", "1", "x"], ["14", "x", "x", "x", "18", "14", "16", "7", "x", "1", "x"], ["11", "15", "x", "x", "15", "3", "11", "13", "x", "x", "x"], ["5", "x", "x", "x", "x", "x", "15", "x", "6", "x", "x"], ["12", "11", "7", "2", "11", "x", "10", "2", "17", "x", "x"], ["7", "x", "x", "x", "4", "x", "4", "x", "x", "5", "x"], ["x", "19", "10", "7", "x", "2", "3", "9", "2", "6", "x"]], [7, 0], [2, 9], 2, 6]
["[['12', '11', '14', '10', '2', '11', '13', '16', '3', 'x', '12'], ['10', '9', 'x', '8', 'x', 'x', '1', '16', '11', 'x', '15'], ['1', '18', '1', 'x', 'x', 'x', 'x', 'x', '12', '9', 'x'], ['1', '14', '15', '10', '7', '15', '17', '10', '15', '15', '6'], ['18', '11', 'x', 'x', 'x', '15', 'x', 'x', '1', '1', 'x'], ['14', 'x', 'x', 'x', '18', '14', '16', '7', 'x', '1', 'x'], ['11', '15', 'x', 'x', '15', '3', '11', '13', 'x', 'x', 'x'], ['5', 'x', 'x', 'x', 'x', 'x', '15', 'x', '6', 'x', 'x'], ['12', '11', '7', '2', '11', 'x', '10', '2', '17', 'x', 'x'], ['7', 'x', 'x', 'x', '4', 'x', '4', 'x', 'x', '5', 'x'], ['x', '19', '10', '7', 'x', '2', '3', '9', '2', '6', 'x']]", "(7, 0)", "(2, 9)", "2", "6"]
34
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (10, 10) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (5, 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 1 0 0 0 1 1 0 1 1 0 0 0 0 0 1 1 1 0 0 0 1 1 0 0 1 1 1 1 0 0 1 0 1 0 1 1 0 1 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 1 0 1 1 0 1 1 1 0 0 1 1 1 0 1 0 0 0 1 1 0 0 1 1 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0
trampoline_matrix
pathfinding
11
[[10, 10], [10, 9], [10, 8], [10, 7], [10, 6], [10, 5], [10, 4], [9, 3], [9, 2], [8, 1], [7, 0], [6, 0], [5, 0]]
13
0.03441643714904785
13
8
2
["[[0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]", 3]
["[[0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]", [10, 10], [5, 0], 3]
["[[0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]", "(10, 10)", "(5, 0)", "3"]
34
Given 7 labeled water jugs with capacities 103, 109, 146, 101, 17, 145, 68 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 448, 466, 509 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
5
[["+", 109, 3], ["+", 145, 3], ["+", 146, 3], ["+", 109, 3], ["+", 103, 2], ["+", 109, 2], ["+", 109, 2], ["+", 145, 2], ["+", 101, 1], ["+", 101, 1], ["+", 101, 1], ["+", 145, 1]]
12
0.05138897895812988
12
42
3
[[103, 109, 146, 101, 17, 145, 68], [448, 466, 509]]
[[103, 109, 146, 101, 17, 145, 68], [448, 466, 509]]
["[103, 109, 146, 101, 17, 145, 68]", "[448, 466, 509]"]
35
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: [[95, '_', 80, 18], [67, 66, 35, 94], [27, 26, 69, 53]]
8_puzzle
puzzle
3
[66, 35, 94, 18, 80, 94, 69, 53, 18, 69, 35, 66, 94, 80, 69, 35, 53, 18]
18
0.03965592384338379
18
4
12
[[[95, "_", 80, 18], [67, 66, 35, 94], [27, 26, 69, 53]]]
[[[95, "_", 80, 18], [67, 66, 35, 94], [27, 26, 69, 53]]]
["[[95, '_', 80, 18], [67, 66, 35, 94], [27, 26, 69, 53]]"]
35
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: supe, cadus, nucal, rouse The initial board: [['a', 's', '_', 'p', 'e'], ['c', 'u', 'd', 'o', 's'], ['l', 'u', 'u', 'a', 's'], ['r', 'c', 'u', 'n', 'e']]
8_puzzle_words
puzzle
2
["down-right", "down-left", "up-left", "down-left", "down-right", "up-right", "up-left", "up-right", "down-right", "down-left", "down-left", "up-left", "up-right", "down-right", "down-right", "up-right", "up-left", "up-left", "down-left", "down-right", "down-left", "up-left", "up-right", "up-left"]
24
0.3029823303222656
24
4
20
[[["a", "s", "_", "p", "e"], ["c", "u", "d", "o", "s"], ["l", "u", "u", "a", "s"], ["r", "c", "u", "n", "e"]]]
[[["a", "s", "_", "p", "e"], ["c", "u", "d", "o", "s"], ["l", "u", "u", "a", "s"], ["r", "c", "u", "n", "e"]], ["supe", "cadus", "nucal", "rouse"]]
["[['a', 's', '_', 'p', 'e'], ['c', 'u', 'd', 'o', 's'], ['l', 'u', 'u', 'a', 's'], ['r', 'c', 'u', 'n', 'e']]", "['supe', 'cadus', 'nucal', 'rouse']"]
35
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 L and city P 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 P and L, 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 V N Q P S M E L H W G A 0 1 0 0 0 1 1 0 0 0 1 0 V 0 0 1 0 0 0 0 0 0 1 0 0 N 0 0 0 0 1 0 0 1 1 0 0 0 Q 1 1 0 0 1 0 0 0 1 0 0 0 P 0 1 0 0 0 0 0 1 0 1 0 0 S 0 0 0 1 1 0 0 0 0 0 0 0 M 0 1 1 0 1 1 0 1 0 1 1 0 E 0 0 0 1 1 0 0 0 0 0 0 0 L 0 1 0 0 0 0 0 1 0 1 1 1 H 0 0 0 0 0 1 0 0 1 0 0 0 W 1 1 1 0 1 1 0 1 0 0 0 0 G 1 1 0 0 0 0 0 0 0 0 0 0
city_directed_graph
pathfinding
12
["G", "V", "N", "L", "W", "P", "E", "P", "H", "L"]
10
0.03540349006652832
10
12
15
[[[0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0, 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, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], ["A", "V", "N", "Q", "P", "S", "M", "E", "L", "H", "W", "G"], "L", "P"]
[[[0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0, 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, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], ["A", "V", "N", "Q", "P", "S", "M", "E", "L", "H", "W", "G"], "G", "L", "P"]
["[[0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0], [1, 1, 0, 0, 1, 0, 0, 0, 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, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]", "['A', 'V', 'N', 'Q', 'P', 'S', 'M', 'E', 'L', 'H', 'W', 'G']", "['G']", "['L', 'P']"]
35
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [27, 17, 6, 5, 20, 3, 4, 29, 25, 27, 20, 18, 18, 25, 2, 13, 15, 4, 12, 4, 26, 12, 26, 24, 17, 23, 2, 6, 2, 29, 3, 20, 12, 7, 9, 12, 26, 11, 2, 5, 10, 25, 3, 13, 7, 25], such that the sum of the chosen coins adds up to 295. 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, 13: 11, 26: 13, 5: 1, 4: 2, 9: 8, 15: 8, 18: 6, 20: 18, 3: 1, 17: 17, 6: 2, 10: 10, 12: 1, 23: 10, 7: 6, 29: 13, 25: 15, 11: 10, 27: 2, 24: 18}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
28
[12, 27, 12, 2, 5, 27, 12, 2, 3, 3, 5, 2, 23, 18, 12, 6, 29, 18, 6, 4, 2, 3, 29, 4, 25, 4]
90
0.049031734466552734
26
46
46
[[27, 17, 6, 5, 20, 3, 4, 29, 25, 27, 20, 18, 18, 25, 2, 13, 15, 4, 12, 4, 26, 12, 26, 24, 17, 23, 2, 6, 2, 29, 3, 20, 12, 7, 9, 12, 26, 11, 2, 5, 10, 25, 3, 13, 7, 25]]
[[27, 17, 6, 5, 20, 3, 4, 29, 25, 27, 20, 18, 18, 25, 2, 13, 15, 4, 12, 4, 26, 12, 26, 24, 17, 23, 2, 6, 2, 29, 3, 20, 12, 7, 9, 12, 26, 11, 2, 5, 10, 25, 3, 13, 7, 25], {"2": 1, "13": 11, "26": 13, "5": 1, "4": 2, "9": 8, "15": 8, "18": 6, "20": 18, "3": 1, "17": 17, "6": 2, "10": 10, "12": 1, "23": 10, "7": 6, "29": 13, "25": 15, "11": 10, "27": 2, "24": 18}, 295]
["[27, 17, 6, 5, 20, 3, 4, 29, 25, 27, 20, 18, 18, 25, 2, 13, 15, 4, 12, 4, 26, 12, 26, 24, 17, 23, 2, 6, 2, 29, 3, 20, 12, 7, 9, 12, 26, 11, 2, 5, 10, 25, 3, 13, 7, 25]", "{2: 1, 13: 11, 26: 13, 5: 1, 4: 2, 9: 8, 15: 8, 18: 6, 20: 18, 3: 1, 17: 17, 6: 2, 10: 10, 12: 1, 23: 10, 7: 6, 29: 13, 25: 15, 11: 10, 27: 2, 24: 18}", "295"]
35
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
1.9828546047210693
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"]
35
We have a 3x3 numerical grid, with numbers ranging from 40 to 88 (40 included in the range but 88 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' 'x' 'x'] ['x' '61' '62'] ['x' 'x' '63']]
consecutive_grid
underdetermined_system
10
[[0, 0, 40], [0, 1, 41], [0, 2, 42], [1, 0, 43], [2, 0, 65], [2, 1, 64]]
454
0.1776282787322998
6
48
9
["[['', '', ''], ['', '61', '62'], ['', '', '63']]", 40, 88]
["[['', '', ''], ['', '61', '62'], ['', '', '63']]", 40, 88]
["[['', '', ''], ['', '61', '62'], ['', '', '63']]", "40", "88"]
35
In the magic square problem, a 3x3 grid is filled with unique integers ranging from 40 to 89. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 153, and sum of row 1 must be 186. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 188. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' 'x' 'x'] ['80' '48' 'x'] ['x' 'x' 'x']]
magic_square
underdetermined_system
6
[[0, 0, 40], [0, 1, 42], [0, 2, 52], [1, 2, 58], [2, 0, 88], [2, 1, 63], [2, 2, 41]]
512
25.803895473480225
7
39
9
["[['', '', ''], ['80', '48', ''], ['', '', '']]", 3, 40, 89]
["[['', '', ''], ['80', '48', ''], ['', '', '']]", 40, 89, [1, 2], [1, 2], [153], [186], 188]
["[['', '', ''], ['80', '48', ''], ['', '', '']]", "40", "89", "[None, 153, None]", "[None, 186, None]", "188"]
35
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.07124614715576172
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"]
35
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (7, 8) to his destination workshop at index (2, 1), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 2, district 2 covering rows 3 to 7, and district 3 covering rows 8 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x 18 x 5 x 6 5 x 6 17 x] [x x 1 5 9 13 x 2 x x 2] [x 17 12 x x x 5 x x 17 x] [9 3 13 8 x 7 x x 4 2 x] [11 17 x 10 x x x x 17 15 11] [x 10 10 14 9 7 1 5 x x 7] [x 5 6 12 8 9 4 x x 4 9] [11 x 4 13 14 x 12 17 13 x x] [x 8 x 19 11 7 7 19 15 14 7] [11 8 x 11 10 16 x x 9 x 5] [9 4 x x 1 11 14 x x x 10]
traffic
pathfinding
3
[[7, 8], [7, 7], [7, 6], [8, 6], [7, 6], [6, 6], [5, 6], [5, 5], [5, 4], [5, 3], [4, 3], [3, 3], [3, 2], [3, 1], [2, 1]]
134
0.027469635009765625
15
4
4
[[["x", "18", "x", "5", "x", "6", "5", "x", "6", "17", "x"], ["x", "x", "1", "5", "9", "13", "x", "2", "x", "x", "2"], ["x", "17", "12", "x", "x", "x", "5", "x", "x", "17", "x"], ["9", "3", "13", "8", "x", "7", "x", "x", "4", "2", "x"], ["11", "17", "x", "10", "x", "x", "x", "x", "17", "15", "11"], ["x", "10", "10", "14", "9", "7", "1", "5", "x", "x", "7"], ["x", "5", "6", "12", "8", "9", "4", "x", "x", "4", "9"], ["11", "x", "4", "13", "14", "x", "12", "17", "13", "x", "x"], ["x", "8", "x", "19", "11", "7", "7", "19", "15", "14", "7"], ["11", "8", "x", "11", "10", "16", "x", "x", "9", "x", "5"], ["9", "4", "x", "x", "1", "11", "14", "x", "x", "x", "10"]]]
[[["x", "18", "x", "5", "x", "6", "5", "x", "6", "17", "x"], ["x", "x", "1", "5", "9", "13", "x", "2", "x", "x", "2"], ["x", "17", "12", "x", "x", "x", "5", "x", "x", "17", "x"], ["9", "3", "13", "8", "x", "7", "x", "x", "4", "2", "x"], ["11", "17", "x", "10", "x", "x", "x", "x", "17", "15", "11"], ["x", "10", "10", "14", "9", "7", "1", "5", "x", "x", "7"], ["x", "5", "6", "12", "8", "9", "4", "x", "x", "4", "9"], ["11", "x", "4", "13", "14", "x", "12", "17", "13", "x", "x"], ["x", "8", "x", "19", "11", "7", "7", "19", "15", "14", "7"], ["11", "8", "x", "11", "10", "16", "x", "x", "9", "x", "5"], ["9", "4", "x", "x", "1", "11", "14", "x", "x", "x", "10"]], [7, 8], [2, 1], 2, 7]
["[['x', '18', 'x', '5', 'x', '6', '5', 'x', '6', '17', 'x'], ['x', 'x', '1', '5', '9', '13', 'x', '2', 'x', 'x', '2'], ['x', '17', '12', 'x', 'x', 'x', '5', 'x', 'x', '17', 'x'], ['9', '3', '13', '8', 'x', '7', 'x', 'x', '4', '2', 'x'], ['11', '17', 'x', '10', 'x', 'x', 'x', 'x', '17', '15', '11'], ['x', '10', '10', '14', '9', '7', '1', '5', 'x', 'x', '7'], ['x', '5', '6', '12', '8', '9', '4', 'x', 'x', '4', '9'], ['11', 'x', '4', '13', '14', 'x', '12', '17', '13', 'x', 'x'], ['x', '8', 'x', '19', '11', '7', '7', '19', '15', '14', '7'], ['11', '8', 'x', '11', '10', '16', 'x', 'x', '9', 'x', '5'], ['9', '4', 'x', 'x', '1', '11', '14', 'x', 'x', 'x', '10']]", "(7, 8)", "(2, 1)", "2", "7"]
35
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (1, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (8, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 0 0 0 0 1 0 1 0 1 1 1 0 0 0 1 0 1 1 0 0 1 0 0 1 1 1 1 0 0 0 0 1 1 0 1 1 0 1 0 1 0 0 0 1 0 1 1 1 0 0 0 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 1 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 0 0 1 1 1 0 0 1
trampoline_matrix
pathfinding
11
[[1, 9], [1, 8], [2, 7], [2, 6], [3, 6], [4, 5], [5, 5], [5, 4], [6, 3], [6, 2], [6, 1], [7, 1], [7, 0], [8, 0]]
14
0.02565455436706543
14
8
2
["[[1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0], [1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1]]", 3]
["[[1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0], [1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1]]", [1, 9], [8, 0], 3]
["[[1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1], [0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0], [1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1]]", "(1, 9)", "(8, 0)", "3"]
35
Given 7 labeled water jugs with capacities 120, 95, 49, 150, 83, 97, 44, 43 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 225, 334, 381 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
5
[["+", 97, 3], ["+", 120, 3], ["+", 120, 3], ["+", 44, 3], ["+", 150, 2], ["+", 150, 2], ["-", 49, 2], ["+", 83, 2], ["+", 43, 1], ["+", 43, 1], ["+", 44, 1], ["+", 95, 1]]
12
0.03785276412963867
12
48
3
[[120, 95, 49, 150, 83, 97, 44, 43], [225, 334, 381]]
[[120, 95, 49, 150, 83, 97, 44, 43], [225, 334, 381]]
["[120, 95, 49, 150, 83, 97, 44, 43]", "[225, 334, 381]"]
36
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: [[67, 86, 68, 29], [10, 95, '_', 44], [19, 80, 6, 50]]
8_puzzle
puzzle
3
[44, 29, 68, 86, 95, 80, 6, 50, 29, 44, 80, 10, 67, 95, 86, 80, 50, 6, 10, 50, 44, 29]
22
0.07417702674865723
22
4
12
[[[67, 86, 68, 29], [10, 95, "_", 44], [19, 80, 6, 50]]]
[[[67, 86, 68, 29], [10, 95, "_", 44], [19, 80, 6, 50]]]
["[[67, 86, 68, 29], [10, 95, '_', 44], [19, 80, 6, 50]]"]
36
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: bath, khila, ascon, coast The initial board: [['h', 'b', 'c', 't', 'h'], ['k', 'n', 'i', 'o', 'a'], ['a', 's', '_', 'o', 'a'], ['c', 'l', 'a', 's', 't']]
8_puzzle_words
puzzle
2
["up-right", "up-left", "down-left", "down-right", "up-right", "down-right", "down-left", "up-left", "down-left", "up-left", "up-right", "down-right", "up-right", "up-left", "down-left", "down-right", "down-left", "up-left", "up-right", "down-right", "down-right", "up-right", "up-left", "up-left", "down-left", "up-left"]
26
0.8642349243164062
26
4
20
[[["h", "b", "c", "t", "h"], ["k", "n", "i", "o", "a"], ["a", "s", "_", "o", "a"], ["c", "l", "a", "s", "t"]]]
[[["h", "b", "c", "t", "h"], ["k", "n", "i", "o", "a"], ["a", "s", "_", "o", "a"], ["c", "l", "a", "s", "t"]], ["bath", "khila", "ascon", "coast"]]
["[['h', 'b', 'c', 't', 'h'], ['k', 'n', 'i', 'o', 'a'], ['a', 's', '_', 'o', 'a'], ['c', 'l', 'a', 's', 't']]", "['bath', 'khila', 'ascon', 'coast']"]
36
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 O and city R excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from R and 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. F I C G N L X Q U R O B F 0 0 0 0 0 0 0 0 1 1 0 0 I 0 0 1 0 0 1 1 0 1 0 1 0 C 0 0 0 1 0 1 0 1 0 0 1 1 G 1 1 0 0 0 1 0 0 0 0 0 0 N 1 0 0 0 0 0 0 0 0 1 0 0 L 1 0 0 0 0 0 1 1 0 0 0 0 X 0 0 1 1 1 0 0 0 0 1 0 0 Q 0 0 0 1 1 0 0 0 0 1 0 0 U 0 0 0 1 0 0 1 1 0 0 1 0 R 0 1 1 0 0 1 0 0 1 0 0 1 O 0 0 0 0 1 1 1 1 0 1 0 0 B 0 0 1 0 0 0 0 1 1 1 0 0
city_directed_graph
pathfinding
12
["G", "I", "O", "R", "C", "O", "R"]
7
0.022314071655273438
7
12
15
[[[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0]], ["F", "I", "C", "G", "N", "L", "X", "Q", "U", "R", "O", "B"], "O", "R"]
[[[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0]], ["F", "I", "C", "G", "N", "L", "X", "Q", "U", "R", "O", "B"], "G", "O", "R"]
["[[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0]]", "['F', 'I', 'C', 'G', 'N', 'L', 'X', 'Q', 'U', 'R', 'O', 'B']", "['G']", "['O', 'R']"]
36
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [26, 7, 24, 27, 19, 15, 12, 13, 19, 5, 17, 26, 20, 7, 3, 21, 22, 7, 17, 13, 28, 11, 19, 18, 9, 10, 25, 2, 4, 18, 14, 17, 22, 27, 14, 7, 9, 2, 11, 8, 14, 10, 18, 1, 4, 24, 2, 24, 11, 14, 27], such that the sum of the chosen coins adds up to 281. 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 {13: 8, 27: 5, 21: 13, 25: 11, 22: 6, 20: 14, 12: 1, 14: 12, 2: 2, 8: 5, 3: 2, 18: 4, 1: 1, 9: 9, 10: 1, 19: 10, 11: 5, 28: 10, 5: 3, 26: 7, 7: 1, 24: 9, 4: 3, 15: 2, 17: 13}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
29
[7, 7, 7, 15, 10, 27, 10, 27, 18, 27, 22, 18, 12, 25, 22, 18, 2, 7]
61
0.04955577850341797
18
51
51
[[26, 7, 24, 27, 19, 15, 12, 13, 19, 5, 17, 26, 20, 7, 3, 21, 22, 7, 17, 13, 28, 11, 19, 18, 9, 10, 25, 2, 4, 18, 14, 17, 22, 27, 14, 7, 9, 2, 11, 8, 14, 10, 18, 1, 4, 24, 2, 24, 11, 14, 27]]
[[26, 7, 24, 27, 19, 15, 12, 13, 19, 5, 17, 26, 20, 7, 3, 21, 22, 7, 17, 13, 28, 11, 19, 18, 9, 10, 25, 2, 4, 18, 14, 17, 22, 27, 14, 7, 9, 2, 11, 8, 14, 10, 18, 1, 4, 24, 2, 24, 11, 14, 27], {"13": 8, "27": 5, "21": 13, "25": 11, "22": 6, "20": 14, "12": 1, "14": 12, "2": 2, "8": 5, "3": 2, "18": 4, "1": 1, "9": 9, "10": 1, "19": 10, "11": 5, "28": 10, "5": 3, "26": 7, "7": 1, "24": 9, "4": 3, "15": 2, "17": 13}, 281]
["[26, 7, 24, 27, 19, 15, 12, 13, 19, 5, 17, 26, 20, 7, 3, 21, 22, 7, 17, 13, 28, 11, 19, 18, 9, 10, 25, 2, 4, 18, 14, 17, 22, 27, 14, 7, 9, 2, 11, 8, 14, 10, 18, 1, 4, 24, 2, 24, 11, 14, 27]", "{13: 8, 27: 5, 21: 13, 25: 11, 22: 6, 20: 14, 12: 1, 14: 12, 2: 2, 8: 5, 3: 2, 18: 4, 1: 1, 9: 9, 10: 1, 19: 10, 11: 5, 28: 10, 5: 3, 26: 7, 7: 1, 24: 9, 4: 3, 15: 2, 17: 13}", "281"]
36
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', 'Red', 'Red'], ['Green', 'Blue', 'Green', 'Green'], ['Blue', 'Blue', 'Green', 'Red']]
color_sorting
sorting
8
[[2, 0], [2, 0], [1, 2], [1, 0], [2, 1], [2, 1], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [1, 0]]
12
0.14433550834655762
12
6
12
[[["Blue", "Red", "Red", "Red"], ["Green", "Blue", "Green", "Green"], ["Blue", "Blue", "Green", "Red"]], 7]
[[["Blue", "Red", "Red", "Red"], ["Green", "Blue", "Green", "Green"], ["Blue", "Blue", "Green", "Red"]], 7]
["[['Blue', 'Red', 'Red', 'Red'], ['Green', 'Blue', 'Green', 'Green'], ['Blue', 'Blue', 'Green', 'Red']]", "7"]
36
We have a 3x3 numerical grid, with numbers ranging from 26 to 74 (26 included in the range but 74 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['41' 'x' 'x'] ['42' '57' 'x'] ['x' 'x' 'x']]
consecutive_grid
underdetermined_system
10
[[0, 1, 27], [0, 2, 26], [1, 2, 58], [2, 0, 61], [2, 1, 60], [2, 2, 59]]
394
207.3310091495514
6
48
9
["[['41', '', ''], ['42', '57', ''], ['', '', '']]", 26, 74]
["[['41', '', ''], ['42', '57', ''], ['', '', '']]", 26, 74]
["[['41', '', ''], ['42', '57', ''], ['', '', '']]", "26", "74"]
36
In the magic square problem, a 3x3 grid is filled with unique integers ranging from 40 to 89. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 198, and sum of row 1 must be 152. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 195. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' 'x' 'x'] ['x' 'x' 'x'] ['69' '71' 'x']]
magic_square
underdetermined_system
6
[[0, 0, 41], [0, 1, 57], [0, 2, 56], [1, 0, 40], [1, 1, 70], [1, 2, 42], [2, 2, 43]]
489
69.91229152679443
7
39
9
["[['', '', ''], ['', '', ''], ['69', '71', '']]", 3, 40, 89]
["[['', '', ''], ['', '', ''], ['69', '71', '']]", 40, 89, [1, 2], [1, 2], [198], [152], 195]
["[['', '', ''], ['', '', ''], ['69', '71', '']]", "40", "89", "[None, 198, None]", "[None, 152, None]", "195"]
36
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: 7, 3: 1, 4: 8, 5: 8, 6: 8, 7: 4}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Blue', 'Yellow', 'Yellow', 'Green', 'Black'], [], [], [], ['Blue', 'Red', 'Black', 'Yellow', 'Green'], ['Black', 'Red', 'Green', 'Blue', 'Red'], ['Green', 'Yellow', 'Black', 'Red', 'Blue'], []]
restricted_sorting
sorting
2
[[0, 1], [0, 2], [0, 2], [6, 3], [6, 2], [4, 1], [4, 7], [0, 3], [4, 0], [4, 2], [5, 0], [6, 0], [6, 7], [5, 7], [5, 3], [5, 1], [5, 7], [6, 1], [4, 3]]
76
4.6590895652771
19
56
20
[[["Blue", "Yellow", "Yellow", "Green", "Black"], [], [], [], ["Blue", "Red", "Black", "Yellow", "Green"], ["Black", "Red", "Green", "Blue", "Red"], ["Green", "Yellow", "Black", "Red", "Blue"], []], 5, {"0": 4, "1": 4, "2": 7, "3": 1, "4": 8, "5": 8, "6": 8, "7": 4}]
[[["Blue", "Yellow", "Yellow", "Green", "Black"], [], [], [], ["Blue", "Red", "Black", "Yellow", "Green"], ["Black", "Red", "Green", "Blue", "Red"], ["Green", "Yellow", "Black", "Red", "Blue"], []], 5, {"0": 4, "1": 4, "2": 7, "3": 1, "4": 8, "5": 8, "6": 8, "7": 4}, 4]
["[['Blue', 'Yellow', 'Yellow', 'Green', 'Black'], [], [], [], ['Blue', 'Red', 'Black', 'Yellow', 'Green'], ['Black', 'Red', 'Green', 'Blue', 'Red'], ['Green', 'Yellow', 'Black', 'Red', 'Blue'], []]", "{0: 4, 1: 4, 2: 7, 3: 1, 4: 8, 5: 8, 6: 8, 7: 4}", "5", "4"]
36
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (7, 0) to his destination workshop at index (3, 8), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 6, and district 3 covering rows 7 to 10. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x 11 5 18 x 14 7 x 15 11 14] [x x x x 13 13 11 17 8 13 x] [x 8 1 5 17 x 4 8 20 7 4] [x 10 x x 18 1 x x 20 x x] [18 15 x 6 x 4 3 4 3 13 x] [5 1 x 4 x x x 11 x 14 18] [19 19 x x x x 15 x 10 x x] [15 5 7 x 14 6 x x x 13 x] [18 7 x 19 x 12 x x 15 x x] [10 9 x 1 x x 15 x 11 x 2] [x x 8 x 19 x 1 3 x x 8]
traffic
pathfinding
3
[[7, 0], [7, 1], [6, 1], [5, 1], [4, 1], [3, 1], [2, 1], [2, 2], [2, 3], [2, 4], [1, 4], [2, 4], [3, 4], [3, 5], [4, 5], [4, 6], [4, 7], [4, 8], [3, 8]]
164
0.027472734451293945
19
4
4
[[["x", "11", "5", "18", "x", "14", "7", "x", "15", "11", "14"], ["x", "x", "x", "x", "13", "13", "11", "17", "8", "13", "x"], ["x", "8", "1", "5", "17", "x", "4", "8", "20", "7", "4"], ["x", "10", "x", "x", "18", "1", "x", "x", "20", "x", "x"], ["18", "15", "x", "6", "x", "4", "3", "4", "3", "13", "x"], ["5", "1", "x", "4", "x", "x", "x", "11", "x", "14", "18"], ["19", "19", "x", "x", "x", "x", "15", "x", "10", "x", "x"], ["15", "5", "7", "x", "14", "6", "x", "x", "x", "13", "x"], ["18", "7", "x", "19", "x", "12", "x", "x", "15", "x", "x"], ["10", "9", "x", "1", "x", "x", "15", "x", "11", "x", "2"], ["x", "x", "8", "x", "19", "x", "1", "3", "x", "x", "8"]]]
[[["x", "11", "5", "18", "x", "14", "7", "x", "15", "11", "14"], ["x", "x", "x", "x", "13", "13", "11", "17", "8", "13", "x"], ["x", "8", "1", "5", "17", "x", "4", "8", "20", "7", "4"], ["x", "10", "x", "x", "18", "1", "x", "x", "20", "x", "x"], ["18", "15", "x", "6", "x", "4", "3", "4", "3", "13", "x"], ["5", "1", "x", "4", "x", "x", "x", "11", "x", "14", "18"], ["19", "19", "x", "x", "x", "x", "15", "x", "10", "x", "x"], ["15", "5", "7", "x", "14", "6", "x", "x", "x", "13", "x"], ["18", "7", "x", "19", "x", "12", "x", "x", "15", "x", "x"], ["10", "9", "x", "1", "x", "x", "15", "x", "11", "x", "2"], ["x", "x", "8", "x", "19", "x", "1", "3", "x", "x", "8"]], [7, 0], [3, 8], 1, 6]
["[['x', '11', '5', '18', 'x', '14', '7', 'x', '15', '11', '14'], ['x', 'x', 'x', 'x', '13', '13', '11', '17', '8', '13', 'x'], ['x', '8', '1', '5', '17', 'x', '4', '8', '20', '7', '4'], ['x', '10', 'x', 'x', '18', '1', 'x', 'x', '20', 'x', 'x'], ['18', '15', 'x', '6', 'x', '4', '3', '4', '3', '13', 'x'], ['5', '1', 'x', '4', 'x', 'x', 'x', '11', 'x', '14', '18'], ['19', '19', 'x', 'x', 'x', 'x', '15', 'x', '10', 'x', 'x'], ['15', '5', '7', 'x', '14', '6', 'x', 'x', 'x', '13', 'x'], ['18', '7', 'x', '19', 'x', '12', 'x', 'x', '15', 'x', 'x'], ['10', '9', 'x', '1', 'x', 'x', '15', 'x', '11', 'x', '2'], ['x', 'x', '8', 'x', '19', 'x', '1', '3', 'x', 'x', '8']]", "(7, 0)", "(3, 8)", "1", "6"]
36
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 11x11. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (0, 10) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (9, 2). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 1 1 1 0 1 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 0 1 0 0 1 1 0 1 1 0 0 1 0 1 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 1 1 1 1 0
trampoline_matrix
pathfinding
11
[[0, 10], [1, 9], [2, 9], [2, 8], [2, 7], [3, 6], [4, 6], [5, 6], [6, 6], [7, 7], [8, 7], [8, 6], [8, 5], [8, 4], [8, 3], [8, 2], [9, 2]]
17
0.024544954299926758
17
8
2
["[[0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0], [0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0], [0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1], [0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0]]", 3]
["[[0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0], [0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0], [0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1], [0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0]]", [0, 10], [9, 2], 3]
["[[0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0], [0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0], [0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1], [0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0]]", "(0, 10)", "(9, 2)", "3"]
36
Given 7 labeled water jugs with capacities 15, 138, 24, 10, 30, 82, 11, 94 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 239, 275, 286 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
5
[["+", 138, 3], ["+", 138, 3], ["+", 10, 3], ["+", 138, 2], ["-", 11, 2], ["+", 138, 2], ["+", 10, 2], ["+", 10, 1], ["+", 82, 1], ["+", 138, 1], ["-", 15, 1], ["+", 24, 1]]
12
0.038283348083496094
12
48
3
[[15, 138, 24, 10, 30, 82, 11, 94], [239, 275, 286]]
[[15, 138, 24, 10, 30, 82, 11, 94], [239, 275, 286]]
["[15, 138, 24, 10, 30, 82, 11, 94]", "[239, 275, 286]"]
37
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[12, 78, 19, '_'], [94, 66, 67, 49], [28, 83, 31, 47]]
8_puzzle
puzzle
4
[49, 67, 19, 78, 12, 94, 66, 12, 78, 49, 67, 47, 31, 19, 12, 83, 19, 12, 49, 78, 83, 49, 47, 31]
24
0.03918051719665527
24
4
12
[[[12, 78, 19, "_"], [94, 66, 67, 49], [28, 83, 31, 47]]]
[[[12, 78, 19, "_"], [94, 66, 67, 49], [28, 83, 31, 47]]]
["[[12, 78, 19, '_'], [94, 66, 67, 49], [28, 83, 31, 47]]"]
37
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: uvate, dearie, manuka, khanum The initial board: [['e', 'u', 'n', 'a', '_', 'e'], ['d', 'r', 'a', 'v', 'i', 'e'], ['m', 'a', 'n', 'u', 'k', 'a'], ['k', 'h', 'a', 't', 'u', 'm']]
8_puzzle_words
puzzle
3
["down-right", "down-left", "down-left", "up-left", "up-left", "up-right", "down-right", "down-right", "up-right", "up-left", "down-left", "down-left", "up-left", "up-left"]
14
0.15983343124389648
14
4
24
[[["e", "u", "n", "a", "_", "e"], ["d", "r", "a", "v", "i", "e"], ["m", "a", "n", "u", "k", "a"], ["k", "h", "a", "t", "u", "m"]]]
[[["e", "u", "n", "a", "_", "e"], ["d", "r", "a", "v", "i", "e"], ["m", "a", "n", "u", "k", "a"], ["k", "h", "a", "t", "u", "m"]], ["uvate", "dearie", "manuka", "khanum"]]
["[['e', 'u', 'n', 'a', '_', 'e'], ['d', 'r', 'a', 'v', 'i', 'e'], ['m', 'a', 'n', 'u', 'k', 'a'], ['k', 'h', 'a', 't', 'u', 'm']]", "['uvate', 'dearie', 'manuka', 'khanum']"]
37
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'L'. Our task is to visit city M and city Q excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from Q and M, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. R Q Y U F K M T X W H L R 0 0 0 0 1 0 1 0 1 0 0 1 Q 0 0 0 0 0 0 0 0 1 0 1 0 Y 1 1 0 0 0 0 0 0 0 0 0 1 U 0 0 1 0 0 0 0 1 0 0 0 0 F 0 1 0 0 0 0 1 0 1 0 0 1 K 1 0 0 1 1 0 1 0 1 0 0 0 M 0 0 0 0 0 1 0 1 0 0 0 0 T 0 1 1 0 0 0 0 0 1 0 0 0 X 0 1 0 1 0 0 0 0 0 0 0 1 W 1 0 0 1 1 0 0 1 0 0 0 1 H 0 1 0 0 1 0 0 0 0 1 0 0 L 0 0 0 0 0 0 0 0 0 1 0 0
city_directed_graph
pathfinding
12
["L", "W", "F", "M", "K", "M", "T", "Q", "H", "Q"]
10
0.03090953826904297
10
12
15
[[[0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]], ["R", "Q", "Y", "U", "F", "K", "M", "T", "X", "W", "H", "L"], "M", "Q"]
[[[0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]], ["R", "Q", "Y", "U", "F", "K", "M", "T", "X", "W", "H", "L"], "L", "M", "Q"]
["[[0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]]", "['R', 'Q', 'Y', 'U', 'F', 'K', 'M', 'T', 'X', 'W', 'H', 'L']", "['L']", "['M', 'Q']"]
37
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [22, 15, 4, 23, 19, 3, 5, 28, 22, 27, 13, 18, 14, 11, 22, 20, 27, 24, 21, 13, 25, 11, 6, 2, 30, 29, 4, 16, 3, 13, 3, 28, 28, 20, 15, 27, 4, 18, 20, 5, 16, 21, 25, 24, 23, 15, 22, 26], such that the sum of the chosen coins adds up to 303. 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: 2, 18: 17, 22: 16, 29: 7, 28: 5, 23: 1, 20: 17, 14: 3, 13: 2, 4: 2, 5: 3, 27: 10, 16: 6, 3: 2, 6: 3, 19: 8, 2: 1, 25: 6, 24: 19, 26: 18, 21: 10, 11: 1, 30: 4}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
30
[11, 11, 13, 23, 23, 14, 15, 15, 15, 4, 13, 13, 25, 29, 28, 4, 25, 16, 6]
56
0.050664663314819336
19
48
48
[[22, 15, 4, 23, 19, 3, 5, 28, 22, 27, 13, 18, 14, 11, 22, 20, 27, 24, 21, 13, 25, 11, 6, 2, 30, 29, 4, 16, 3, 13, 3, 28, 28, 20, 15, 27, 4, 18, 20, 5, 16, 21, 25, 24, 23, 15, 22, 26]]
[[22, 15, 4, 23, 19, 3, 5, 28, 22, 27, 13, 18, 14, 11, 22, 20, 27, 24, 21, 13, 25, 11, 6, 2, 30, 29, 4, 16, 3, 13, 3, 28, 28, 20, 15, 27, 4, 18, 20, 5, 16, 21, 25, 24, 23, 15, 22, 26], {"15": 2, "18": 17, "22": 16, "29": 7, "28": 5, "23": 1, "20": 17, "14": 3, "13": 2, "4": 2, "5": 3, "27": 10, "16": 6, "3": 2, "6": 3, "19": 8, "2": 1, "25": 6, "24": 19, "26": 18, "21": 10, "11": 1, "30": 4}, 303]
["[22, 15, 4, 23, 19, 3, 5, 28, 22, 27, 13, 18, 14, 11, 22, 20, 27, 24, 21, 13, 25, 11, 6, 2, 30, 29, 4, 16, 3, 13, 3, 28, 28, 20, 15, 27, 4, 18, 20, 5, 16, 21, 25, 24, 23, 15, 22, 26]", "{15: 2, 18: 17, 22: 16, 29: 7, 28: 5, 23: 1, 20: 17, 14: 3, 13: 2, 4: 2, 5: 3, 27: 10, 16: 6, 3: 2, 6: 3, 19: 8, 2: 1, 25: 6, 24: 19, 26: 18, 21: 10, 11: 1, 30: 4}", "303"]