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
55
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 28 to 59. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 162, 195, None for columns 1 to 2 respectively, and the sums of rows must be None, 168, 168, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 168. 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: [['46' 'x' '58' '45'] ['x' 'x' '54' 'x'] ['x' 'x' 'x' 'x'] ['28' '53' '34' 'x']]
magic_square
underdetermined_system
8
[[0, 1, 29], [1, 0, 31], [1, 1, 39], [1, 3, 44], [2, 0, 35], [2, 1, 41], [2, 2, 49], [2, 3, 43], [3, 3, 30]]
659
0.8985345363616943
9
49
9
["[['46', '', '58', '45'], ['', '', '54', ''], ['', '', '', ''], ['28', '53', '34', '']]", 4, 28, 59]
["[['46', '', '58', '45'], ['', '', '54', ''], ['', '', '', ''], ['28', '53', '34', '']]", 28, 59, [1, 3], [1, 3], [162, 195], [168, 168], 168]
["[['46', '', '58', '45'], ['', '', '54', ''], ['', '', '', ''], ['28', '53', '34', '']]", "28", "59", "[None, 162, 195, None]", "[None, 168, 168, None]", "168"]
55
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 8, 1: 2, 2: 7, 3: 6, 4: 7, 5: 1, 6: 5, 7: 3}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Red', 'Red', 'Red', 'Green', 'Yellow'], ['Black', 'Red', 'Green', 'Yellow', 'Yellow'], [], [], [], ['Black', 'Blue', 'Black', 'Yellow', 'Green'], [], ['Blue', 'Green', 'Blue', 'Black', 'Blue']]
restricted_sorting
sorting
2
[[5, 6], [5, 3], [5, 6], [5, 2], [7, 3], [7, 5], [7, 3], [7, 6], [7, 3], [1, 6], [0, 7], [0, 7], [0, 7], [1, 7], [1, 5], [2, 1], [0, 5], [0, 1]]
70
14.086882591247559
18
56
20
[[["Red", "Red", "Red", "Green", "Yellow"], ["Black", "Red", "Green", "Yellow", "Yellow"], [], [], [], ["Black", "Blue", "Black", "Yellow", "Green"], [], ["Blue", "Green", "Blue", "Black", "Blue"]], 5, {"0": 8, "1": 2, "2": 7, "3": 6, "4": 7, "5": 1, "6": 5, "7": 3}]
[[["Red", "Red", "Red", "Green", "Yellow"], ["Black", "Red", "Green", "Yellow", "Yellow"], [], [], [], ["Black", "Blue", "Black", "Yellow", "Green"], [], ["Blue", "Green", "Blue", "Black", "Blue"]], 5, {"0": 8, "1": 2, "2": 7, "3": 6, "4": 7, "5": 1, "6": 5, "7": 3}, 4]
["[['Red', 'Red', 'Red', 'Green', 'Yellow'], ['Black', 'Red', 'Green', 'Yellow', 'Yellow'], [], [], [], ['Black', 'Blue', 'Black', 'Yellow', 'Green'], [], ['Blue', 'Green', 'Blue', 'Black', 'Blue']]", "{0: 8, 1: 2, 2: 7, 3: 6, 4: 7, 5: 1, 6: 5, 7: 3}", "5", "4"]
55
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 9) to his destination workshop at index (7, 1), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 8, and district 3 covering rows 9 to 11. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [9 4 16 7 x 2 x x 14 x x x] [x 15 10 5 12 16 x x x 3 12 18] [12 x x x 9 16 3 9 x x x 7] [10 6 3 10 x x 1 17 x 12 12 x] [11 8 15 x 8 16 x x 5 15 12 7] [x x x x 6 x 11 19 17 17 10 20] [x 3 17 17 x x 18 4 x x 9 4] [x 1 5 17 8 15 4 17 5 6 9 11] [x x 4 5 17 18 3 x 9 1 11 2] [x x 5 3 4 14 14 1 17 3 12 12] [x 15 9 7 3 x x x x x 17 x] [x x 13 16 6 x 6 x x x x x]
traffic
pathfinding
4
[[3, 9], [3, 10], [4, 10], [5, 10], [6, 10], [7, 10], [7, 9], [8, 9], [9, 9], [9, 8], [9, 7], [9, 6], [9, 5], [9, 4], [9, 3], [8, 3], [8, 2], [7, 2], [7, 1]]
130
0.02777552604675293
19
4
4
[[["9", "4", "16", "7", "x", "2", "x", "x", "14", "x", "x", "x"], ["x", "15", "10", "5", "12", "16", "x", "x", "x", "3", "12", "18"], ["12", "x", "x", "x", "9", "16", "3", "9", "x", "x", "x", "7"], ["10", "6", "3", "10", "x", "x", "1", "17", "x", "12", "12", "x"], ["11", "8", "15", "x", "8", "16", "x", "x", "5", "15", "12", "7"], ["x", "x", "x", "x", "6", "x", "11", "19", "17", "17", "10", "20"], ["x", "3", "17", "17", "x", "x", "18", "4", "x", "x", "9", "4"], ["x", "1", "5", "17", "8", "15", "4", "17", "5", "6", "9", "11"], ["x", "x", "4", "5", "17", "18", "3", "x", "9", "1", "11", "2"], ["x", "x", "5", "3", "4", "14", "14", "1", "17", "3", "12", "12"], ["x", "15", "9", "7", "3", "x", "x", "x", "x", "x", "17", "x"], ["x", "x", "13", "16", "6", "x", "6", "x", "x", "x", "x", "x"]]]
[[["9", "4", "16", "7", "x", "2", "x", "x", "14", "x", "x", "x"], ["x", "15", "10", "5", "12", "16", "x", "x", "x", "3", "12", "18"], ["12", "x", "x", "x", "9", "16", "3", "9", "x", "x", "x", "7"], ["10", "6", "3", "10", "x", "x", "1", "17", "x", "12", "12", "x"], ["11", "8", "15", "x", "8", "16", "x", "x", "5", "15", "12", "7"], ["x", "x", "x", "x", "6", "x", "11", "19", "17", "17", "10", "20"], ["x", "3", "17", "17", "x", "x", "18", "4", "x", "x", "9", "4"], ["x", "1", "5", "17", "8", "15", "4", "17", "5", "6", "9", "11"], ["x", "x", "4", "5", "17", "18", "3", "x", "9", "1", "11", "2"], ["x", "x", "5", "3", "4", "14", "14", "1", "17", "3", "12", "12"], ["x", "15", "9", "7", "3", "x", "x", "x", "x", "x", "17", "x"], ["x", "x", "13", "16", "6", "x", "6", "x", "x", "x", "x", "x"]], [3, 9], [7, 1], 3, 8]
["[['9', '4', '16', '7', 'x', '2', 'x', 'x', '14', 'x', 'x', 'x'], ['x', '15', '10', '5', '12', '16', 'x', 'x', 'x', '3', '12', '18'], ['12', 'x', 'x', 'x', '9', '16', '3', '9', 'x', 'x', 'x', '7'], ['10', '6', '3', '10', 'x', 'x', '1', '17', 'x', '12', '12', 'x'], ['11', '8', '15', 'x', '8', '16', 'x', 'x', '5', '15', '12', '7'], ['x', 'x', 'x', 'x', '6', 'x', '11', '19', '17', '17', '10', '20'], ['x', '3', '17', '17', 'x', 'x', '18', '4', 'x', 'x', '9', '4'], ['x', '1', '5', '17', '8', '15', '4', '17', '5', '6', '9', '11'], ['x', 'x', '4', '5', '17', '18', '3', 'x', '9', '1', '11', '2'], ['x', 'x', '5', '3', '4', '14', '14', '1', '17', '3', '12', '12'], ['x', '15', '9', '7', '3', 'x', 'x', 'x', 'x', 'x', '17', 'x'], ['x', 'x', '13', '16', '6', 'x', '6', 'x', 'x', 'x', 'x', 'x']]", "(3, 9)", "(7, 1)", "3", "8"]
55
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (1, 11) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (9, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 1 0 0 0 1 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 0 1 0 1 0 1 0 0 0 1 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 1 1 0 1 0 0 1 1 0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 1 0 1 1 1 1 1
trampoline_matrix
pathfinding
12
[[1, 11], [0, 10], [0, 9], [0, 8], [0, 7], [0, 6], [0, 5], [1, 5], [1, 4], [2, 3], [3, 2], [4, 2], [5, 2], [6, 2], [6, 1], [7, 0], [8, 0], [9, 0]]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1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1], [1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1], [0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1]]", "(1, 11)", "(9, 0)", "4"]
55
Given 5 labeled water jugs with capacities 33, 87, 48, 30, 61, 60 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 170, 225, 238, 317 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
[["+", 60, 4], ["+", 61, 4], ["+", 87, 4], ["+", 48, 4], ["+", 61, 4], ["+", 60, 3], ["+", 61, 3], ["+", 30, 3], ["+", 87, 3], ["+", 48, 2], ["+", 60, 2], ["+", 87, 2], ["+", 30, 2], ["+", 61, 1], ["+", 61, 1], ["+", 48, 1]]
16
0.039655208587646484
16
48
3
[[33, 87, 48, 30, 61, 60], [170, 225, 238, 317]]
[[33, 87, 48, 30, 61, 60], [170, 225, 238, 317]]
["[33, 87, 48, 30, 61, 60]", "[170, 225, 238, 317]"]
56
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[66, 96, 24, 10], [79, 33, 84, 100], [22, 80, 15, '_']]
8_puzzle
puzzle
7
[15, 84, 100, 10, 24, 100, 84, 80, 33, 96, 100, 84, 80, 33, 22, 79, 66, 100, 84, 80, 33, 15, 10, 24, 80, 84, 96, 66, 79, 22, 15, 10]
32
1.4827980995178223
32
4
12
[[[66, 96, 24, 10], [79, 33, 84, 100], [22, 80, 15, "_"]]]
[[[66, 96, 24, 10], [79, 33, 84, 100], [22, 80, 15, "_"]]]
["[[66, 96, 24, 10], [79, 33, 84, 100], [22, 80, 15, '_']]"]
56
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: nye, calx, hern, jaob, exam The initial board: [['a', 'n', 'x', 'e'], ['c', 'y', 'l', 'a'], ['r', 'e', '_', 'n'], ['j', 'h', 'o', 'a'], ['e', 'x', 'b', 'm']]
8_puzzle_words
puzzle
2
["up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "down-right", "down-left", "up-left", "up-right", "up-left", "up-left"]
12
0.2367854118347168
12
4
20
[[["a", "n", "x", "e"], ["c", "y", "l", "a"], ["r", "e", "_", "n"], ["j", "h", "o", "a"], ["e", "x", "b", "m"]]]
[[["a", "n", "x", "e"], ["c", "y", "l", "a"], ["r", "e", "_", "n"], ["j", "h", "o", "a"], ["e", "x", "b", "m"]], ["nye", "calx", "hern", "jaob", "exam"]]
["[['a', 'n', 'x', 'e'], ['c', 'y', 'l', 'a'], ['r', 'e', '_', 'n'], ['j', 'h', 'o', 'a'], ['e', 'x', 'b', 'm']]", "['nye', 'calx', 'hern', 'jaob', 'exam']"]
56
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'C'. Our task is to visit city B and city L excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from L and B, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. K M B X N D V C I R F W L K 0 1 0 1 0 0 0 0 0 0 1 0 0 M 0 0 0 0 0 0 1 0 1 0 0 0 1 B 1 0 0 0 0 0 0 0 0 1 0 0 0 X 1 1 0 0 0 0 1 0 0 0 1 0 0 N 0 0 1 0 0 0 0 0 0 0 1 0 0 D 0 0 1 0 0 0 1 1 1 0 0 0 0 V 0 0 0 0 0 0 0 1 1 0 0 0 0 C 0 0 0 1 0 1 0 0 0 0 0 0 0 I 0 0 1 1 1 0 0 0 0 1 0 0 1 R 0 1 0 0 0 0 0 0 0 0 0 1 0 F 0 0 0 0 1 0 0 0 1 1 0 1 0 W 1 1 1 0 0 0 0 1 0 0 0 0 1 L 0 0 0 1 0 0 0 1 0 1 1 1 0
city_directed_graph
pathfinding
13
["C", "D", "B", "K", "M", "L", "F", "I", "L", "W", "B"]
11
0.1076192855834961
11
13
16
[[[0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0]], ["K", "M", "B", "X", "N", "D", "V", "C", "I", "R", "F", "W", "L"], "B", "L"]
[[[0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0]], ["K", "M", "B", "X", "N", "D", "V", "C", "I", "R", "F", "W", "L"], "C", "B", "L"]
["[[0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0]]", "['K', 'M', 'B', 'X', 'N', 'D', 'V', 'C', 'I', 'R', 'F', 'W', 'L']", "['C']", "['B', 'L']"]
56
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [4, 33, 14, 32, 9, 32, 2, 35, 25, 10, 11, 6, 8, 26, 10, 25, 34, 21, 13, 15, 3, 15, 25, 3, 16, 3, 2, 25, 15, 23, 31, 35, 13, 14, 5, 7, 2, 18, 10, 8, 25, 30, 13, 35, 3, 26, 33, 2, 5, 26, 26, 28, 6], such that the sum of the chosen coins adds up to 355. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {26: 4, 34: 4, 7: 5, 28: 11, 35: 8, 18: 13, 25: 19, 14: 10, 23: 7, 6: 1, 10: 5, 21: 8, 13: 13, 2: 1, 3: 1, 30: 5, 4: 4, 31: 18, 11: 3, 9: 1, 8: 3, 5: 3, 32: 5, 15: 15, 33: 18, 16: 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
28
[34, 32, 26, 2, 35, 32, 30, 26, 35, 26, 35, 26, 16]
64
0.06210756301879883
13
53
53
[[4, 33, 14, 32, 9, 32, 2, 35, 25, 10, 11, 6, 8, 26, 10, 25, 34, 21, 13, 15, 3, 15, 25, 3, 16, 3, 2, 25, 15, 23, 31, 35, 13, 14, 5, 7, 2, 18, 10, 8, 25, 30, 13, 35, 3, 26, 33, 2, 5, 26, 26, 28, 6]]
[[4, 33, 14, 32, 9, 32, 2, 35, 25, 10, 11, 6, 8, 26, 10, 25, 34, 21, 13, 15, 3, 15, 25, 3, 16, 3, 2, 25, 15, 23, 31, 35, 13, 14, 5, 7, 2, 18, 10, 8, 25, 30, 13, 35, 3, 26, 33, 2, 5, 26, 26, 28, 6], {"26": 4, "34": 4, "7": 5, "28": 11, "35": 8, "18": 13, "25": 19, "14": 10, "23": 7, "6": 1, "10": 5, "21": 8, "13": 13, "2": 1, "3": 1, "30": 5, "4": 4, "31": 18, "11": 3, "9": 1, "8": 3, "5": 3, "32": 5, "15": 15, "33": 18, "16": 4}, 355]
["[4, 33, 14, 32, 9, 32, 2, 35, 25, 10, 11, 6, 8, 26, 10, 25, 34, 21, 13, 15, 3, 15, 25, 3, 16, 3, 2, 25, 15, 23, 31, 35, 13, 14, 5, 7, 2, 18, 10, 8, 25, 30, 13, 35, 3, 26, 33, 2, 5, 26, 26, 28, 6]", "{26: 4, 34: 4, 7: 5, 28: 11, 35: 8, 18: 13, 25: 19, 14: 10, 23: 7, 6: 1, 10: 5, 21: 8, 13: 13, 2: 1, 3: 1, 30: 5, 4: 4, 31: 18, 11: 3, 9: 1, 8: 3, 5: 3, 32: 5, 15: 15, 33: 18, 16: 4}", "355"]
56
The game of 'Sort It' begins with 3 tubes, each filled with 5 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 8 balls. It is not allowed to place a ball in a tube that already has 8 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Green', 'Red', 'Green', 'Blue', 'Red'], ['Red', 'Green', 'Red', 'Blue', 'Blue'], ['Green', 'Blue', 'Red', 'Green', 'Blue']]
color_sorting
sorting
9
[[2, 0], [1, 2], [1, 0], [2, 1], [2, 1], [2, 1], [2, 0], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [0, 1], [0, 2], [0, 2], [1, 0], [1, 2], [1, 0], [1, 2], [1, 0], [1, 0], [2, 1], [2, 1], [2, 1]]
24
51.796597480773926
24
6
15
[[["Green", "Red", "Green", "Blue", "Red"], ["Red", "Green", "Red", "Blue", "Blue"], ["Green", "Blue", "Red", "Green", "Blue"]], 8]
[[["Green", "Red", "Green", "Blue", "Red"], ["Red", "Green", "Red", "Blue", "Blue"], ["Green", "Blue", "Red", "Green", "Blue"]], 8]
["[['Green', 'Red', 'Green', 'Blue', 'Red'], ['Red', 'Green', 'Red', 'Blue', 'Blue'], ['Green', 'Blue', 'Red', 'Green', 'Blue']]", "8"]
56
We have a 4x4 numerical grid, with numbers ranging from 40 to 80 (40 included in the range but 80 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' 'x' '63' 'x'] ['x' '53' '57' '73'] ['x' 'x' '56' 'x'] ['42' 'x' 'x' '68']]
consecutive_grid
underdetermined_system
13
[[0, 0, 45], [0, 1, 54], [0, 3, 74], [1, 0, 44], [2, 0, 43], [2, 1, 47], [2, 3, 69], [3, 1, 46], [3, 2, 48]]
742
13.670685529708862
9
40
16
["[['', '', '63', ''], ['', '53', '57', '73'], ['', '', '56', ''], ['42', '', '', '68']]", 40, 80]
["[['', '', '63', ''], ['', '53', '57', '73'], ['', '', '56', ''], ['42', '', '', '68']]", 40, 80]
["[['', '', '63', ''], ['', '53', '57', '73'], ['', '', '56', ''], ['42', '', '', '68']]", "40", "80"]
56
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 28 to 59. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 134, 166, None for columns 1 to 2 respectively, and the sums of rows must be None, 185, 162, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 173. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['50' 'x' 'x' '42'] ['x' 'x' '44' 'x'] ['47' 'x' '49' 'x'] ['53' 'x' 'x' '30']]
magic_square
underdetermined_system
8
[[0, 1, 28], [0, 2, 33], [1, 0, 41], [1, 1, 43], [1, 3, 57], [2, 1, 34], [2, 3, 32], [3, 1, 29], [3, 2, 40]]
652
10.336912631988525
9
49
9
["[['50', '', '', '42'], ['', '', '44', ''], ['47', '', '49', ''], ['53', '', '', '30']]", 4, 28, 59]
["[['50', '', '', '42'], ['', '', '44', ''], ['47', '', '49', ''], ['53', '', '', '30']]", 28, 59, [1, 3], [1, 3], [134, 166], [185, 162], 173]
["[['50', '', '', '42'], ['', '', '44', ''], ['47', '', '49', ''], ['53', '', '', '30']]", "28", "59", "[None, 134, 166, None]", "[None, 185, 162, None]", "173"]
56
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 5, 1: 5, 2: 5, 3: 6, 4: 5, 5: 5, 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? [[], ['Yellow', 'Red', 'Black', 'Yellow', 'Green'], [], [], ['Green', 'Red', 'Blue', 'Blue', 'Black'], ['Green', 'Blue', 'Yellow', 'Red', 'Yellow'], [], ['Blue', 'Green', 'Black', 'Red', 'Black']]
restricted_sorting
sorting
2
[[4, 0], [4, 2], [5, 0], [5, 3], [7, 3], [7, 0], [4, 3], [4, 3], [7, 4], [7, 2], [7, 4], [1, 7], [1, 2], [1, 4], [1, 7], [5, 7], [5, 2], [5, 7], [1, 0]]
103
0.03519558906555176
19
56
20
[[[], ["Yellow", "Red", "Black", "Yellow", "Green"], [], [], ["Green", "Red", "Blue", "Blue", "Black"], ["Green", "Blue", "Yellow", "Red", "Yellow"], [], ["Blue", "Green", "Black", "Red", "Black"]], 5, {"0": 5, "1": 5, "2": 5, "3": 6, "4": 5, "5": 5, "6": 9, "7": 6}]
[[[], ["Yellow", "Red", "Black", "Yellow", "Green"], [], [], ["Green", "Red", "Blue", "Blue", "Black"], ["Green", "Blue", "Yellow", "Red", "Yellow"], [], ["Blue", "Green", "Black", "Red", "Black"]], 5, {"0": 5, "1": 5, "2": 5, "3": 6, "4": 5, "5": 5, "6": 9, "7": 6}, 4]
["[[], ['Yellow', 'Red', 'Black', 'Yellow', 'Green'], [], [], ['Green', 'Red', 'Blue', 'Blue', 'Black'], ['Green', 'Blue', 'Yellow', 'Red', 'Yellow'], [], ['Blue', 'Green', 'Black', 'Red', 'Black']]", "{0: 5, 1: 5, 2: 5, 3: 6, 4: 5, 5: 5, 6: 9, 7: 6}", "5", "4"]
56
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (6, 9) to his destination workshop at index (3, 0), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 6, and district 3 covering rows 7 to 11. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [2 x x 14 x 19 6 x x 14 18 x] [x 10 1 15 x x x x 17 2 9 12] [13 14 x 2 x x 10 10 x x x x] [9 17 3 15 4 4 x 9 15 16 x 9] [10 7 3 8 x 7 x 16 3 7 x x] [16 20 16 19 18 3 x x 11 14 5 x] [14 13 8 14 12 19 6 3 19 10 11 x] [x 18 x x 4 19 6 14 15 17 7 x] [x 2 x x x x x 7 x 19 x x] [x 3 14 1 x 18 4 12 x 3 10 x] [2 x 16 13 x 17 x x 17 16 4 10] [x 4 10 x x x 7 x 19 7 x x]
traffic
pathfinding
4
[[6, 9], [6, 8], [6, 7], [6, 6], [7, 6], [6, 6], [6, 5], [5, 5], [4, 5], [3, 5], [3, 4], [3, 3], [3, 2], [3, 1], [3, 0]]
121
0.02821516990661621
15
4
4
[[["2", "x", "x", "14", "x", "19", "6", "x", "x", "14", "18", "x"], ["x", "10", "1", "15", "x", "x", "x", "x", "17", "2", "9", "12"], ["13", "14", "x", "2", "x", "x", "10", "10", "x", "x", "x", "x"], ["9", "17", "3", "15", "4", "4", "x", "9", "15", "16", "x", "9"], ["10", "7", "3", "8", "x", "7", "x", "16", "3", "7", "x", "x"], ["16", "20", "16", "19", "18", "3", "x", "x", "11", "14", "5", "x"], ["14", "13", "8", "14", "12", "19", "6", "3", "19", "10", "11", "x"], ["x", "18", "x", "x", "4", "19", "6", "14", "15", "17", "7", "x"], ["x", "2", "x", "x", "x", "x", "x", "7", "x", "19", "x", "x"], ["x", "3", "14", "1", "x", "18", "4", "12", "x", "3", "10", "x"], ["2", "x", "16", "13", "x", "17", "x", "x", "17", "16", "4", "10"], ["x", "4", "10", "x", "x", "x", "7", "x", "19", "7", "x", "x"]]]
[[["2", "x", "x", "14", "x", "19", "6", "x", "x", "14", "18", "x"], ["x", "10", "1", "15", "x", "x", "x", "x", "17", "2", "9", "12"], ["13", "14", "x", "2", "x", "x", "10", "10", "x", "x", "x", "x"], ["9", "17", "3", "15", "4", "4", "x", "9", "15", "16", "x", "9"], ["10", "7", "3", "8", "x", "7", "x", "16", "3", "7", "x", "x"], ["16", "20", "16", "19", "18", "3", "x", "x", "11", "14", "5", "x"], ["14", "13", "8", "14", "12", "19", "6", "3", "19", "10", "11", "x"], ["x", "18", "x", "x", "4", "19", "6", "14", "15", "17", "7", "x"], ["x", "2", "x", "x", "x", "x", "x", "7", "x", "19", "x", "x"], ["x", "3", "14", "1", "x", "18", "4", "12", "x", "3", "10", "x"], ["2", "x", "16", "13", "x", "17", "x", "x", "17", "16", "4", "10"], ["x", "4", "10", "x", "x", "x", "7", "x", "19", "7", "x", "x"]], [6, 9], [3, 0], 3, 6]
["[['2', 'x', 'x', '14', 'x', '19', '6', 'x', 'x', '14', '18', 'x'], ['x', '10', '1', '15', 'x', 'x', 'x', 'x', '17', '2', '9', '12'], ['13', '14', 'x', '2', 'x', 'x', '10', '10', 'x', 'x', 'x', 'x'], ['9', '17', '3', '15', '4', '4', 'x', '9', '15', '16', 'x', '9'], ['10', '7', '3', '8', 'x', '7', 'x', '16', '3', '7', 'x', 'x'], ['16', '20', '16', '19', '18', '3', 'x', 'x', '11', '14', '5', 'x'], ['14', '13', '8', '14', '12', '19', '6', '3', '19', '10', '11', 'x'], ['x', '18', 'x', 'x', '4', '19', '6', '14', '15', '17', '7', 'x'], ['x', '2', 'x', 'x', 'x', 'x', 'x', '7', 'x', '19', 'x', 'x'], ['x', '3', '14', '1', 'x', '18', '4', '12', 'x', '3', '10', 'x'], ['2', 'x', '16', '13', 'x', '17', 'x', 'x', '17', '16', '4', '10'], ['x', '4', '10', 'x', 'x', 'x', '7', 'x', '19', '7', 'x', 'x']]", "(6, 9)", "(3, 0)", "3", "6"]
56
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (11, 7) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (2, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 0 1 1 0 1 1 1 1 1 0 0 1 0 1 1 0 0 0 0 1 1 1 1 0 0 1 1 1 0 0 1 0 1 1 0 1 0 0 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 1 0 1 1 0 0 1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0 0 1 0 1 1 0 0 1 0 1 0 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 1 1 1 0 0 0 0 0 0 1 1 0
trampoline_matrix
pathfinding
12
[[11, 7], [10, 6], [10, 5], [9, 4], [8, 3], [7, 2], [7, 1], [7, 0], [6, 0], [5, 0], [4, 0], [4, 1], [3, 1], [2, 1], [2, 0]]
15
0.029215574264526367
15
8
2
["[[0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0], [1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0]]", 4]
["[[0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0], [1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0]]", [11, 7], [2, 0], 4]
["[[0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0], [1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1], [0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0]]", "(11, 7)", "(2, 0)", "4"]
56
Given 5 labeled water jugs with capacities 12, 88, 148, 87, 143, 131 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 260, 295, 331, 394 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
[["+", 87, 4], ["+", 148, 4], ["+", 148, 4], ["-", 88, 4], ["+", 87, 4], ["+", 12, 4], ["+", 88, 3], ["+", 88, 3], ["+", 12, 3], ["+", 143, 3], ["+", 131, 2], ["-", 12, 2], ["+", 88, 2], ["+", 88, 2], ["+", 12, 1], ["+", 88, 1], ["+", 148, 1], ["+", 12, 1]]
18
0.03827953338623047
18
48
3
[[12, 88, 148, 87, 143, 131], [260, 295, 331, 394]]
[[12, 88, 148, 87, 143, 131], [260, 295, 331, 394]]
["[12, 88, 148, 87, 143, 131]", "[260, 295, 331, 394]"]
57
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: [[71, 42, 22, 90], [79, 78, '_', 68], [25, 58, 28, 12]]
8_puzzle
puzzle
7
[28, 12, 68, 28, 22, 90, 28, 68, 12, 22, 90, 42, 78, 90, 68, 28, 42, 78, 71, 79, 90, 68, 78, 71, 79, 90, 68, 58, 22, 12, 28, 42, 71, 78, 42, 28]
36
6.940868616104126
36
4
12
[[[71, 42, 22, 90], [79, 78, "_", 68], [25, 58, 28, 12]]]
[[[71, 42, 22, 90], [79, 78, "_", 68], [25, 58, 28, 12]]]
["[[71, 42, 22, 90], [79, 78, '_', 68], [25, 58, 28, 12]]"]
57
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: toe, kuba, meng, peso, youp The initial board: [['u', 't', '_', 'e'], ['k', 'a', 'b', 'm'], ['n', 'e', 'o', 'g'], ['p', 'u', 's', 'o'], ['y', 'o', 'e', 'p']]
8_puzzle_words
puzzle
2
["down-left", "down-right", "up-right", "up-left", "down-left", "down-left", "down-right", "down-right", "up-right", "up-left", "down-left", "up-left", "up-right", "down-right", "down-right", "down-left", "up-left", "up-left", "up-right", "down-right", "down-left", "up-left", "up-right", "up-left"]
24
0.5264327526092529
24
4
20
[[["u", "t", "_", "e"], ["k", "a", "b", "m"], ["n", "e", "o", "g"], ["p", "u", "s", "o"], ["y", "o", "e", "p"]]]
[[["u", "t", "_", "e"], ["k", "a", "b", "m"], ["n", "e", "o", "g"], ["p", "u", "s", "o"], ["y", "o", "e", "p"]], ["toe", "kuba", "meng", "peso", "youp"]]
["[['u', 't', '_', 'e'], ['k', 'a', 'b', 'm'], ['n', 'e', 'o', 'g'], ['p', 'u', 's', 'o'], ['y', 'o', 'e', 'p']]", "['toe', 'kuba', 'meng', 'peso', 'youp']"]
57
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 V and city I excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from I and V, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. V C I Y W Q X K Z T J U F V 0 1 0 1 1 0 0 0 0 0 0 0 0 C 0 0 0 1 0 0 0 0 0 0 1 0 0 I 1 1 0 1 0 1 0 0 0 0 0 0 0 Y 0 0 0 0 0 0 0 0 1 0 1 0 1 W 0 1 0 0 0 1 1 0 0 0 0 0 0 Q 0 1 0 0 0 0 0 1 0 0 0 0 1 X 1 0 1 0 0 0 0 0 0 0 0 1 1 K 1 0 0 0 1 0 1 0 0 0 0 0 0 Z 1 1 0 1 0 1 1 1 0 0 0 0 0 T 0 1 0 0 1 0 1 1 0 0 0 0 1 J 0 1 1 0 0 1 1 1 0 1 0 0 0 U 1 0 1 0 0 0 0 0 1 1 1 0 0 F 0 0 0 0 0 1 0 0 0 0 1 0 0
city_directed_graph
pathfinding
13
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 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0]], ["V", "C", "I", "Y", "W", "Q", "X", "K", "Z", "T", "J", "U", "F"], "T", "V", "I"]
["[[0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1], [0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1], [0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0]]", "['V', 'C', 'I', 'Y', 'W', 'Q', 'X', 'K', 'Z', 'T', 'J', 'U', 'F']", "['T']", "['V', 'I']"]
57
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [25, 22, 28, 23, 5, 14, 28, 14, 20, 6, 22, 1, 25, 18, 30, 10, 19, 12, 17, 17, 6, 28, 21, 28, 21, 2, 20, 2, 19, 14, 31, 31, 14, 7, 20, 13, 7, 18, 22, 15, 6, 6, 21, 9, 18, 11, 20, 26, 15], such that the sum of the chosen coins adds up to 322. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {11: 1, 14: 4, 7: 2, 25: 4, 12: 5, 20: 19, 13: 6, 15: 11, 30: 18, 1: 1, 2: 2, 31: 6, 10: 2, 23: 1, 6: 2, 21: 18, 18: 8, 28: 15, 17: 5, 26: 6, 22: 6, 9: 1, 19: 2, 5: 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
29
[7, 9, 11, 19, 19, 25, 25, 31, 22, 31, 26, 22, 23, 22, 14, 10, 6]
61
0.05817842483520508
17
49
49
[[25, 22, 28, 23, 5, 14, 28, 14, 20, 6, 22, 1, 25, 18, 30, 10, 19, 12, 17, 17, 6, 28, 21, 28, 21, 2, 20, 2, 19, 14, 31, 31, 14, 7, 20, 13, 7, 18, 22, 15, 6, 6, 21, 9, 18, 11, 20, 26, 15]]
[[25, 22, 28, 23, 5, 14, 28, 14, 20, 6, 22, 1, 25, 18, 30, 10, 19, 12, 17, 17, 6, 28, 21, 28, 21, 2, 20, 2, 19, 14, 31, 31, 14, 7, 20, 13, 7, 18, 22, 15, 6, 6, 21, 9, 18, 11, 20, 26, 15], {"11": 1, "14": 4, "7": 2, "25": 4, "12": 5, "20": 19, "13": 6, "15": 11, "30": 18, "1": 1, "2": 2, "31": 6, "10": 2, "23": 1, "6": 2, "21": 18, "18": 8, "28": 15, "17": 5, "26": 6, "22": 6, "9": 1, "19": 2, "5": 4}, 322]
["[25, 22, 28, 23, 5, 14, 28, 14, 20, 6, 22, 1, 25, 18, 30, 10, 19, 12, 17, 17, 6, 28, 21, 28, 21, 2, 20, 2, 19, 14, 31, 31, 14, 7, 20, 13, 7, 18, 22, 15, 6, 6, 21, 9, 18, 11, 20, 26, 15]", "{11: 1, 14: 4, 7: 2, 25: 4, 12: 5, 20: 19, 13: 6, 15: 11, 30: 18, 1: 1, 2: 2, 31: 6, 10: 2, 23: 1, 6: 2, 21: 18, 18: 8, 28: 15, 17: 5, 26: 6, 22: 6, 9: 1, 19: 2, 5: 4}", "322"]
57
The game of 'Sort It' begins with 3 tubes, each filled with 5 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 8 balls. It is not allowed to place a ball in a tube that already has 8 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Green', 'Blue', 'Green', 'Green'], ['Green', 'Red', 'Blue', 'Blue', 'Blue'], ['Red', 'Red', 'Blue', 'Green', 'Red']]
color_sorting
sorting
9
[[0, 2], [0, 1], [0, 2], [1, 0], [1, 0], [1, 0], [2, 1], [2, 0], [2, 0], [2, 0], [2, 1], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [1, 0]]
17
1.3616485595703125
17
6
15
[[["Red", "Green", "Blue", "Green", "Green"], ["Green", "Red", "Blue", "Blue", "Blue"], ["Red", "Red", "Blue", "Green", "Red"]], 8]
[[["Red", "Green", "Blue", "Green", "Green"], ["Green", "Red", "Blue", "Blue", "Blue"], ["Red", "Red", "Blue", "Green", "Red"]], 8]
["[['Red', 'Green', 'Blue', 'Green', 'Green'], ['Green', 'Red', 'Blue', 'Blue', 'Blue'], ['Red', 'Red', 'Blue', 'Green', 'Red']]", "8"]
57
We have a 4x4 numerical grid, with numbers ranging from 7 to 47 (7 included in the range but 47 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['11' '14' 'x' 'x'] ['12' 'x' 'x' '38'] ['x' 'x' 'x' '36'] ['25' 'x' 'x' '34']]
consecutive_grid
underdetermined_system
13
[[0, 2, 15], [0, 3, 39], [1, 1, 16], [1, 2, 17], [2, 0, 13], [2, 1, 18], [2, 2, 19], [3, 1, 26], [3, 2, 27]]
306
88.0573205947876
9
40
16
["[['11', '14', '', ''], ['12', '', '', '38'], ['', '', '', '36'], ['25', '', '', '34']]", 7, 47]
["[['11', '14', '', ''], ['12', '', '', '38'], ['', '', '', '36'], ['25', '', '', '34']]", 7, 47]
["[['11', '14', '', ''], ['12', '', '', '38'], ['', '', '', '36'], ['25', '', '', '34']]", "7", "47"]
57
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 28 to 59. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 170, 162, None for columns 1 to 2 respectively, and the sums of rows must be None, 191, 157, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 171. 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: [['42' 'x' '41' 'x'] ['x' '48' 'x' 'x'] ['x' '39' '30' '52'] ['x' 'x' '40' 'x']]
magic_square
underdetermined_system
7
[[0, 1, 29], [0, 3, 31], [1, 0, 34], [1, 2, 51], [1, 3, 58], [2, 0, 36], [3, 0, 50], [3, 1, 54], [3, 3, 28]]
663
3.644191026687622
9
26
16
["[['42', '', '41', ''], ['', '48', '', ''], ['', '39', '30', '52'], ['', '', '40', '']]", 4, 28, 59]
["[['42', '', '41', ''], ['', '48', '', ''], ['', '39', '30', '52'], ['', '', '40', '']]", 28, 59, [1, 3], [1, 3], [170, 162], [191, 157], 171]
["[['42', '', '41', ''], ['', '48', '', ''], ['', '39', '30', '52'], ['', '', '40', '']]", "28", "59", "[None, 170, 162, None]", "[None, 191, 157, None]", "171"]
57
In 'Restricted Sorting', there are 8 stacks each with a capacity of 5 blocks, with 4 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 4 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 2, 1: 3, 2: 9, 3: 8, 4: 3, 5: 7, 6: 9, 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', 'Red', 'Black', 'Blue', 'Blue'], ['Yellow', 'Blue', 'Blue', 'Green', 'Black'], ['Yellow', 'Yellow', 'Yellow', 'Red', 'Black'], [], [], ['Red', 'Green', 'Green', 'Red', 'Black']]
restricted_sorting
sorting
2
[[2, 0], [2, 1], [7, 1], [7, 0], [7, 0], [7, 1], [2, 7], [3, 5], [4, 5], [4, 5], [4, 5], [4, 1], [4, 7], [3, 4], [3, 4], [3, 0], [3, 7], [2, 4], [2, 4]]
75
0.13939952850341797
19
56
20
[[[], [], ["Green", "Red", "Black", "Blue", "Blue"], ["Yellow", "Blue", "Blue", "Green", "Black"], ["Yellow", "Yellow", "Yellow", "Red", "Black"], [], [], ["Red", "Green", "Green", "Red", "Black"]], 5, {"0": 2, "1": 3, "2": 9, "3": 8, "4": 3, "5": 7, "6": 9, "7": 5}]
[[[], [], ["Green", "Red", "Black", "Blue", "Blue"], ["Yellow", "Blue", "Blue", "Green", "Black"], ["Yellow", "Yellow", "Yellow", "Red", "Black"], [], [], ["Red", "Green", "Green", "Red", "Black"]], 5, {"0": 2, "1": 3, "2": 9, "3": 8, "4": 3, "5": 7, "6": 9, "7": 5}, 4]
["[[], [], ['Green', 'Red', 'Black', 'Blue', 'Blue'], ['Yellow', 'Blue', 'Blue', 'Green', 'Black'], ['Yellow', 'Yellow', 'Yellow', 'Red', 'Black'], [], [], ['Red', 'Green', 'Green', 'Red', 'Black']]", "{0: 2, 1: 3, 2: 9, 3: 8, 4: 3, 5: 7, 6: 9, 7: 5}", "5", "4"]
57
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 3, district 2 covering rows 4 to 6, and district 3 covering rows 7 to 11. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [17 9 11 5 19 4 18 x 5 8 x x] [6 13 x 9 2 20 11 20 7 x x 3] [4 17 x 18 2 10 x 16 x 18 x x] [12 10 9 14 x x 12 6 1 2 x x] [5 x x 3 x 4 9 14 8 x 10 12] [1 x 6 3 18 18 17 17 10 x x 10] [13 x x x x x 14 x 1 19 x 7] [11 x x 5 9 x 18 19 13 13 x 10] [x x 11 x 17 x x x 14 17 x 13] [19 x x x x 19 12 7 3 14 x 9] [x 12 7 15 1 x 16 11 9 17 x x] [x x x 10 x 1 7 x x x 6 12]
traffic
pathfinding
4
[[7, 0], [6, 0], [5, 0], [4, 0], [3, 0], [3, 1], [3, 2], [3, 3], [4, 3], [5, 3], [5, 4], [5, 5], [4, 5], [4, 6], [3, 6], [3, 7], [3, 8]]
138
0.02782440185546875
17
4
4
[[["17", "9", "11", "5", "19", "4", "18", "x", "5", "8", "x", "x"], ["6", "13", "x", "9", "2", "20", "11", "20", "7", "x", "x", "3"], ["4", "17", "x", "18", "2", "10", "x", "16", "x", "18", "x", "x"], ["12", "10", "9", "14", "x", "x", "12", "6", "1", "2", "x", "x"], ["5", "x", "x", "3", "x", "4", "9", "14", "8", "x", "10", "12"], ["1", "x", "6", "3", "18", "18", "17", "17", "10", "x", "x", "10"], ["13", "x", "x", "x", "x", "x", "14", "x", "1", "19", "x", "7"], ["11", "x", "x", "5", "9", "x", "18", "19", "13", "13", "x", "10"], ["x", "x", "11", "x", "17", "x", "x", "x", "14", "17", "x", "13"], ["19", "x", "x", "x", "x", "19", "12", "7", "3", "14", "x", "9"], ["x", "12", "7", "15", "1", "x", "16", "11", "9", "17", "x", "x"], ["x", "x", "x", "10", "x", "1", "7", "x", "x", "x", "6", "12"]]]
[[["17", "9", "11", "5", "19", "4", "18", "x", "5", "8", "x", "x"], ["6", "13", "x", "9", "2", "20", "11", "20", "7", "x", "x", "3"], ["4", "17", "x", "18", "2", "10", "x", "16", "x", "18", "x", "x"], ["12", "10", "9", "14", "x", "x", "12", "6", "1", "2", "x", "x"], ["5", "x", "x", "3", "x", "4", "9", "14", "8", "x", "10", "12"], ["1", "x", "6", "3", "18", "18", "17", "17", "10", "x", "x", "10"], ["13", "x", "x", "x", "x", "x", "14", "x", "1", "19", "x", "7"], ["11", "x", "x", "5", "9", "x", "18", "19", "13", "13", "x", "10"], ["x", "x", "11", "x", "17", "x", "x", "x", "14", "17", "x", "13"], ["19", "x", "x", "x", "x", "19", "12", "7", "3", "14", "x", "9"], ["x", "12", "7", "15", "1", "x", "16", "11", "9", "17", "x", "x"], ["x", "x", "x", "10", "x", "1", "7", "x", "x", "x", "6", "12"]], [7, 0], [3, 8], 3, 6]
["[['17', '9', '11', '5', '19', '4', '18', 'x', '5', '8', 'x', 'x'], ['6', '13', 'x', '9', '2', '20', '11', '20', '7', 'x', 'x', '3'], ['4', '17', 'x', '18', '2', '10', 'x', '16', 'x', '18', 'x', 'x'], ['12', '10', '9', '14', 'x', 'x', '12', '6', '1', '2', 'x', 'x'], ['5', 'x', 'x', '3', 'x', '4', '9', '14', '8', 'x', '10', '12'], ['1', 'x', '6', '3', '18', '18', '17', '17', '10', 'x', 'x', '10'], ['13', 'x', 'x', 'x', 'x', 'x', '14', 'x', '1', '19', 'x', '7'], ['11', 'x', 'x', '5', '9', 'x', '18', '19', '13', '13', 'x', '10'], ['x', 'x', '11', 'x', '17', 'x', 'x', 'x', '14', '17', 'x', '13'], ['19', 'x', 'x', 'x', 'x', '19', '12', '7', '3', '14', 'x', '9'], ['x', '12', '7', '15', '1', 'x', '16', '11', '9', '17', 'x', 'x'], ['x', 'x', 'x', '10', 'x', '1', '7', 'x', 'x', 'x', '6', '12']]", "(7, 0)", "(3, 8)", "3", "6"]
57
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (11, 2) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (3, 10). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 0 0 0 1 0 1 1 0 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0 1 1 0 1 0 1 1 0 1 1 1 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 1 0 0 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 1 0 0 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 0
trampoline_matrix
pathfinding
12
[[11, 2], [10, 2], [10, 3], [9, 4], [8, 4], [8, 5], [7, 5], [6, 5], [5, 6], [5, 7], [5, 8], [6, 9], [5, 10], [4, 10], [3, 10]]
15
0.03331708908081055
15
8
2
["[[1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1], [1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0]]", 4]
["[[1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1], [1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0]]", [11, 2], [3, 10], 4]
["[[1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1], [1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0]]", "(11, 2)", "(3, 10)", "4"]
57
Given 5 labeled water jugs with capacities 15, 20, 141, 104, 67, 14 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 230, 267, 278, 318 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
[["+", 67, 4], ["+", 104, 4], ["+", 141, 4], ["-", 14, 4], ["+", 20, 4], ["+", 67, 3], ["+", 67, 3], ["+", 104, 3], ["+", 20, 3], ["+", 20, 3], ["+", 141, 2], ["-", 15, 2], ["+", 141, 2], ["+", 104, 1], ["-", 15, 1], ["+", 141, 1]]
16
0.03609800338745117
16
48
3
[[15, 20, 141, 104, 67, 14], [230, 267, 278, 318]]
[[15, 20, 141, 104, 67, 14], [230, 267, 278, 318]]
["[15, 20, 141, 104, 67, 14]", "[230, 267, 278, 318]"]
58
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: [[94, 91, 92, 46], [6, 86, '_', 10], [12, 58, 73, 75]]
8_puzzle
puzzle
7
[86, 91, 92, 86, 91, 58, 73, 75, 10, 46, 86, 91, 58, 6, 12, 73, 75, 10, 46, 58, 6, 75, 73, 12, 75, 73, 10, 6, 58, 46]
30
1.039477825164795
30
4
12
[[[94, 91, 92, 46], [6, 86, "_", 10], [12, 58, 73, 75]]]
[[[94, 91, 92, 46], [6, 86, "_", 10], [12, 58, 73, 75]]]
["[[94, 91, 92, 46], [6, 86, '_', 10], [12, 58, 73, 75]]"]
58
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: eld, vint, edea, poco, pirl The initial board: [['i', 'e', 'e', 'd'], ['v', 't', 'n', 'l'], ['o', 'd', '_', 'a'], ['p', 'r', 'c', 'e'], ['p', 'i', 'o', 'l']]
8_puzzle_words
puzzle
2
["up-left", "up-right", "down-right", "down-left", "down-right", "down-left", "up-left", "up-left", "up-right", "up-left"]
10
0.1858220100402832
10
4
20
[[["i", "e", "e", "d"], ["v", "t", "n", "l"], ["o", "d", "_", "a"], ["p", "r", "c", "e"], ["p", "i", "o", "l"]]]
[[["i", "e", "e", "d"], ["v", "t", "n", "l"], ["o", "d", "_", "a"], ["p", "r", "c", "e"], ["p", "i", "o", "l"]], ["eld", "vint", "edea", "poco", "pirl"]]
["[['i', 'e', 'e', 'd'], ['v', 't', 'n', 'l'], ['o', 'd', '_', 'a'], ['p', 'r', 'c', 'e'], ['p', 'i', 'o', 'l']]", "['eld', 'vint', 'edea', 'poco', 'pirl']"]
58
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'S'. Our task is to visit city B and city V 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 V and B, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. B K S X T P Q M R G J V E B 0 1 0 0 0 1 0 1 1 0 1 0 0 K 0 0 0 1 0 1 0 0 0 0 0 0 0 S 0 1 0 0 0 1 0 0 0 0 0 0 0 X 0 1 0 0 0 0 0 0 0 0 1 1 0 T 0 1 1 0 0 0 1 0 0 0 1 1 0 P 0 0 0 0 1 0 0 0 0 1 0 0 0 Q 1 0 0 0 0 1 0 0 0 1 1 0 0 M 0 1 1 0 1 0 0 0 0 0 0 0 0 R 1 1 0 1 0 0 1 0 0 1 0 0 0 G 0 0 1 0 0 0 1 0 0 0 1 0 0 J 0 1 0 0 1 0 0 1 0 0 0 0 0 V 1 0 0 0 0 0 0 0 1 0 0 0 1 E 1 1 0 0 1 1 1 0 1 0 0 0 0
city_directed_graph
pathfinding
13
["S", "K", "X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0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1], [1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0]], ["B", "K", "S", "X", "T", "P", "Q", "M", "R", "G", "J", "V", "E"], "S", "B", "V"]
["[[0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1], [1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0]]", "['B', 'K', 'S', 'X', 'T', 'P', 'Q', 'M', 'R', 'G', 'J', 'V', 'E']", "['S']", "['B', 'V']"]
58
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [10, 16, 2, 18, 10, 16, 17, 32, 18, 33, 23, 20, 21, 25, 32, 24, 10, 27, 13, 27, 30, 13, 19, 20, 4, 5, 15, 8, 8, 34, 21, 14, 3, 20, 10, 18, 3, 14, 28, 6, 4, 8, 15, 4, 30, 30, 12, 20, 14, 10], such that the sum of the chosen coins adds up to 357. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {30: 12, 20: 19, 16: 7, 24: 14, 12: 3, 13: 4, 8: 2, 2: 1, 21: 2, 23: 12, 34: 13, 27: 16, 3: 3, 28: 3, 14: 13, 6: 4, 33: 17, 10: 8, 5: 3, 15: 12, 4: 2, 18: 2, 19: 5, 17: 1, 32: 2, 25: 12}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
30
[32, 28, 8, 17, 21, 18, 21, 18, 12, 8, 19, 18, 8, 4, 13, 4, 13, 33, 32, 30]
73
0.05944538116455078
20
50
50
[[10, 16, 2, 18, 10, 16, 17, 32, 18, 33, 23, 20, 21, 25, 32, 24, 10, 27, 13, 27, 30, 13, 19, 20, 4, 5, 15, 8, 8, 34, 21, 14, 3, 20, 10, 18, 3, 14, 28, 6, 4, 8, 15, 4, 30, 30, 12, 20, 14, 10]]
[[10, 16, 2, 18, 10, 16, 17, 32, 18, 33, 23, 20, 21, 25, 32, 24, 10, 27, 13, 27, 30, 13, 19, 20, 4, 5, 15, 8, 8, 34, 21, 14, 3, 20, 10, 18, 3, 14, 28, 6, 4, 8, 15, 4, 30, 30, 12, 20, 14, 10], {"30": 12, "20": 19, "16": 7, "24": 14, "12": 3, "13": 4, "8": 2, "2": 1, "21": 2, "23": 12, "34": 13, "27": 16, "3": 3, "28": 3, "14": 13, "6": 4, "33": 17, "10": 8, "5": 3, "15": 12, "4": 2, "18": 2, "19": 5, "17": 1, "32": 2, "25": 12}, 357]
["[10, 16, 2, 18, 10, 16, 17, 32, 18, 33, 23, 20, 21, 25, 32, 24, 10, 27, 13, 27, 30, 13, 19, 20, 4, 5, 15, 8, 8, 34, 21, 14, 3, 20, 10, 18, 3, 14, 28, 6, 4, 8, 15, 4, 30, 30, 12, 20, 14, 10]", "{30: 12, 20: 19, 16: 7, 24: 14, 12: 3, 13: 4, 8: 2, 2: 1, 21: 2, 23: 12, 34: 13, 27: 16, 3: 3, 28: 3, 14: 13, 6: 4, 33: 17, 10: 8, 5: 3, 15: 12, 4: 2, 18: 2, 19: 5, 17: 1, 32: 2, 25: 12}", "357"]
58
The game of 'Sort It' begins with 3 tubes, each filled with 5 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 8 balls. It is not allowed to place a ball in a tube that already has 8 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Blue', 'Green', 'Blue', 'Blue'], ['Green', 'Red', 'Green', 'Red', 'Blue'], ['Blue', 'Green', 'Red', 'Red', 'Green']]
color_sorting
sorting
9
[[0, 1], [0, 2], [0, 1], [2, 0], [2, 0], [2, 1], [2, 0], [2, 0], [1, 2], [1, 2], [1, 0], [1, 2], [1, 0], [1, 2], [1, 2], [1, 2], [0, 1], [0, 1], [0, 1], [0, 1], [2, 0], [2, 1]]
22
19.447868585586548
22
6
15
[[["Red", "Blue", "Green", "Blue", "Blue"], ["Green", "Red", "Green", "Red", "Blue"], ["Blue", "Green", "Red", "Red", "Green"]], 8]
[[["Red", "Blue", "Green", "Blue", "Blue"], ["Green", "Red", "Green", "Red", "Blue"], ["Blue", "Green", "Red", "Red", "Green"]], 8]
["[['Red', 'Blue', 'Green', 'Blue', 'Blue'], ['Green', 'Red', 'Green', 'Red', 'Blue'], ['Blue', 'Green', 'Red', 'Red', 'Green']]", "8"]
58
We have a 4x4 numerical grid, with numbers ranging from 42 to 82 (42 included in the range but 82 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['79' 'x' 'x' 'x'] ['x' 'x' '65' 'x'] ['56' '60' 'x' 'x'] ['48' '54' 'x' 'x']]
consecutive_grid
underdetermined_system
14
[[0, 0, 23], [0, 1, 31], [0, 3, 39], [1, 0, 21], [1, 2, 40], [1, 3, 41], [2, 1, 24], [2, 3, 45], [3, 0, 19], [3, 2, 46]]
467
127.71580004692078
10
40
16
["[['', '', '38', ''], ['', '30', '', ''], ['20', '', '44', ''], ['', '22', '', '57']]", 19, 59]
["[['', '', '38', ''], ['', '30', '', ''], ['20', '', '44', ''], ['', '22', '', '57']]", 19, 59]
["[['', '', '38', ''], ['', '30', '', ''], ['20', '', '44', ''], ['', '22', '', '57']]", "19", "59"]
58
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 22 to 53. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 137, 162, None for columns 1 to 2 respectively, and the sums of rows must be None, 141, 135, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 151. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' 'x' 'x' '40'] ['34' '37' 'x' 'x'] ['x' '43' 'x' '22'] ['x' 'x' 'x' '47']]
magic_square
underdetermined_system
7
[[0, 0, 23], [0, 1, 27], [0, 2, 31], [1, 2, 44], [1, 3, 26], [2, 0, 25], [2, 2, 45], [3, 0, 24], [3, 1, 30], [3, 2, 42]]
540
180.21373414993286
10
26
16
["[['', '', '', '40'], ['34', '37', '', ''], ['', '43', '', '22'], ['', '', '', '47']]", 4, 22, 53]
["[['', '', '', '40'], ['34', '37', '', ''], ['', '43', '', '22'], ['', '', '', '47']]", 22, 53, [1, 3], [1, 3], [137, 162], [141, 135], 151]
["[['', '', '', '40'], ['34', '37', '', ''], ['', '43', '', '22'], ['', '', '', '47']]", "22", "53", "[None, 137, 162, None]", "[None, 141, 135, None]", "151"]
58
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: 8, 2: 9, 3: 9, 4: 5, 5: 7, 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? [[], ['Green', 'Yellow', 'Red', 'Red', 'Red'], [], ['Green', 'Yellow', 'Green', 'Blue', 'Black'], ['Red', 'Yellow', 'Black', 'Blue', 'Black'], [], [], ['Green', 'Black', 'Yellow', 'Blue', 'Blue']]
restricted_sorting
sorting
2
[[1, 0], [7, 0], [1, 5], [4, 1], [4, 5], [3, 0], [3, 5], [3, 0], [3, 2], [7, 3], [7, 5], [4, 3], [4, 7], [2, 7], [3, 4], [3, 4], [3, 4]]
106
0.03409838676452637
17
56
20
[[[], ["Green", "Yellow", "Red", "Red", "Red"], [], ["Green", "Yellow", "Green", "Blue", "Black"], ["Red", "Yellow", "Black", "Blue", "Black"], [], [], ["Green", "Black", "Yellow", "Blue", "Blue"]], 5, {"0": 4, "1": 8, "2": 9, "3": 9, "4": 5, "5": 7, "6": 9, "7": 6}]
[[[], ["Green", "Yellow", "Red", "Red", "Red"], [], ["Green", "Yellow", "Green", "Blue", "Black"], ["Red", "Yellow", "Black", "Blue", "Black"], [], [], ["Green", "Black", "Yellow", "Blue", "Blue"]], 5, {"0": 4, "1": 8, "2": 9, "3": 9, "4": 5, "5": 7, "6": 9, "7": 6}, 4]
["[[], ['Green', 'Yellow', 'Red', 'Red', 'Red'], [], ['Green', 'Yellow', 'Green', 'Blue', 'Black'], ['Red', 'Yellow', 'Black', 'Blue', 'Black'], [], [], ['Green', 'Black', 'Yellow', 'Blue', 'Blue']]", "{0: 4, 1: 8, 2: 9, 3: 9, 4: 5, 5: 7, 6: 9, 7: 6}", "5", "4"]
58
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (1, 3) to his destination workshop at index (6, 10), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 5, and district 3 covering rows 6 to 11. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x x x 6 9 x x 10 14 7 3 12] [x 11 x 3 14 16 17 1 4 14 8 16] [3 x x x 6 1 18 16 x 6 3 11] [x x 11 4 8 x x 1 3 9 8 7] [x x 3 x x x 8 14 18 x x 18] [4 1 x x x 14 x x x 3 4 20] [1 x x x 14 19 15 x x 3 16 15] [x x 6 18 x x 16 1 x 3 x 11] [x 3 x 15 x 19 10 x x x x x] [x 9 x x x x 17 17 x 16 x 13] [x x 8 x x 1 x x x 19 19 1] [x 3 9 x x x x 1 x 10 11 8]
traffic
pathfinding
4
[[1, 3], [1, 4], [2, 4], [2, 5], [2, 6], [2, 7], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [4, 11], [5, 11], [5, 10], [6, 10]]
141
0.027864456176757812
15
4
4
[[["x", "x", "x", "6", "9", "x", "x", "10", "14", "7", "3", "12"], ["x", "11", "x", "3", "14", "16", "17", "1", "4", "14", "8", "16"], ["3", "x", "x", "x", "6", "1", "18", "16", "x", "6", "3", "11"], ["x", "x", "11", "4", "8", "x", "x", "1", "3", "9", "8", "7"], ["x", "x", "3", "x", "x", "x", "8", "14", "18", "x", "x", "18"], ["4", "1", "x", "x", "x", "14", "x", "x", "x", "3", "4", "20"], ["1", "x", "x", "x", "14", "19", "15", "x", "x", "3", "16", "15"], ["x", "x", "6", "18", "x", "x", "16", "1", "x", "3", "x", "11"], ["x", "3", "x", "15", "x", "19", "10", "x", "x", "x", "x", "x"], ["x", "9", "x", "x", "x", "x", "17", "17", "x", "16", "x", "13"], ["x", "x", "8", "x", "x", "1", "x", "x", "x", "19", "19", "1"], ["x", "3", "9", "x", "x", "x", "x", "1", "x", "10", "11", "8"]]]
[[["x", "x", "x", "6", "9", "x", "x", "10", "14", "7", "3", "12"], ["x", "11", "x", "3", "14", "16", "17", "1", "4", "14", "8", "16"], ["3", "x", "x", "x", "6", "1", "18", "16", "x", "6", "3", "11"], ["x", "x", "11", "4", "8", "x", "x", "1", "3", "9", "8", "7"], ["x", "x", "3", "x", "x", "x", "8", "14", "18", "x", "x", "18"], ["4", "1", "x", "x", "x", "14", "x", "x", "x", "3", "4", "20"], ["1", "x", "x", "x", "14", "19", "15", "x", "x", "3", "16", "15"], ["x", "x", "6", "18", "x", "x", "16", "1", "x", "3", "x", "11"], ["x", "3", "x", "15", "x", "19", "10", "x", "x", "x", "x", "x"], ["x", "9", "x", "x", "x", "x", "17", "17", "x", "16", "x", "13"], ["x", "x", "8", "x", "x", "1", "x", "x", "x", "19", "19", "1"], ["x", "3", "9", "x", "x", "x", "x", "1", "x", "10", "11", "8"]], [1, 3], [6, 10], 1, 5]
["[['x', 'x', 'x', '6', '9', 'x', 'x', '10', '14', '7', '3', '12'], ['x', '11', 'x', '3', '14', '16', '17', '1', '4', '14', '8', '16'], ['3', 'x', 'x', 'x', '6', '1', '18', '16', 'x', '6', '3', '11'], ['x', 'x', '11', '4', '8', 'x', 'x', '1', '3', '9', '8', '7'], ['x', 'x', '3', 'x', 'x', 'x', '8', '14', '18', 'x', 'x', '18'], ['4', '1', 'x', 'x', 'x', '14', 'x', 'x', 'x', '3', '4', '20'], ['1', 'x', 'x', 'x', '14', '19', '15', 'x', 'x', '3', '16', '15'], ['x', 'x', '6', '18', 'x', 'x', '16', '1', 'x', '3', 'x', '11'], ['x', '3', 'x', '15', 'x', '19', '10', 'x', 'x', 'x', 'x', 'x'], ['x', '9', 'x', 'x', 'x', 'x', '17', '17', 'x', '16', 'x', '13'], ['x', 'x', '8', 'x', 'x', '1', 'x', 'x', 'x', '19', '19', '1'], ['x', '3', '9', 'x', 'x', 'x', 'x', '1', 'x', '10', '11', '8']]", "(1, 3)", "(6, 10)", "1", "5"]
58
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (1, 1) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (10, 8). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 0 0 1 1 1 1 1 1 1 1 1 0 0 1 0 0 1 1 1 0 1 1 1 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 0 1 1 0 1 0 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 1, 0, 0, 0, 1, 0, 1], [1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1], [0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0]]", [1, 1], [10, 8], 4]
["[[0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1], [0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0], [1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1], [1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1], [0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0]]", "(1, 1)", "(10, 8)", "4"]
58
Given 5 labeled water jugs with capacities 59, 20, 21, 62, 61, 60 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 149, 156, 173, 186 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
[["+", 62, 4], ["+", 62, 4], ["+", 62, 4], ["+", 59, 3], ["+", 59, 3], ["-", 21, 3], ["+", 59, 3], ["-", 62, 3], ["+", 20, 3], ["+", 59, 3], ["+", 59, 2], ["+", 59, 2], ["-", 21, 2], ["+", 59, 2], ["+", 20, 1], ["+", 61, 1], ["+", 62, 1], ["-", 59, 1], ["+", 62, 1], ["-", 59, 1], ["+", 62, 1]]
21
0.03367137908935547
21
48
3
[[59, 20, 21, 62, 61, 60], [149, 156, 173, 186]]
[[59, 20, 21, 62, 61, 60], [149, 156, 173, 186]]
["[59, 20, 21, 62, 61, 60]", "[149, 156, 173, 186]"]
59
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: [[10, 96, 60, '_'], [98, 73, 14, 58], [53, 3, 21, 67]]
8_puzzle
puzzle
7
[58, 67, 21, 3, 53, 98, 10, 96, 73, 14, 60, 58, 67, 21, 3, 53, 14, 10, 98, 14, 10, 60, 58, 73, 96, 98, 60, 58, 53, 3]
30
0.15825581550598145
30
4
12
[[[10, 96, 60, "_"], [98, 73, 14, 58], [53, 3, 21, 67]]]
[[[10, 96, 60, "_"], [98, 73, 14, 58], [53, 3, 21, 67]]]
["[[10, 96, 60, '_'], [98, 73, 14, 58], [53, 3, 21, 67]]"]
59
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: fae, trah, feat, fine, daff The initial board: [['r', 'f', '_', 'e'], ['t', 'a', 'a', 'f'], ['a', 'e', 'f', 't'], ['f', 'i', 'n', 'h'], ['d', 'a', 'e', 'f']]
8_puzzle_words
puzzle
2
["down-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "down-right", "down-right", "down-left", "up-left", "up-left", "up-right", "up-right", "down-right", "down-left", "up-left", "up-left"]
18
0.20941829681396484
18
4
20
[[["r", "f", "_", "e"], ["t", "a", "a", "f"], ["a", "e", "f", "t"], ["f", "i", "n", "h"], ["d", "a", "e", "f"]]]
[[["r", "f", "_", "e"], ["t", "a", "a", "f"], ["a", "e", "f", "t"], ["f", "i", "n", "h"], ["d", "a", "e", "f"]], ["fae", "trah", "feat", "fine", "daff"]]
["[['r', 'f', '_', 'e'], ['t', 'a', 'a', 'f'], ['a', 'e', 'f', 't'], ['f', 'i', 'n', 'h'], ['d', 'a', 'e', 'f']]", "['fae', 'trah', 'feat', 'fine', 'daff']"]
59
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 'K'. Our task is to visit city L 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 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. D Y F M W H Q B K S V I L D 0 0 1 0 0 0 0 0 0 1 0 1 0 Y 1 0 0 1 0 0 1 1 0 0 0 0 0 F 0 0 0 1 0 0 0 0 1 0 0 1 0 M 0 0 0 0 0 0 0 0 1 1 0 1 1 W 0 0 1 0 0 0 0 0 0 0 0 0 1 H 0 0 1 0 1 0 0 1 0 0 0 0 1 Q 1 0 0 1 0 1 0 1 0 0 1 0 0 B 0 0 1 0 1 1 0 0 0 0 0 0 0 K 0 0 0 0 0 1 0 1 0 0 1 0 0 S 0 1 1 0 1 0 0 1 0 0 0 0 0 V 0 0 0 0 0 0 0 1 0 1 0 1 0 I 0 1 0 0 1 1 1 0 0 0 0 0 0 L 0 0 1 0 0 0 0 0 1 1 1 0 0
city_directed_graph
pathfinding
13
["K", "H", "L", "F", "M", "L", "S", "Y", "D", "I", "Q", "D"]
12
0.11734938621520996
12
13
16
[[[0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0]], ["D", "Y", "F", "M", "W", "H", "Q", "B", "K", "S", "V", "I", "L"], "L", "D"]
[[[0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0]], ["D", "Y", "F", "M", "W", "H", "Q", "B", "K", "S", "V", "I", "L"], "K", "L", "D"]
["[[0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0]]", "['D', 'Y', 'F', 'M', 'W', 'H', 'Q', 'B', 'K', 'S', 'V', 'I', 'L']", "['K']", "['L', 'D']"]
59
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [23, 27, 20, 21, 8, 2, 2, 3, 21, 26, 16, 33, 22, 3, 25, 17, 5, 31, 3, 9, 12, 30, 11, 10, 7, 13, 2, 21, 8, 16, 5, 18, 32, 27, 7, 32, 7, 10, 11, 33, 18, 30, 7, 24, 21, 4, 25, 4, 23, 21, 23, 15, 26, 10], such that the sum of the chosen coins adds up to 334. 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 {16: 1, 18: 1, 9: 1, 11: 5, 5: 3, 2: 1, 21: 1, 33: 3, 7: 1, 4: 1, 30: 8, 23: 10, 17: 8, 15: 7, 13: 6, 20: 8, 32: 4, 10: 6, 3: 1, 12: 7, 27: 6, 31: 5, 22: 1, 26: 20, 24: 5, 8: 4, 25: 9}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
31
[9, 21, 21, 21, 21, 18, 21, 18, 16, 33, 32, 22, 33, 32, 16]
25
0.05468130111694336
15
54
54
[[23, 27, 20, 21, 8, 2, 2, 3, 21, 26, 16, 33, 22, 3, 25, 17, 5, 31, 3, 9, 12, 30, 11, 10, 7, 13, 2, 21, 8, 16, 5, 18, 32, 27, 7, 32, 7, 10, 11, 33, 18, 30, 7, 24, 21, 4, 25, 4, 23, 21, 23, 15, 26, 10]]
[[23, 27, 20, 21, 8, 2, 2, 3, 21, 26, 16, 33, 22, 3, 25, 17, 5, 31, 3, 9, 12, 30, 11, 10, 7, 13, 2, 21, 8, 16, 5, 18, 32, 27, 7, 32, 7, 10, 11, 33, 18, 30, 7, 24, 21, 4, 25, 4, 23, 21, 23, 15, 26, 10], {"16": 1, "18": 1, "9": 1, "11": 5, "5": 3, "2": 1, "21": 1, "33": 3, "7": 1, "4": 1, "30": 8, "23": 10, "17": 8, "15": 7, "13": 6, "20": 8, "32": 4, "10": 6, "3": 1, "12": 7, "27": 6, "31": 5, "22": 1, "26": 20, "24": 5, "8": 4, "25": 9}, 334]
["[23, 27, 20, 21, 8, 2, 2, 3, 21, 26, 16, 33, 22, 3, 25, 17, 5, 31, 3, 9, 12, 30, 11, 10, 7, 13, 2, 21, 8, 16, 5, 18, 32, 27, 7, 32, 7, 10, 11, 33, 18, 30, 7, 24, 21, 4, 25, 4, 23, 21, 23, 15, 26, 10]", "{16: 1, 18: 1, 9: 1, 11: 5, 5: 3, 2: 1, 21: 1, 33: 3, 7: 1, 4: 1, 30: 8, 23: 10, 17: 8, 15: 7, 13: 6, 20: 8, 32: 4, 10: 6, 3: 1, 12: 7, 27: 6, 31: 5, 22: 1, 26: 20, 24: 5, 8: 4, 25: 9}", "334"]
59
The game of 'Sort It' begins with 3 tubes, each filled with 5 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 8 balls. It is not allowed to place a ball in a tube that already has 8 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Red', 'Red', 'Blue', 'Red'], ['Green', 'Blue', 'Blue', 'Red', 'Green'], ['Blue', 'Green', 'Red', 'Green', 'Green']]
color_sorting
sorting
9
[[0, 1], [2, 1], [0, 2], [0, 2], [0, 1], [0, 2], [1, 0], [1, 0], [1, 0], [1, 2], [1, 0], [1, 0], [2, 0], [1, 2], [1, 0], [2, 1], [2, 1], [2, 1], [2, 1], [2, 0], [2, 1], [0, 2], [0, 2], [0, 2]]
24
45.59880995750427
24
6
15
[[["Blue", "Red", "Red", "Blue", "Red"], ["Green", "Blue", "Blue", "Red", "Green"], ["Blue", "Green", "Red", "Green", "Green"]], 8]
[[["Blue", "Red", "Red", "Blue", "Red"], ["Green", "Blue", "Blue", "Red", "Green"], ["Blue", "Green", "Red", "Green", "Green"]], 8]
["[['Blue', 'Red', 'Red', 'Blue', 'Red'], ['Green', 'Blue', 'Blue', 'Red', 'Green'], ['Blue', 'Green', 'Red', 'Green', 'Green']]", "8"]
59
We have a 4x4 numerical grid, with numbers ranging from 19 to 59 (19 included in the range but 59 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' 'x' '38' 'x'] ['x' '30' 'x' 'x'] ['20' 'x' '44' 'x'] ['x' '22' 'x' '57']]
consecutive_grid
underdetermined_system
14
[[0, 0, 24], [0, 1, 25], [0, 2, 26], [0, 3, 27], [1, 1, 38], [1, 3, 52], [2, 0, 39], [2, 2, 50], [2, 3, 53], [3, 1, 45]]
468
132.53104043006897
10
40
16
["[['', '', '', ''], ['37', '', '49', ''], ['', '44', '', ''], ['42', '', '51', '61']]", 24, 64]
["[['', '', '', ''], ['37', '', '49', ''], ['', '44', '', ''], ['42', '', '51', '61']]", 24, 64]
["[['', '', '', ''], ['37', '', '49', ''], ['', '44', '', ''], ['42', '', '51', '61']]", "24", "64"]
59
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 22 to 53. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 148, 157, None for columns 1 to 2 respectively, and the sums of rows must be None, 138, 149, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 133. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['35' 'x' '51' 'x'] ['x' 'x' 'x' '23'] ['x' '32' '31' '52'] ['x' 'x' 'x' 'x']]
magic_square
underdetermined_system
7
[[0, 1, 28], [0, 3, 25], [1, 0, 24], [1, 1, 42], [1, 2, 49], [2, 0, 34], [3, 0, 27], [3, 1, 46], [3, 2, 26], [3, 3, 22]]
547
42.003302574157715
10
26
16
["[['35', '', '51', ''], ['', '', '', '23'], ['', '32', '31', '52'], ['', '', '', '']]", 4, 22, 53]
["[['35', '', '51', ''], ['', '', '', '23'], ['', '32', '31', '52'], ['', '', '', '']]", 22, 53, [1, 3], [1, 3], [148, 157], [138, 149], 133]
["[['35', '', '51', ''], ['', '', '', '23'], ['', '32', '31', '52'], ['', '', '', '']]", "22", "53", "[None, 148, 157, None]", "[None, 138, 149, None]", "133"]
59
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: 5, 2: 5, 3: 4, 4: 8, 5: 6, 6: 8, 7: 9}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Green', 'Blue', 'Green', 'Yellow', 'Yellow'], [], ['Red', 'Red', 'Green', 'Black', 'Black'], [], ['Blue', 'Yellow', 'Black', 'Yellow', 'Blue'], [], [], ['Black', 'Blue', 'Red', 'Red', 'Green']]
restricted_sorting
sorting
2
[[0, 5], [0, 3], [0, 5], [2, 1], [2, 1], [2, 5], [7, 2], [7, 3], [7, 1], [7, 1], [7, 5], [4, 3], [4, 0], [4, 2], [4, 0], [4, 3]]
72
6.510378360748291
16
56
20
[[["Green", "Blue", "Green", "Yellow", "Yellow"], [], ["Red", "Red", "Green", "Black", "Black"], [], ["Blue", "Yellow", "Black", "Yellow", "Blue"], [], [], ["Black", "Blue", "Red", "Red", "Green"]], 5, {"0": 1, "1": 5, "2": 5, "3": 4, "4": 8, "5": 6, "6": 8, "7": 9}]
[[["Green", "Blue", "Green", "Yellow", "Yellow"], [], ["Red", "Red", "Green", "Black", "Black"], [], ["Blue", "Yellow", "Black", "Yellow", "Blue"], [], [], ["Black", "Blue", "Red", "Red", "Green"]], 5, {"0": 1, "1": 5, "2": 5, "3": 4, "4": 8, "5": 6, "6": 8, "7": 9}, 4]
["[['Green', 'Blue', 'Green', 'Yellow', 'Yellow'], [], ['Red', 'Red', 'Green', 'Black', 'Black'], [], ['Blue', 'Yellow', 'Black', 'Yellow', 'Blue'], [], [], ['Black', 'Blue', 'Red', 'Red', 'Green']]", "{0: 1, 1: 5, 2: 5, 3: 4, 4: 8, 5: 6, 6: 8, 7: 9}", "5", "4"]
59
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (2, 0) to his destination workshop at index (7, 8), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 6, and district 3 covering rows 7 to 11. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [4 1 20 15 9 x 8 6 x x 14 x] [5 11 9 12 10 4 15 18 7 x x 13] [15 9 1 x 18 3 1 19 x x 17 17] [x 17 11 10 x 19 8 x x x x 7] [5 x 1 x 14 13 4 8 5 x 13 14] [16 6 x x x 17 x 15 4 x x 15] [x x x 15 x 19 10 x 16 18 11 1] [6 8 x 3 x 5 5 x 3 8 9 14] [10 14 x x x x x x 6 2 x x] [12 x x 6 11 4 x x 12 x 4 16] [4 x x x 11 x x x 18 16 x 10] [x 6 x x 11 x 5 13 8 1 17 9]
traffic
pathfinding
4
[[2, 0], [2, 1], [2, 2], [1, 2], [1, 3], [1, 4], [1, 5], [2, 5], [2, 6], [3, 6], [4, 6], [4, 7], [4, 8], [5, 8], [6, 8], [7, 8]]
97
0.027582406997680664
16
4
4
[[["4", "1", "20", "15", "9", "x", "8", "6", "x", "x", "14", "x"], ["5", "11", "9", "12", "10", "4", "15", "18", "7", "x", "x", "13"], ["15", "9", "1", "x", "18", "3", "1", "19", "x", "x", "17", "17"], ["x", "17", "11", "10", "x", "19", "8", "x", "x", "x", "x", "7"], ["5", "x", "1", "x", "14", "13", "4", "8", "5", "x", "13", "14"], ["16", "6", "x", "x", "x", "17", "x", "15", "4", "x", "x", "15"], ["x", "x", "x", "15", "x", "19", "10", "x", "16", "18", "11", "1"], ["6", "8", "x", "3", "x", "5", "5", "x", "3", "8", "9", "14"], ["10", "14", "x", "x", "x", "x", "x", "x", "6", "2", "x", "x"], ["12", "x", "x", "6", "11", "4", "x", "x", "12", "x", "4", "16"], ["4", "x", "x", "x", "11", "x", "x", "x", "18", "16", "x", "10"], ["x", "6", "x", "x", "11", "x", "5", "13", "8", "1", "17", "9"]]]
[[["4", "1", "20", "15", "9", "x", "8", "6", "x", "x", "14", "x"], ["5", "11", "9", "12", "10", "4", "15", "18", "7", "x", "x", "13"], ["15", "9", "1", "x", "18", "3", "1", "19", "x", "x", "17", "17"], ["x", "17", "11", "10", "x", "19", "8", "x", "x", "x", "x", "7"], ["5", "x", "1", "x", "14", "13", "4", "8", "5", "x", "13", "14"], ["16", "6", "x", "x", "x", "17", "x", "15", "4", "x", "x", "15"], ["x", "x", "x", "15", "x", "19", "10", "x", "16", "18", "11", "1"], ["6", "8", "x", "3", "x", "5", "5", "x", "3", "8", "9", "14"], ["10", "14", "x", "x", "x", "x", "x", "x", "6", "2", "x", "x"], ["12", "x", "x", "6", "11", "4", "x", "x", "12", "x", "4", "16"], ["4", "x", "x", "x", "11", "x", "x", "x", "18", "16", "x", "10"], ["x", "6", "x", "x", "11", "x", "5", "13", "8", "1", "17", "9"]], [2, 0], [7, 8], 1, 6]
["[['4', '1', '20', '15', '9', 'x', '8', '6', 'x', 'x', '14', 'x'], ['5', '11', '9', '12', '10', '4', '15', '18', '7', 'x', 'x', '13'], ['15', '9', '1', 'x', '18', '3', '1', '19', 'x', 'x', '17', '17'], ['x', '17', '11', '10', 'x', '19', '8', 'x', 'x', 'x', 'x', '7'], ['5', 'x', '1', 'x', '14', '13', '4', '8', '5', 'x', '13', '14'], ['16', '6', 'x', 'x', 'x', '17', 'x', '15', '4', 'x', 'x', '15'], ['x', 'x', 'x', '15', 'x', '19', '10', 'x', '16', '18', '11', '1'], ['6', '8', 'x', '3', 'x', '5', '5', 'x', '3', '8', '9', '14'], ['10', '14', 'x', 'x', 'x', 'x', 'x', 'x', '6', '2', 'x', 'x'], ['12', 'x', 'x', '6', '11', '4', 'x', 'x', '12', 'x', '4', '16'], ['4', 'x', 'x', 'x', '11', 'x', 'x', 'x', '18', '16', 'x', '10'], ['x', '6', 'x', 'x', '11', 'x', '5', '13', '8', '1', '17', '9']]", "(2, 0)", "(7, 8)", "1", "6"]
59
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (0, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (11, 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 0 0 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1 0 1 1 0 1 1 1 1 0 0 1 0 0 1 1 1 0 0 1 1 0 0 0 1 1 0 1 1 0 1 0 0 0 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 1 1 0 1 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 0 0 0 1 1 1 0 1 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 1
trampoline_matrix
pathfinding
12
[[0, 9], [1, 8], [1, 7], [1, 6], [2, 6], [3, 6], [3, 5], [4, 4], [4, 3], [4, 2], [5, 2], [5, 1], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 1], [11, 2]]
19
0.03089118003845215
19
8
2
["[[1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1], [1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0], [1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1], [0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]]", 4]
["[[1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1], [1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0], [1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1], [0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]]", [0, 9], [11, 2], 4]
["[[1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1], [1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0], [1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1], [0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]]", "(0, 9)", "(11, 2)", "4"]
59
Given 5 labeled water jugs with capacities 128, 67, 44, 31, 127, 15 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 258, 261, 415, 430 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
[["+", 31, 4], ["+", 128, 4], ["+", 128, 4], ["+", 128, 4], ["+", 15, 4], ["+", 31, 3], ["+", 128, 3], ["+", 128, 3], ["+", 128, 3], ["+", 67, 2], ["+", 67, 2], ["+", 127, 2], ["+", 128, 1], ["+", 128, 1], ["-", 44, 1], ["+", 15, 1], ["+", 31, 1]]
17
0.06383585929870605
17
48
3
[[128, 67, 44, 31, 127, 15], [258, 261, 415, 430]]
[[128, 67, 44, 31, 127, 15], [258, 261, 415, 430]]
["[128, 67, 44, 31, 127, 15]", "[258, 261, 415, 430]"]
60
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: [[31, 92, 67, 69], [87, 35, 42, 72], [53, '_', 28, 19]]
8_puzzle
puzzle
7
[28, 42, 72, 69, 67, 72, 35, 87, 31, 92, 72, 67, 69, 35, 67, 72, 87, 67, 42, 28, 53, 31, 67, 53, 28, 19]
26
0.2203352451324463
26
4
12
[[[31, 92, 67, 69], [87, 35, 42, 72], [53, "_", 28, 19]]]
[[[31, 92, 67, 69], [87, 35, 42, 72], [53, "_", 28, 19]]]
["[[31, 92, 67, 69], [87, 35, 42, 72], [53, '_', 28, 19]]"]
60
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: ban, zeed, dazy, mote, maun The initial board: [['e', 'b', 'a', 'n'], ['z', 'e', 'e', 'd'], ['o', 'a', 'd', 'y'], ['m', 'u', 't', 'z'], ['m', 'a', '_', 'n']]
8_puzzle_words
puzzle
2
["up-left", "up-left", "up-right", "down-right", "down-right", "down-left", "up-left", "up-left", "up-right", "down-right", "down-left", "down-right", "up-right", "up-left", "up-left", "up-left"]
16
0.18634486198425293
16
4
20
[[["e", "b", "a", "n"], ["z", "e", "e", "d"], ["o", "a", "d", "y"], ["m", "u", "t", "z"], ["m", "a", "_", "n"]]]
[[["e", "b", "a", "n"], ["z", "e", "e", "d"], ["o", "a", "d", "y"], ["m", "u", "t", "z"], ["m", "a", "_", "n"]], ["ban", "zeed", "dazy", "mote", "maun"]]
["[['e', 'b', 'a', 'n'], ['z', 'e', 'e', 'd'], ['o', 'a', 'd', 'y'], ['m', 'u', 't', 'z'], ['m', 'a', '_', 'n']]", "['ban', 'zeed', 'dazy', 'mote', 'maun']"]
60
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'I'. Our task is to visit city F and city U excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from U and F, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. H T R F L U Q G N E Y I X H 0 0 0 0 0 0 1 0 1 1 0 0 0 T 0 0 0 0 1 0 0 0 1 0 0 0 0 R 1 0 0 0 1 0 0 1 0 0 0 0 1 F 0 1 1 0 0 0 1 0 0 0 0 0 0 L 0 0 0 1 0 0 0 0 0 0 1 0 1 U 0 0 0 0 0 0 0 1 0 0 1 0 1 Q 0 0 0 1 0 0 0 0 0 1 1 0 0 G 1 1 0 1 1 0 0 0 0 1 0 0 0 N 0 1 0 0 1 1 0 1 0 0 0 0 0 E 0 0 1 1 0 0 0 1 0 0 0 0 0 Y 0 0 1 0 0 0 1 1 0 0 0 0 0 I 1 0 0 0 0 0 0 0 0 0 0 0 0 X 0 0 0 0 1 1 1 0 0 0 0 1 0
city_directed_graph
pathfinding
13
["I", "H", "N", "U", "X", "U", "G", "F", "Q", "F"]
10
0.046558380126953125
10
13
16
[[[0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1], [0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0], [1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0]], ["H", "T", "R", "F", "L", "U", "Q", "G", "N", "E", "Y", "I", "X"], "F", "U"]
[[[0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0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 'E', 'Y', 'I', 'X']", "['I']", "['F', 'U']"]
60
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [28, 2, 4, 7, 11, 26, 14, 8, 23, 29, 18, 13, 26, 21, 10, 26, 8, 33, 9, 15, 4, 21, 19, 3, 7, 10, 4, 7, 16, 16, 11, 33, 12, 23, 5, 3, 26, 7, 17, 30, 22, 22, 6, 16, 18, 25, 26, 11, 13, 23, 17, 11, 20, 12], such that the sum of the chosen coins adds up to 339. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {10: 6, 18: 17, 33: 15, 16: 16, 3: 2, 30: 18, 13: 3, 21: 17, 23: 4, 12: 1, 7: 6, 17: 7, 4: 2, 6: 5, 2: 2, 11: 5, 14: 14, 29: 1, 20: 7, 8: 3, 15: 7, 28: 3, 26: 8, 19: 11, 9: 9, 22: 4, 5: 5, 25: 5}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
32
[28, 12, 23, 12, 13, 23, 22, 8, 23, 22, 25, 29, 26, 20, 8, 13, 15, 17]
72
0.06408143043518066
18
54
54
[[28, 2, 4, 7, 11, 26, 14, 8, 23, 29, 18, 13, 26, 21, 10, 26, 8, 33, 9, 15, 4, 21, 19, 3, 7, 10, 4, 7, 16, 16, 11, 33, 12, 23, 5, 3, 26, 7, 17, 30, 22, 22, 6, 16, 18, 25, 26, 11, 13, 23, 17, 11, 20, 12]]
[[28, 2, 4, 7, 11, 26, 14, 8, 23, 29, 18, 13, 26, 21, 10, 26, 8, 33, 9, 15, 4, 21, 19, 3, 7, 10, 4, 7, 16, 16, 11, 33, 12, 23, 5, 3, 26, 7, 17, 30, 22, 22, 6, 16, 18, 25, 26, 11, 13, 23, 17, 11, 20, 12], {"10": 6, "18": 17, "33": 15, "16": 16, "3": 2, "30": 18, "13": 3, "21": 17, "23": 4, "12": 1, "7": 6, "17": 7, "4": 2, "6": 5, "2": 2, "11": 5, "14": 14, "29": 1, "20": 7, "8": 3, "15": 7, "28": 3, "26": 8, "19": 11, "9": 9, "22": 4, "5": 5, "25": 5}, 339]
["[28, 2, 4, 7, 11, 26, 14, 8, 23, 29, 18, 13, 26, 21, 10, 26, 8, 33, 9, 15, 4, 21, 19, 3, 7, 10, 4, 7, 16, 16, 11, 33, 12, 23, 5, 3, 26, 7, 17, 30, 22, 22, 6, 16, 18, 25, 26, 11, 13, 23, 17, 11, 20, 12]", "{10: 6, 18: 17, 33: 15, 16: 16, 3: 2, 30: 18, 13: 3, 21: 17, 23: 4, 12: 1, 7: 6, 17: 7, 4: 2, 6: 5, 2: 2, 11: 5, 14: 14, 29: 1, 20: 7, 8: 3, 15: 7, 28: 3, 26: 8, 19: 11, 9: 9, 22: 4, 5: 5, 25: 5}", "339"]
60
The game of 'Sort It' begins with 3 tubes, each filled with 5 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 8 balls. It is not allowed to place a ball in a tube that already has 8 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Green', 'Red', 'Blue', 'Blue', 'Green'], ['Red', 'Green', 'Blue', 'Red', 'Green'], ['Blue', 'Red', 'Blue', 'Green', 'Red']]
color_sorting
sorting
9
[[1, 0], [2, 1], [2, 0], [2, 1], [2, 1], [0, 2], [0, 2], [0, 1], [0, 2], [1, 2], [1, 2], [0, 1], [0, 1], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [1, 2], [1, 0], [1, 0], [2, 1], [2, 1], [2, 1], [2, 1], [0, 2]]
26
132.6773865222931
26
6
15
[[["Green", "Red", "Blue", "Blue", "Green"], ["Red", "Green", "Blue", "Red", "Green"], ["Blue", "Red", "Blue", "Green", "Red"]], 8]
[[["Green", "Red", "Blue", "Blue", "Green"], ["Red", "Green", "Blue", "Red", "Green"], ["Blue", "Red", "Blue", "Green", "Red"]], 8]
["[['Green', 'Red', 'Blue', 'Blue', 'Green'], ['Red', 'Green', 'Blue', 'Red', 'Green'], ['Blue', 'Red', 'Blue', 'Green', 'Red']]", "8"]
60
We have a 4x4 numerical grid, with numbers ranging from 24 to 64 (24 included in the range but 64 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' 'x' 'x' 'x'] ['37' 'x' '49' 'x'] ['x' '44' 'x' 'x'] ['42' 'x' '51' '61']]
consecutive_grid
underdetermined_system
14
[[0, 0, 36], [0, 1, 37], [0, 3, 47], [1, 0, 38], [2, 1, 58], [3, 2, 76]]
678
0.18999671936035156
6
40
16
["[['', '', '46', ''], ['', '57', '59', '70'], ['56', '', '69', '73'], ['57', '75', '', '80']]", 36, 81]
["[['', '', '46', ''], ['', '57', '59', '70'], ['56', '', '69', '73'], ['57', '75', '', '80']]", 36, 81]
["[['', '', '46', ''], ['', '57', '59', '70'], ['56', '', '69', '73'], ['57', '75', '', '80']]", "36", "81"]
60
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 23 to 54. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 173, 166, None for columns 1 to 2 respectively, and the sums of rows must be None, 166, 165, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 131. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['45' '53' 'x' 'x'] ['x' 'x' 'x' 'x'] ['47' 'x' 'x' 'x'] ['35' 'x' '52' 'x']]
magic_square
underdetermined_system
7
[[0, 2, 26], [0, 3, 23], [1, 0, 30], [1, 1, 50], [1, 2, 37], [1, 3, 49], [2, 1, 36], [2, 2, 51], [2, 3, 31], [3, 1, 34], [3, 3, 24]]
623
225.59702444076538
11
26
16
["[['45', '53', '', ''], ['', '', '', ''], ['47', '', '', ''], ['35', '', '52', '']]", 4, 23, 54]
["[['45', '53', '', ''], ['', '', '', ''], ['47', '', '', ''], ['35', '', '52', '']]", 23, 54, [1, 3], [1, 3], [173, 166], [166, 165], 131]
["[['45', '53', '', ''], ['', '', '', ''], ['47', '', '', ''], ['35', '', '52', '']]", "23", "54", "[None, 173, 166, None]", "[None, 166, 165, None]", "131"]
60
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: 1, 2: 8, 3: 8, 4: 1, 5: 6, 6: 4, 7: 1}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Yellow', 'Green', 'Green', 'Black', 'Black'], [], ['Yellow', 'Green', 'Black', 'Green', 'Red'], ['Red', 'Black', 'Blue', 'Blue', 'Yellow'], [], [], ['Red', 'Blue', 'Yellow', 'Blue', 'Red'], []]
restricted_sorting
sorting
2
[[0, 1], [0, 5], [0, 5], [2, 1], [2, 5], [2, 0], [2, 5], [3, 4], [3, 0], [3, 7], [3, 7], [6, 4], [6, 7], [6, 1], [6, 7], [2, 4], [3, 1], [6, 4]]
48
7.157405853271484
18
56
20
[[["Yellow", "Green", "Green", "Black", "Black"], [], ["Yellow", "Green", "Black", "Green", "Red"], ["Red", "Black", "Blue", "Blue", "Yellow"], [], [], ["Red", "Blue", "Yellow", "Blue", "Red"], []], 5, {"0": 6, "1": 1, "2": 8, "3": 8, "4": 1, "5": 6, "6": 4, "7": 1}]
[[["Yellow", "Green", "Green", "Black", "Black"], [], ["Yellow", "Green", "Black", "Green", "Red"], ["Red", "Black", "Blue", "Blue", "Yellow"], [], [], ["Red", "Blue", "Yellow", "Blue", "Red"], []], 5, {"0": 6, "1": 1, "2": 8, "3": 8, "4": 1, "5": 6, "6": 4, "7": 1}, 4]
["[['Yellow', 'Green', 'Green', 'Black', 'Black'], [], ['Yellow', 'Green', 'Black', 'Green', 'Red'], ['Red', 'Black', 'Blue', 'Blue', 'Yellow'], [], [], ['Red', 'Blue', 'Yellow', 'Blue', 'Red'], []]", "{0: 6, 1: 1, 2: 8, 3: 8, 4: 1, 5: 6, 6: 4, 7: 1}", "5", "4"]
60
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 0) to his destination workshop at index (9, 7), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 8, and district 3 covering rows 9 to 11. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [16 x 5 6 x 14 12 x x x 6 x] [17 x x x 5 x 5 7 x x 8 x] [3 19 x x x x 18 x 13 7 x x] [13 x 4 x x 8 7 4 x 15 x x] [5 17 18 12 3 x 14 2 4 18 x 1] [4 10 1 19 10 x x 17 x 17 16 4] [7 x 16 x x 1 3 x 13 13 x x] [x x 9 1 7 18 16 3 x 4 x x] [2 x 13 10 x 4 x x x x x 12] [x x x 18 8 4 x 11 x 14 18 x] [x 19 2 x 2 6 5 18 x 5 x x] [x 2 x 7 x x 8 7 x 11 16 x]
traffic
pathfinding
4
[[3, 0], [4, 0], [5, 0], [5, 1], [5, 2], [6, 2], [7, 2], [7, 3], [7, 4], [7, 5], [8, 5], [9, 5], [10, 5], [10, 6], [10, 7], [9, 7]]
119
0.021150827407836914
16
4
4
[[["16", "x", "5", "6", "x", "14", "12", "x", "x", "x", "6", "x"], ["17", "x", "x", "x", "5", "x", "5", "7", "x", "x", "8", "x"], ["3", "19", "x", "x", "x", "x", "18", "x", "13", "7", "x", "x"], ["13", "x", "4", "x", "x", "8", "7", "4", "x", "15", "x", "x"], ["5", "17", "18", "12", "3", "x", "14", "2", "4", "18", "x", "1"], ["4", "10", "1", "19", "10", "x", "x", "17", "x", "17", "16", "4"], ["7", "x", "16", "x", "x", "1", "3", "x", "13", "13", "x", "x"], ["x", "x", "9", "1", "7", "18", "16", "3", "x", "4", "x", "x"], ["2", "x", "13", "10", "x", "4", "x", "x", "x", "x", "x", "12"], ["x", "x", "x", "18", "8", "4", "x", "11", "x", "14", "18", "x"], ["x", "19", "2", "x", "2", "6", "5", "18", "x", "5", "x", "x"], ["x", "2", "x", "7", "x", "x", "8", "7", "x", "11", "16", "x"]]]
[[["16", "x", "5", "6", "x", "14", "12", "x", "x", "x", "6", "x"], ["17", "x", "x", "x", "5", "x", "5", "7", "x", "x", "8", "x"], ["3", "19", "x", "x", "x", "x", "18", "x", "13", "7", "x", "x"], ["13", "x", "4", "x", "x", "8", "7", "4", "x", "15", "x", "x"], ["5", "17", "18", "12", "3", "x", "14", "2", "4", "18", "x", "1"], ["4", "10", "1", "19", "10", "x", "x", "17", "x", "17", "16", "4"], ["7", "x", "16", "x", "x", "1", "3", "x", "13", "13", "x", "x"], ["x", "x", "9", "1", "7", "18", "16", "3", "x", "4", "x", "x"], ["2", "x", "13", "10", "x", "4", "x", "x", "x", "x", "x", "12"], ["x", "x", "x", "18", "8", "4", "x", "11", "x", "14", "18", "x"], ["x", "19", "2", "x", "2", "6", "5", "18", "x", "5", "x", "x"], ["x", "2", "x", "7", "x", "x", "8", "7", "x", "11", "16", "x"]], [3, 0], [9, 7], 3, 8]
["[['16', 'x', '5', '6', 'x', '14', '12', 'x', 'x', 'x', '6', 'x'], ['17', 'x', 'x', 'x', '5', 'x', '5', '7', 'x', 'x', '8', 'x'], ['3', '19', 'x', 'x', 'x', 'x', '18', 'x', '13', '7', 'x', 'x'], ['13', 'x', '4', 'x', 'x', '8', '7', '4', 'x', '15', 'x', 'x'], ['5', '17', '18', '12', '3', 'x', '14', '2', '4', '18', 'x', '1'], ['4', '10', '1', '19', '10', 'x', 'x', '17', 'x', '17', '16', '4'], ['7', 'x', '16', 'x', 'x', '1', '3', 'x', '13', '13', 'x', 'x'], ['x', 'x', '9', '1', '7', '18', '16', '3', 'x', '4', 'x', 'x'], ['2', 'x', '13', '10', 'x', '4', 'x', 'x', 'x', 'x', 'x', '12'], ['x', 'x', 'x', '18', '8', '4', 'x', '11', 'x', '14', '18', 'x'], ['x', '19', '2', 'x', '2', '6', '5', '18', 'x', '5', 'x', 'x'], ['x', '2', 'x', '7', 'x', 'x', '8', '7', 'x', '11', '16', 'x']]", "(3, 0)", "(9, 7)", "3", "8"]
60
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 12x12. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (1, 0) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (11, 7). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 0 1 1 0 1 1 1 0 1 1 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 1 0 0 1 0 1 1 1 0 1 0 1 0 1 0 1 1 0 0 0 0 1 0 1 0 0 0 1 1 1 0 1 1 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 0 0 0 1 0 1 1 1 1 1 1 0 0 0 0 1 0 0 1 1 1 0 0 0 1 0 0 0 0 1 0 1 1 1 0 1 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 0 0 0 1 1 1 1
trampoline_matrix
pathfinding
12
[[1, 0], [2, 1], [3, 1], [3, 2], [4, 2], [5, 2], [6, 2], [6, 3], [7, 3], [7, 4], [8, 4], [9, 5], [10, 6], [11, 7]]
14
0.02705216407775879
14
8
2
["[[0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0], [0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0], [1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1], [0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1], [0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1], [1,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 1, 1, 1]]", "(1, 0)", "(11, 7)", "4"]
60
Given 5 labeled water jugs with capacities 78, 68, 49, 82, 77, 88 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 176, 189, 251, 285 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
[["+", 77, 4], ["+", 77, 4], ["+", 49, 4], ["+", 82, 4], ["+", 68, 3], ["+", 68, 3], ["+", 82, 3], ["-", 49, 3], ["+", 82, 3], ["+", 68, 2], ["+", 82, 2], ["-", 49, 2], ["+", 88, 2], ["+", 88, 1], ["+", 88, 1]]
15
0.06066584587097168
15
48
3
[[78, 68, 49, 82, 77, 88], [176, 189, 251, 285]]
[[78, 68, 49, 82, 77, 88], [176, 189, 251, 285]]
["[78, 68, 49, 82, 77, 88]", "[176, 189, 251, 285]"]
61
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[93, 83, 50, 21, 67], [59, '_', 60, 19, 8], [14, 12, 92, 54, 9]]
8_puzzle
puzzle
4
[12, 92, 54, 9, 8, 19, 60, 12, 92, 54, 12, 50, 83, 92, 54, 12, 9, 8, 19, 60, 21, 67, 60, 19]
24
0.06862807273864746
24
4
15
[[[93, 83, 50, 21, 67], [59, "_", 60, 19, 8], [14, 12, 92, 54, 9]]]
[[[93, 83, 50, 21, 67], [59, "_", 60, 19, 8], [14, 12, 92, 54, 9]]]
["[[93, 83, 50, 21, 67], [59, '_', 60, 19, 8], [14, 12, 92, 54, 9]]"]
61
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: aer, hume, mimp, viva, fiji The initial board: [['u', 'a', '_', 'r'], ['h', 'e', 'm', 'e'], ['m', 'i', 'i', 'p'], ['v', 'a', 'v', 'j'], ['f', 'i', 'm', 'i']]
8_puzzle_words
puzzle
2
["down-left", "down-right", "down-left", "down-right", "up-right", "up-left", "up-left", "down-left", "down-right", "up-right", "up-left", "up-left"]
12
0.19978690147399902
12
4
20
[[["u", "a", "_", "r"], ["h", "e", "m", "e"], ["m", "i", "i", "p"], ["v", "a", "v", "j"], ["f", "i", "m", "i"]]]
[[["u", "a", "_", "r"], ["h", "e", "m", "e"], ["m", "i", "i", "p"], ["v", "a", "v", "j"], ["f", "i", "m", "i"]], ["aer", "hume", "mimp", "viva", "fiji"]]
["[['u', 'a', '_', 'r'], ['h', 'e', 'm', 'e'], ['m', 'i', 'i', 'p'], ['v', 'a', 'v', 'j'], ['f', 'i', 'm', 'i']]", "['aer', 'hume', 'mimp', 'viva', 'fiji']"]
61
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 Z and city M excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from M and Z, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. J U X R L Z O F Q C N V M J 0 0 0 0 0 0 0 0 0 0 1 0 0 U 0 0 0 1 1 1 0 0 0 0 0 0 1 X 1 1 0 0 0 0 0 0 0 0 1 1 1 R 0 0 0 0 0 0 0 0 1 1 0 0 0 L 0 0 0 1 0 1 1 0 0 0 0 0 0 Z 0 0 0 0 0 0 1 1 0 0 0 0 1 O 0 0 1 0 0 1 0 0 0 0 0 0 0 F 0 1 0 0 0 0 0 0 1 0 0 1 0 Q 0 1 1 0 1 0 1 0 0 0 0 1 0 C 0 0 0 0 0 1 0 1 1 0 0 0 1 N 0 1 0 1 1 1 1 0 0 0 0 1 0 V 1 1 0 0 1 1 0 0 1 0 0 0 1 M 0 0 0 1 0 0 0 1 0 0 0 0 0
city_directed_graph
pathfinding
13
["J", "N", "Z", "M", "F", "U", "Z", "M"]
8
0.040180206298828125
8
13
16
[[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1], [0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0], [1, 1, 0, 0, 1, 1, 0, 0, 1, 0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0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1], [0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0], [1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0]]", "['J', 'U', 'X', 'R', 'L', 'Z', 'O', 'F', 'Q', 'C', 'N', 'V', 'M']", "['J']", "['Z', 'M']"]
61
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [30, 4, 10, 25, 2, 20, 23, 22, 29, 13, 21, 23, 23, 24, 3, 26, 29, 27, 15, 18, 28, 10, 22, 24, 2, 22, 13, 32, 8, 28, 31, 13, 27, 6, 35, 2, 20, 25, 24, 2, 16, 31, 3, 5, 23, 32, 24, 20, 13, 7, 11, 12], such that the sum of the chosen coins adds up to 351. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {10: 8, 32: 8, 25: 5, 7: 2, 30: 9, 18: 3, 5: 2, 35: 14, 2: 1, 15: 10, 12: 6, 29: 14, 23: 12, 31: 14, 11: 3, 8: 7, 21: 5, 13: 3, 28: 3, 6: 1, 3: 2, 4: 2, 22: 5, 16: 9, 24: 4, 27: 16, 26: 6, 20: 20}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
33
[28, 24, 18, 21, 25, 24, 25, 24, 6, 13, 13, 13, 35, 28, 26, 24, 4]
72
0.058156728744506836
17
52
52
[[30, 4, 10, 25, 2, 20, 23, 22, 29, 13, 21, 23, 23, 24, 3, 26, 29, 27, 15, 18, 28, 10, 22, 24, 2, 22, 13, 32, 8, 28, 31, 13, 27, 6, 35, 2, 20, 25, 24, 2, 16, 31, 3, 5, 23, 32, 24, 20, 13, 7, 11, 12]]
[[30, 4, 10, 25, 2, 20, 23, 22, 29, 13, 21, 23, 23, 24, 3, 26, 29, 27, 15, 18, 28, 10, 22, 24, 2, 22, 13, 32, 8, 28, 31, 13, 27, 6, 35, 2, 20, 25, 24, 2, 16, 31, 3, 5, 23, 32, 24, 20, 13, 7, 11, 12], {"10": 8, "32": 8, "25": 5, "7": 2, "30": 9, "18": 3, "5": 2, "35": 14, "2": 1, "15": 10, "12": 6, "29": 14, "23": 12, "31": 14, "11": 3, "8": 7, "21": 5, "13": 3, "28": 3, "6": 1, "3": 2, "4": 2, "22": 5, "16": 9, "24": 4, "27": 16, "26": 6, "20": 20}, 351]
["[30, 4, 10, 25, 2, 20, 23, 22, 29, 13, 21, 23, 23, 24, 3, 26, 29, 27, 15, 18, 28, 10, 22, 24, 2, 22, 13, 32, 8, 28, 31, 13, 27, 6, 35, 2, 20, 25, 24, 2, 16, 31, 3, 5, 23, 32, 24, 20, 13, 7, 11, 12]", "{10: 8, 32: 8, 25: 5, 7: 2, 30: 9, 18: 3, 5: 2, 35: 14, 2: 1, 15: 10, 12: 6, 29: 14, 23: 12, 31: 14, 11: 3, 8: 7, 21: 5, 13: 3, 28: 3, 6: 1, 3: 2, 4: 2, 22: 5, 16: 9, 24: 4, 27: 16, 26: 6, 20: 20}", "351"]
61
The game of 'Sort It' begins with 3 tubes, each filled with 5 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 8 balls. It is not allowed to place a ball in a tube that already has 8 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Green', 'Green', 'Red', 'Blue'], ['Red', 'Blue', 'Green', 'Red', 'Green'], ['Green', 'Blue', 'Blue', 'Blue', 'Red']]
color_sorting
sorting
9
[[1, 0], [1, 0], [1, 2], [1, 0], [2, 1], [2, 1], [2, 1], [2, 1], [2, 1], [0, 2], [0, 1], [0, 2], [0, 2], [0, 2], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [2, 0], [2, 1], [2, 1], [0, 2]]
24
50.06358861923218
24
6
15
[[["Red", "Green", "Green", "Red", "Blue"], ["Red", "Blue", "Green", "Red", "Green"], ["Green", "Blue", "Blue", "Blue", "Red"]], 8]
[[["Red", "Green", "Green", "Red", "Blue"], ["Red", "Blue", "Green", "Red", "Green"], ["Green", "Blue", "Blue", "Blue", "Red"]], 8]
["[['Red', 'Green', 'Green', 'Red', 'Blue'], ['Red', 'Blue', 'Green', 'Red', 'Green'], ['Green', 'Blue', 'Blue', 'Blue', 'Red']]", "8"]
61
We have a 4x4 numerical grid, with numbers ranging from 36 to 81 (36 included in the range but 81 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' 'x' '46' 'x'] ['x' '57' '59' '70'] ['56' 'x' '69' '73'] ['57' '75' 'x' '80']]
consecutive_grid
underdetermined_system
11
[[0, 2, 71], [0, 3, 76], [1, 2, 68], [2, 2, 65], [2, 3, 67], [3, 1, 49]]
796
0.5532352924346924
6
45
16
["[['69', '70', '', ''], ['64', '66', '', '75'], ['62', '64', '', ''], ['60', '', '48', '46']]", 41, 86]
["[['69', '70', '', ''], ['64', '66', '', '75'], ['62', '64', '', ''], ['60', '', '48', '46']]", 41, 86]
["[['69', '70', '', ''], ['64', '66', '', '75'], ['62', '64', '', ''], ['60', '', '48', '46']]", "41", "86"]
61
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 23 to 54. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 135, 149, None for columns 1 to 2 respectively, and the sums of rows must be None, 156, 156, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 149. 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' '31' 'x' 'x'] ['x' 'x' 'x' 'x'] ['x' 'x' '42' 'x'] ['x' '49' '30' '27']]
magic_square
underdetermined_system
8
[[0, 0, 25], [0, 2, 24], [0, 3, 26], [1, 0, 28], [1, 1, 23], [1, 2, 53], [1, 3, 52], [2, 0, 34], [2, 1, 32], [2, 3, 48], [3, 0, 38]]
562
323.3269555568695
11
26
16
["[['', '31', '', ''], ['', '', '', ''], ['', '', '42', ''], ['', '49', '30', '27']]", 4, 23, 54]
["[['', '31', '', ''], ['', '', '', ''], ['', '', '42', ''], ['', '49', '30', '27']]", 23, 54, [1, 3], [1, 3], [135, 149], [156, 156], 149]
["[['', '31', '', ''], ['', '', '', ''], ['', '', '42', ''], ['', '49', '30', '27']]", "23", "54", "[None, 135, 149, None]", "[None, 156, 156, None]", "149"]
61
In 'Restricted Sorting', there are 10 stacks each with a capacity of 6 blocks, with 5 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 5 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: 11, 2: 8, 3: 10, 4: 5, 5: 6, 6: 10, 7: 10, 8: 4, 9: 11}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], [], ['Green', 'Red', 'White', 'Green', 'Black', 'White'], [], ['Red', 'Red', 'Yellow', 'White', 'Blue', 'Black'], ['Blue', 'Yellow', 'Red', 'Blue', 'Blue', 'Green'], [], [], ['Black', 'White', 'Black', 'White', 'Yellow', 'Blue'], ['Yellow', 'Black', 'Green', 'Red', 'Green', 'Yellow']]
restricted_sorting
sorting
3
[[2, 0], [2, 3], [8, 6], [9, 7], [9, 6], [9, 0], [9, 3], [9, 0], [4, 3], [4, 3], [4, 7], [4, 1], [9, 7], [4, 9], [4, 6], [2, 4], [2, 0], [2, 6], [2, 4], [8, 4], [8, 2], [8, 4], [8, 7], [5, 8], [5, 7], [5, 3], [5, 8], [5, 8], [2, 6], [5, 0], [1, 4], [9, 8]]
256
0.2655496597290039
32
90
30
[[[], [], ["Green", "Red", "White", "Green", "Black", "White"], [], ["Red", "Red", "Yellow", "White", "Blue", "Black"], ["Blue", "Yellow", "Red", "Blue", "Blue", "Green"], [], [], ["Black", "White", "Black", "White", "Yellow", "Blue"], ["Yellow", "Black", "Green", "Red", "Green", "Yellow"]], 6, {"0": 7, "1": 11, "2": 8, "3": 10, "4": 5, "5": 6, "6": 10, "7": 10, "8": 4, "9": 11}]
[[[], [], ["Green", "Red", "White", "Green", "Black", "White"], [], ["Red", "Red", "Yellow", "White", "Blue", "Black"], ["Blue", "Yellow", "Red", "Blue", "Blue", "Green"], [], [], ["Black", "White", "Black", "White", "Yellow", "Blue"], ["Yellow", "Black", "Green", "Red", "Green", "Yellow"]], 6, {"0": 7, "1": 11, "2": 8, "3": 10, "4": 5, "5": 6, "6": 10, "7": 10, "8": 4, "9": 11}, 5]
["[[], [], ['Green', 'Red', 'White', 'Green', 'Black', 'White'], [], ['Red', 'Red', 'Yellow', 'White', 'Blue', 'Black'], ['Blue', 'Yellow', 'Red', 'Blue', 'Blue', 'Green'], [], [], ['Black', 'White', 'Black', 'White', 'Yellow', 'Blue'], ['Yellow', 'Black', 'Green', 'Red', 'Green', 'Yellow']]", "{0: 7, 1: 11, 2: 8, 3: 10, 4: 5, 5: 6, 6: 10, 7: 10, 8: 4, 9: 11}", "6", "5"]
61
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, 12) to his destination workshop at index (6, 2), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 5, and district 3 covering rows 6 to 12. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [13 13 16 8 x 19 1 18 13 8 x 7 x] [x 13 x 15 x 12 20 1 13 19 4 17 x] [x 12 9 11 13 12 2 12 19 5 19 16 8] [x 12 18 19 x 7 x 12 3 2 x 16 11] [x 7 x x 8 13 15 3 1 x 15 15 x] [11 9 x 16 2 10 1 2 16 1 x 10 12] [x x 9 9 7 x 6 x x 10 7 2 x] [x 13 10 8 1 11 x x x x x x x] [11 14 x x x x 4 8 x x 18 x x] [13 14 x 10 x x 16 x x x x x x] [x x 16 x 10 x 17 x 12 x 10 x 5] [9 x 10 x 19 16 x 14 16 12 15 7 x] [1 x 8 10 14 x 6 9 x x 8 11 11]
traffic
pathfinding
5
[[3, 12], [2, 12], [2, 11], [1, 11], [1, 10], [1, 9], [2, 9], [3, 9], [3, 8], [4, 8], [4, 7], [5, 7], [5, 6], [5, 5], [5, 4], [6, 4], [6, 3], [6, 2]]
118
0.02977895736694336
18
4
4
[[["13", "13", "16", "8", "x", "19", "1", "18", "13", "8", "x", "7", "x"], ["x", "13", "x", "15", "x", "12", "20", "1", "13", "19", "4", "17", "x"], ["x", "12", "9", "11", "13", "12", "2", "12", "19", "5", "19", "16", "8"], ["x", "12", "18", "19", "x", "7", "x", "12", "3", "2", "x", "16", "11"], ["x", "7", "x", "x", "8", "13", "15", "3", "1", "x", "15", "15", "x"], ["11", "9", "x", "16", "2", "10", "1", "2", "16", "1", "x", "10", "12"], ["x", "x", "9", "9", "7", "x", "6", "x", "x", "10", "7", "2", "x"], ["x", "13", "10", "8", "1", "11", "x", "x", "x", "x", "x", "x", "x"], ["11", "14", "x", "x", "x", "x", "4", "8", "x", "x", "18", "x", "x"], ["13", "14", "x", "10", "x", "x", "16", "x", "x", "x", "x", "x", "x"], ["x", "x", "16", "x", "10", "x", "17", "x", "12", "x", "10", "x", "5"], ["9", "x", "10", "x", "19", "16", "x", "14", "16", "12", "15", "7", "x"], ["1", "x", "8", "10", "14", "x", "6", "9", "x", "x", "8", "11", "11"]]]
[[["13", "13", "16", "8", "x", "19", "1", "18", "13", "8", "x", "7", "x"], ["x", "13", "x", "15", "x", "12", "20", "1", "13", "19", "4", "17", "x"], ["x", "12", "9", "11", "13", "12", "2", "12", "19", "5", "19", "16", "8"], ["x", "12", "18", "19", "x", "7", "x", "12", "3", "2", "x", "16", "11"], ["x", "7", "x", "x", "8", "13", "15", "3", "1", "x", "15", "15", "x"], ["11", "9", "x", "16", "2", "10", "1", "2", "16", "1", "x", "10", "12"], ["x", "x", "9", "9", "7", "x", "6", "x", "x", "10", "7", "2", "x"], ["x", "13", "10", "8", "1", "11", "x", "x", "x", "x", "x", "x", "x"], ["11", "14", "x", "x", "x", "x", "4", "8", "x", "x", "18", "x", "x"], ["13", "14", "x", "10", "x", "x", "16", "x", "x", "x", "x", "x", "x"], ["x", "x", "16", "x", "10", "x", "17", "x", "12", "x", "10", "x", "5"], ["9", "x", "10", "x", "19", "16", "x", "14", "16", "12", "15", "7", "x"], ["1", "x", "8", "10", "14", "x", "6", "9", "x", "x", "8", "11", "11"]], [3, 12], [6, 2], 1, 5]
["[['13', '13', '16', '8', 'x', '19', '1', '18', '13', '8', 'x', '7', 'x'], ['x', '13', 'x', '15', 'x', '12', '20', '1', '13', '19', '4', '17', 'x'], ['x', '12', '9', '11', '13', '12', '2', '12', '19', '5', '19', '16', '8'], ['x', '12', '18', '19', 'x', '7', 'x', '12', '3', '2', 'x', '16', '11'], ['x', '7', 'x', 'x', '8', '13', '15', '3', '1', 'x', '15', '15', 'x'], ['11', '9', 'x', '16', '2', '10', '1', '2', '16', '1', 'x', '10', '12'], ['x', 'x', '9', '9', '7', 'x', '6', 'x', 'x', '10', '7', '2', 'x'], ['x', '13', '10', '8', '1', '11', 'x', 'x', 'x', 'x', 'x', 'x', 'x'], ['11', '14', 'x', 'x', 'x', 'x', '4', '8', 'x', 'x', '18', 'x', 'x'], ['13', '14', 'x', '10', 'x', 'x', '16', 'x', 'x', 'x', 'x', 'x', 'x'], ['x', 'x', '16', 'x', '10', 'x', '17', 'x', '12', 'x', '10', 'x', '5'], ['9', 'x', '10', 'x', '19', '16', 'x', '14', '16', '12', '15', '7', 'x'], ['1', 'x', '8', '10', '14', 'x', '6', '9', 'x', 'x', '8', '11', '11']]", "(3, 12)", "(6, 2)", "1", "5"]
61
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 13x13. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (0, 11) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (7, 1). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 1 1 0 1 0 0 1 0 0 0 0 0 1 1 0 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 1 0 0 1 1 0 1 0 0 0 1 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 0 1 1 1 0 1 0 1 0 1 0 0 0 0 0 1 0 1 1 0 0 0 1 1 1 0 1 0 1 0 1 0 0 0 0 0 0 1 0 0 1 0 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 1 1 1 0 0 1 1 0 0 1 0 1 1 1 1 1 0 1 1 1
trampoline_matrix
pathfinding
13
[[0, 11], [0, 10], [1, 10], [2, 9], [3, 9], [4, 8], [4, 7], [4, 6], [4, 5], [4, 4], [5, 3], [6, 2], [6, 1], [7, 1]]
14
0.03135824203491211
14
8
2
["[[1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1], [0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0], [1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1], [1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1], [0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 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1, 1, 1, 1, 0, 1, 1, 1]]", "(0, 11)", "(7, 1)", "4"]
61
Given 5 labeled water jugs with capacities 56, 92, 66, 85, 65, 136 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 209, 293, 326, 379 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
[["+", 66, 4], ["+", 85, 4], ["+", 92, 4], ["+", 136, 4], ["+", 85, 3], ["+", 85, 3], ["+", 136, 3], ["-", 65, 3], ["+", 85, 3], ["+", 65, 2], ["+", 92, 2], ["+", 136, 2], ["+", 66, 1], ["+", 92, 1], ["-", 85, 1], ["+", 136, 1]]
16
0.05174422264099121
16
48
3
[[56, 92, 66, 85, 65, 136], [209, 293, 326, 379]]
[[56, 92, 66, 85, 65, 136], [209, 293, 326, 379]]
["[56, 92, 66, 85, 65, 136]", "[209, 293, 326, 379]"]
62
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[87, 49, 79, 68, '_'], [56, 19, 64, 37, 7], [27, 15, 41, 35, 78]]
8_puzzle
puzzle
4
[68, 37, 7, 78, 35, 7, 78, 68, 37, 78, 64, 41, 15, 19, 49, 79, 78, 37, 68, 64, 37, 68, 64, 35]
24
0.16290855407714844
24
4
15
[[[87, 49, 79, 68, "_"], [56, 19, 64, 37, 7], [27, 15, 41, 35, 78]]]
[[[87, 49, 79, 68, "_"], [56, 19, 64, 37, 7], [27, 15, 41, 35, 78]]]
["[[87, 49, 79, 68, '_'], [56, 19, 64, 37, 7], [27, 15, 41, 35, 78]]"]
62
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: man, cute, dazy, down, oryx The initial board: [['u', 'm', 'a', 'n'], ['c', 'd', 't', 'e'], ['o', 'a', '_', 'y'], ['d', 'n', 'w', 'y'], ['o', 'r', 'z', 'x']]
8_puzzle_words
puzzle
2
["down-left", "down-right", "up-right", "up-left", "down-left", "up-left", "up-right", "up-left"]
8
0.20729756355285645
8
4
20
[[["u", "m", "a", "n"], ["c", "d", "t", "e"], ["o", "a", "_", "y"], ["d", "n", "w", "y"], ["o", "r", "z", "x"]]]
[[["u", "m", "a", "n"], ["c", "d", "t", "e"], ["o", "a", "_", "y"], ["d", "n", "w", "y"], ["o", "r", "z", "x"]], ["man", "cute", "dazy", "down", "oryx"]]
["[['u', 'm', 'a', 'n'], ['c', 'd', 't', 'e'], ['o', 'a', '_', 'y'], ['d', 'n', 'w', 'y'], ['o', 'r', 'z', 'x']]", "['man', 'cute', 'dazy', 'down', 'oryx']"]
62
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 'K'. Our task is to visit city U and city Y excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from Y and 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. Z C M X N A B L U K G Y O Z 0 0 0 1 1 0 1 1 1 1 0 0 0 C 1 0 1 1 0 1 0 0 0 0 0 1 1 M 0 0 0 0 1 1 1 0 0 0 0 1 0 X 0 0 1 0 0 0 0 1 0 0 1 0 1 N 1 1 0 0 0 0 1 0 0 0 0 0 0 A 1 0 1 0 0 0 1 0 0 0 0 0 0 B 0 1 0 0 0 0 0 1 0 1 0 1 0 L 0 0 0 0 0 0 0 0 1 0 1 0 0 U 1 0 1 0 0 0 0 0 0 1 0 0 1 K 0 0 0 1 1 1 0 0 0 0 0 0 0 G 1 0 0 1 1 1 1 1 0 0 0 1 0 Y 0 0 0 0 1 0 1 0 0 0 0 0 0 O 1 1 0 0 0 0 1 0 1 0 0 1 0
city_directed_graph
pathfinding
13
["K", "A", "Z", "U", "O", "U", "M", "Y", "B", "Y"]
10
0.049027204513549805
10
13
16
[[[0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0], [1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 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 1], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0]]", "['Z', 'C', 'M', 'X', 'N', 'A', 'B', 'L', 'U', 'K', 'G', 'Y', 'O']", "['K']", "['U', 'Y']"]
62
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [35, 14, 9, 23, 25, 24, 21, 20, 12, 17, 12, 5, 2, 17, 25, 25, 26, 31, 7, 21, 10, 2, 27, 19, 32, 29, 11, 33, 3, 27, 17, 3, 18, 14, 2, 32, 14, 21, 12, 8, 3, 34, 13, 12, 2, 23, 13, 3, 3, 31, 23, 23, 6, 30, 30, 11, 21], such that the sum of the chosen coins adds up to 356. 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 {3: 1, 32: 16, 6: 5, 20: 13, 13: 5, 31: 9, 23: 10, 35: 14, 24: 17, 11: 11, 9: 1, 12: 10, 5: 3, 8: 5, 34: 11, 17: 16, 25: 9, 26: 6, 30: 17, 27: 17, 7: 2, 18: 17, 33: 5, 14: 2, 29: 14, 10: 3, 2: 2, 21: 12, 19: 9}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
34
[7, 9, 33, 14, 31, 26, 14, 31, 14, 25, 25, 25, 35, 34, 10, 23]
103
0.07300186157226562
16
57
57
[[35, 14, 9, 23, 25, 24, 21, 20, 12, 17, 12, 5, 2, 17, 25, 25, 26, 31, 7, 21, 10, 2, 27, 19, 32, 29, 11, 33, 3, 27, 17, 3, 18, 14, 2, 32, 14, 21, 12, 8, 3, 34, 13, 12, 2, 23, 13, 3, 3, 31, 23, 23, 6, 30, 30, 11, 21]]
[[35, 14, 9, 23, 25, 24, 21, 20, 12, 17, 12, 5, 2, 17, 25, 25, 26, 31, 7, 21, 10, 2, 27, 19, 32, 29, 11, 33, 3, 27, 17, 3, 18, 14, 2, 32, 14, 21, 12, 8, 3, 34, 13, 12, 2, 23, 13, 3, 3, 31, 23, 23, 6, 30, 30, 11, 21], {"3": 1, "32": 16, "6": 5, "20": 13, "13": 5, "31": 9, "23": 10, "35": 14, "24": 17, "11": 11, "9": 1, "12": 10, "5": 3, "8": 5, "34": 11, "17": 16, "25": 9, "26": 6, "30": 17, "27": 17, "7": 2, "18": 17, "33": 5, "14": 2, "29": 14, "10": 3, "2": 2, "21": 12, "19": 9}, 356]
["[35, 14, 9, 23, 25, 24, 21, 20, 12, 17, 12, 5, 2, 17, 25, 25, 26, 31, 7, 21, 10, 2, 27, 19, 32, 29, 11, 33, 3, 27, 17, 3, 18, 14, 2, 32, 14, 21, 12, 8, 3, 34, 13, 12, 2, 23, 13, 3, 3, 31, 23, 23, 6, 30, 30, 11, 21]", "{3: 1, 32: 16, 6: 5, 20: 13, 13: 5, 31: 9, 23: 10, 35: 14, 24: 17, 11: 11, 9: 1, 12: 10, 5: 3, 8: 5, 34: 11, 17: 16, 25: 9, 26: 6, 30: 17, 27: 17, 7: 2, 18: 17, 33: 5, 14: 2, 29: 14, 10: 3, 2: 2, 21: 12, 19: 9}", "356"]
62
The game of 'Sort It' begins with 3 tubes, each filled with 5 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 8 balls. It is not allowed to place a ball in a tube that already has 8 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Green', 'Green', 'Blue', 'Green'], ['Red', 'Blue', 'Green', 'Blue', 'Green'], ['Red', 'Blue', 'Red', 'Red', 'Red']]
color_sorting
sorting
9
[[2, 1], [2, 0], [1, 2], [1, 2], [1, 0], [1, 2], [1, 0], [1, 2], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 2], [1, 0], [1, 0], [2, 1], [2, 0], [2, 0]]
20
7.412998199462891
20
6
15
[[["Blue", "Green", "Green", "Blue", "Green"], ["Red", "Blue", "Green", "Blue", "Green"], ["Red", "Blue", "Red", "Red", "Red"]], 8]
[[["Blue", "Green", "Green", "Blue", "Green"], ["Red", "Blue", "Green", "Blue", "Green"], ["Red", "Blue", "Red", "Red", "Red"]], 8]
["[['Blue', 'Green', 'Green', 'Blue', 'Green'], ['Red', 'Blue', 'Green', 'Blue', 'Green'], ['Red', 'Blue', 'Red', 'Red', 'Red']]", "8"]
62
We have a 4x4 numerical grid, with numbers ranging from 41 to 86 (41 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 > fourth or first < second < third < fourth in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['69' '70' 'x' 'x'] ['64' '66' 'x' '75'] ['62' '64' 'x' 'x'] ['60' 'x' '48' '46']]
consecutive_grid
underdetermined_system
11
[[0, 2, 38], [1, 2, 53], [2, 0, 45], [3, 0, 46], [3, 1, 54], [3, 3, 66]]
629
24.031245946884155
6
45
16
["[['33', '37', '', '58'], ['44', '51', '', '63'], ['', '52', '62', '64'], ['', '', '65', '']]", 33, 78]
["[['33', '37', '', '58'], ['44', '51', '', '63'], ['', '52', '62', '64'], ['', '', '65', '']]", 33, 78]
["[['33', '37', '', '58'], ['44', '51', '', '63'], ['', '52', '62', '64'], ['', '', '65', '']]", "33", "78"]
62
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 30 to 66. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 199, 194, None for columns 1 to 2 respectively, and the sums of rows must be None, 164, 210, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 197. 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'] ['40' '39' '32' '53'] ['46' 'x' '58' 'x'] ['x' 'x' '43' '51']]
magic_square
underdetermined_system
8
[[0, 0, 30], [0, 1, 31], [0, 2, 61], [0, 3, 37], [2, 1, 65], [2, 3, 41], [3, 0, 63], [3, 1, 64]]
754
73.30463027954102
8
26
16
["[['', '', '', ''], ['40', '39', '32', '53'], ['46', '', '58', ''], ['', '', '43', '51']]", 4, 30, 66]
["[['', '', '', ''], ['40', '39', '32', '53'], ['46', '', '58', ''], ['', '', '43', '51']]", 30, 66, [1, 3], [1, 3], [199, 194], [164, 210], 197]
["[['', '', '', ''], ['40', '39', '32', '53'], ['46', '', '58', ''], ['', '', '43', '51']]", "30", "66", "[None, 199, 194, None]", "[None, 164, 210, None]", "197"]
62
In 'Restricted Sorting', there are 10 stacks each with a capacity of 6 blocks, with 5 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 5 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: 10, 2: 8, 3: 3, 4: 5, 5: 7, 6: 10, 7: 6, 8: 3, 9: 8}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], [], ['Blue', 'Yellow', 'Red', 'Black', 'White', 'Blue'], ['Blue', 'Green', 'Yellow', 'Red', 'Red', 'White'], [], ['Red', 'Black', 'White', 'Yellow', 'White', 'Green'], [], ['Black', 'Yellow', 'Green', 'Black', 'Black', 'Blue'], [], ['Red', 'Green', 'Green', 'Blue', 'Yellow', 'White']]
restricted_sorting
sorting
3
[[5, 8], [9, 8], [3, 4], [3, 0], [9, 0], [9, 0], [9, 4], [3, 1], [3, 8], [3, 8], [5, 6], [9, 1], [2, 4], [9, 3], [2, 9], [2, 8], [5, 3], [5, 9], [5, 3], [5, 0], [2, 5], [2, 3], [7, 5], [7, 9], [7, 0], [7, 5], [7, 5], [1, 9], [1, 9], [6, 5], [2, 4], [7, 4]]
187
0.27761077880859375
32
90
30
[[[], [], ["Blue", "Yellow", "Red", "Black", "White", "Blue"], ["Blue", "Green", "Yellow", "Red", "Red", "White"], [], ["Red", "Black", "White", "Yellow", "White", "Green"], [], ["Black", "Yellow", "Green", "Black", "Black", "Blue"], [], ["Red", "Green", "Green", "Blue", "Yellow", "White"]], 6, {"0": 6, "1": 10, "2": 8, "3": 3, "4": 5, "5": 7, "6": 10, "7": 6, "8": 3, "9": 8}]
[[[], [], ["Blue", "Yellow", "Red", "Black", "White", "Blue"], ["Blue", "Green", "Yellow", "Red", "Red", "White"], [], ["Red", "Black", "White", "Yellow", "White", "Green"], [], ["Black", "Yellow", "Green", "Black", "Black", "Blue"], [], ["Red", "Green", "Green", "Blue", "Yellow", "White"]], 6, {"0": 6, "1": 10, "2": 8, "3": 3, "4": 5, "5": 7, "6": 10, "7": 6, "8": 3, "9": 8}, 5]
["[[], [], ['Blue', 'Yellow', 'Red', 'Black', 'White', 'Blue'], ['Blue', 'Green', 'Yellow', 'Red', 'Red', 'White'], [], ['Red', 'Black', 'White', 'Yellow', 'White', 'Green'], [], ['Black', 'Yellow', 'Green', 'Black', 'Black', 'Blue'], [], ['Red', 'Green', 'Green', 'Blue', 'Yellow', 'White']]", "{0: 6, 1: 10, 2: 8, 3: 3, 4: 5, 5: 7, 6: 10, 7: 6, 8: 3, 9: 8}", "6", "5"]
62
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (8, 2) 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 7, and district 3 covering rows 8 to 12. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [5 15 15 5 6 19 x 9 2 x 16 x 15] [16 x x 7 5 x x x 5 2 19 x 3] [x 11 2 19 17 5 11 6 3 18 15 16 x] [2 x 12 x 20 11 7 19 2 x 4 14 x] [3 x 19 x 11 19 x 14 x 12 x 18 7] [6 x 5 8 3 12 12 11 5 14 x 6 x] [x x 13 2 x 20 x x x 18 18 x 3] [x x 13 1 10 18 x x x x 10 x 15] [10 x 9 2 17 19 16 8 x 18 10 x 13] [x x 2 8 2 7 x 17 x 1 x 9 x] [x 13 x 19 15 3 15 13 1 12 4 7 x] [14 x x x x x x 16 x 15 x x x] [3 15 x 6 x 9 x x 9 1 6 x 5]
traffic
pathfinding
5
[[8, 2], [8, 3], [7, 3], [6, 3], [5, 3], [5, 4], [4, 4], [4, 5], [3, 5], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9]]
100
0.019217967987060547
14
4
4
[[["5", "15", "15", "5", "6", "19", "x", "9", "2", "x", "16", "x", "15"], ["16", "x", "x", "7", "5", "x", "x", "x", "5", "2", "19", "x", "3"], ["x", "11", "2", "19", "17", "5", "11", "6", "3", "18", "15", "16", "x"], ["2", "x", "12", "x", "20", "11", "7", "19", "2", "x", "4", "14", "x"], ["3", "x", "19", "x", "11", "19", "x", "14", "x", "12", "x", "18", "7"], ["6", "x", "5", "8", "3", "12", "12", "11", "5", "14", "x", "6", "x"], ["x", "x", "13", "2", "x", "20", "x", "x", "x", "18", "18", "x", "3"], ["x", "x", "13", "1", "10", "18", "x", "x", "x", "x", "10", "x", "15"], ["10", "x", "9", "2", "17", "19", "16", "8", "x", "18", "10", "x", "13"], ["x", "x", "2", "8", "2", "7", "x", "17", "x", "1", "x", "9", "x"], ["x", "13", "x", "19", "15", "3", "15", "13", "1", "12", "4", "7", "x"], ["14", "x", "x", "x", "x", "x", "x", "16", "x", "15", "x", "x", "x"], ["3", "15", "x", "6", "x", "9", "x", "x", "9", "1", "6", "x", "5"]]]
[[["5", "15", "15", "5", "6", "19", "x", "9", "2", "x", "16", "x", "15"], ["16", "x", "x", "7", "5", "x", "x", "x", "5", "2", "19", "x", "3"], ["x", "11", "2", "19", "17", "5", "11", "6", "3", "18", "15", "16", "x"], ["2", "x", "12", "x", "20", "11", "7", "19", "2", "x", "4", "14", "x"], ["3", "x", "19", "x", "11", "19", "x", "14", "x", "12", "x", "18", "7"], ["6", "x", "5", "8", "3", "12", "12", "11", "5", "14", "x", "6", "x"], ["x", "x", "13", "2", "x", "20", "x", "x", "x", "18", "18", "x", "3"], ["x", "x", "13", "1", "10", "18", "x", "x", "x", "x", "10", "x", "15"], ["10", "x", "9", "2", "17", "19", "16", "8", "x", "18", "10", "x", "13"], ["x", "x", "2", "8", "2", "7", "x", "17", "x", "1", "x", "9", "x"], ["x", "13", "x", "19", "15", "3", "15", "13", "1", "12", "4", "7", "x"], ["14", "x", "x", "x", "x", "x", "x", "16", "x", "15", "x", "x", "x"], ["3", "15", "x", "6", "x", "9", "x", "x", "9", "1", "6", "x", "5"]], [8, 2], [2, 9], 2, 7]
["[['5', '15', '15', '5', '6', '19', 'x', '9', '2', 'x', '16', 'x', '15'], ['16', 'x', 'x', '7', '5', 'x', 'x', 'x', '5', '2', '19', 'x', '3'], ['x', '11', '2', '19', '17', '5', '11', '6', '3', '18', '15', '16', 'x'], ['2', 'x', '12', 'x', '20', '11', '7', '19', '2', 'x', '4', '14', 'x'], ['3', 'x', '19', 'x', '11', '19', 'x', '14', 'x', '12', 'x', '18', '7'], ['6', 'x', '5', '8', '3', '12', '12', '11', '5', '14', 'x', '6', 'x'], ['x', 'x', '13', '2', 'x', '20', 'x', 'x', 'x', '18', '18', 'x', '3'], ['x', 'x', '13', '1', '10', '18', 'x', 'x', 'x', 'x', '10', 'x', '15'], ['10', 'x', '9', '2', '17', '19', '16', '8', 'x', '18', '10', 'x', '13'], ['x', 'x', '2', '8', '2', '7', 'x', '17', 'x', '1', 'x', '9', 'x'], ['x', '13', 'x', '19', '15', '3', '15', '13', '1', '12', '4', '7', 'x'], ['14', 'x', 'x', 'x', 'x', 'x', 'x', '16', 'x', '15', 'x', 'x', 'x'], ['3', '15', 'x', '6', 'x', '9', 'x', 'x', '9', '1', '6', 'x', '5']]", "(8, 2)", "(2, 9)", "2", "7"]
62
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 13x13. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (11, 8) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (1, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 0 0 0 1 0 1 1 0 1 0 0 0 0 0 0 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 1 1 0 0 1 0 0 1 1 1 1 1 0 1 1 0 0 0 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 1 0 0 0 1 0 1 1 1 0 0 1 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 0 0 0 1 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 1 0 0 0 1 0 1 0 0 0 0
trampoline_matrix
pathfinding
13
[[11, 8], [10, 8], [9, 7], [9, 6], [9, 5], [8, 4], [7, 5], [6, 4], [5, 4], [5, 3], [5, 2], [4, 2], [3, 2], [3, 1], [2, 1], [1, 1], [1, 0]]
17
0.032764434814453125
17
8
2
["[[1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1], [1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1], [1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1], [0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1], [0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0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, 1, 0, 0, 1, 1, 0, 1], [0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0]]", "(11, 8)", "(1, 0)", "4"]
62
Given 5 labeled water jugs with capacities 54, 89, 26, 70, 71, 128 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 240, 242, 246, 329 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
[["+", 54, 4], ["+", 128, 4], ["+", 128, 4], ["-", 70, 4], ["+", 89, 4], ["+", 70, 3], ["+", 70, 3], ["+", 89, 3], ["-", 54, 3], ["+", 71, 3], ["+", 70, 2], ["+", 70, 2], ["-", 26, 2], ["+", 128, 2], ["+", 54, 1], ["+", 71, 1], ["+", 89, 1], ["+", 26, 1]]
18
0.041527748107910156
18
48
3
[[54, 89, 26, 70, 71, 128], [240, 242, 246, 329]]
[[54, 89, 26, 70, 71, 128], [240, 242, 246, 329]]
["[54, 89, 26, 70, 71, 128]", "[240, 242, 246, 329]"]
63
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: [[98, 80, 41, 91, 88], [75, 93, 24, '_', 12], [38, 37, 49, 65, 43]]
8_puzzle
puzzle
4
[65, 49, 24, 65, 91, 41, 80, 93, 65, 91, 49, 43, 12, 88, 41, 80, 91, 49, 88, 41, 80, 88, 43, 12]
24
0.1251230239868164
24
4
15
[[[98, 80, 41, 91, 88], [75, 93, 24, "_", 12], [38, 37, 49, 65, 43]]]
[[[98, 80, 41, 91, 88], [75, 93, 24, "_", 12], [38, 37, 49, 65, 43]]]
["[[98, 80, 41, 91, 88], [75, 93, 24, '_', 12], [38, 37, 49, 65, 43]]"]
63
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: liz, coos, enos, coze, gast The initial board: [['o', 'l', '_', 'z'], ['c', 'i', 'o', 's'], ['e', 'n', 'o', 's'], ['c', 'e', 'z', 'o'], ['g', 'a', 's', 't']]
8_puzzle_words
puzzle
2
["down-left", "down-left", "down-right", "up-right", "down-right", "down-left", "up-left", "up-left", "up-right", "down-right", "down-left", "down-right", "up-right", "up-left", "up-left", "up-left"]
16
0.22672724723815918
16
4
20
[[["o", "l", "_", "z"], ["c", "i", "o", "s"], ["e", "n", "o", "s"], ["c", "e", "z", "o"], ["g", "a", "s", "t"]]]
[[["o", "l", "_", "z"], ["c", "i", "o", "s"], ["e", "n", "o", "s"], ["c", "e", "z", "o"], ["g", "a", "s", "t"]], ["liz", "coos", "enos", "coze", "gast"]]
["[['o', 'l', '_', 'z'], ['c', 'i', 'o', 's'], ['e', 'n', 'o', 's'], ['c', 'e', 'z', 'o'], ['g', 'a', 's', 't']]", "['liz', 'coos', 'enos', 'coze', 'gast']"]
63
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'F'. Our task is to visit city N and city J 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 J 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. Z N R F O U P L J I S Q G Z 0 0 1 0 0 1 0 1 0 1 0 0 0 N 1 0 0 0 1 0 1 1 0 0 0 1 1 R 0 1 0 0 0 0 0 1 0 1 0 0 0 F 0 0 0 0 0 0 0 1 0 0 0 0 0 O 0 0 1 1 0 0 0 0 1 1 0 1 0 U 0 0 0 1 0 0 0 1 1 0 0 0 0 P 0 0 0 0 0 1 0 0 0 1 0 0 0 L 1 0 0 0 1 0 0 0 0 0 0 0 0 J 0 0 0 0 0 1 0 0 0 1 0 0 0 I 0 0 0 0 0 1 0 0 0 0 1 0 0 S 0 1 0 0 1 1 0 1 1 0 0 0 0 Q 0 0 0 0 0 1 1 0 0 0 0 0 1 G 0 0 0 0 1 0 0 1 0 0 0 0 0
city_directed_graph
pathfinding
13
["F", "L", "O", "J", "U", "J", "I", "S", "N", "Z", "R", "N"]
12
0.05983471870422363
12
13
16
[[[0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1], [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 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, 1, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0]]", "['Z', 'N', 'R', 'F', 'O', 'U', 'P', 'L', 'J', 'I', 'S', 'Q', 'G']", "['F']", "['N', 'J']"]
63
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [12, 12, 5, 32, 25, 3, 23, 49, 31, 6, 12, 23, 20, 14, 34, 17, 16, 16, 21, 18, 7, 30, 7, 27, 29, 14, 5, 9, 48, 33, 5, 18, 15, 29, 2, 28, 29, 25, 26, 6, 4, 4, 6, 8, 16, 5, 4, 4, 20, 25, 10, 6, 3, 24, 19], such that the sum of the chosen coins adds up to 348. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {20: 18, 16: 6, 19: 2, 27: 12, 25: 2, 6: 2, 26: 16, 23: 9, 28: 12, 49: 16, 33: 13, 30: 12, 8: 6, 21: 18, 31: 16, 48: 5, 15: 5, 10: 2, 3: 1, 29: 14, 32: 15, 5: 3, 4: 4, 34: 3, 17: 14, 12: 11, 7: 3, 9: 9, 14: 7, 24: 14, 18: 15, 2: 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
35
[48, 34, 2, 25, 25, 6, 25, 6, 49, 6, 15, 19, 16, 6, 23, 10, 33]
76
0.07342052459716797
17
55
55
[[12, 12, 5, 32, 25, 3, 23, 49, 31, 6, 12, 23, 20, 14, 34, 17, 16, 16, 21, 18, 7, 30, 7, 27, 29, 14, 5, 9, 48, 33, 5, 18, 15, 29, 2, 28, 29, 25, 26, 6, 4, 4, 6, 8, 16, 5, 4, 4, 20, 25, 10, 6, 3, 24, 19]]
[[12, 12, 5, 32, 25, 3, 23, 49, 31, 6, 12, 23, 20, 14, 34, 17, 16, 16, 21, 18, 7, 30, 7, 27, 29, 14, 5, 9, 48, 33, 5, 18, 15, 29, 2, 28, 29, 25, 26, 6, 4, 4, 6, 8, 16, 5, 4, 4, 20, 25, 10, 6, 3, 24, 19], {"20": 18, "16": 6, "19": 2, "27": 12, "25": 2, "6": 2, "26": 16, "23": 9, "28": 12, "49": 16, "33": 13, "30": 12, "8": 6, "21": 18, "31": 16, "48": 5, "15": 5, "10": 2, "3": 1, "29": 14, "32": 15, "5": 3, "4": 4, "34": 3, "17": 14, "12": 11, "7": 3, "9": 9, "14": 7, "24": 14, "18": 15, "2": 1}, 348]
["[12, 12, 5, 32, 25, 3, 23, 49, 31, 6, 12, 23, 20, 14, 34, 17, 16, 16, 21, 18, 7, 30, 7, 27, 29, 14, 5, 9, 48, 33, 5, 18, 15, 29, 2, 28, 29, 25, 26, 6, 4, 4, 6, 8, 16, 5, 4, 4, 20, 25, 10, 6, 3, 24, 19]", "{20: 18, 16: 6, 19: 2, 27: 12, 25: 2, 6: 2, 26: 16, 23: 9, 28: 12, 49: 16, 33: 13, 30: 12, 8: 6, 21: 18, 31: 16, 48: 5, 15: 5, 10: 2, 3: 1, 29: 14, 32: 15, 5: 3, 4: 4, 34: 3, 17: 14, 12: 11, 7: 3, 9: 9, 14: 7, 24: 14, 18: 15, 2: 1}", "348"]
63
The game of 'Sort It' begins with 3 tubes, each filled with 5 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 8 balls. It is not allowed to place a ball in a tube that already has 8 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Green', 'Blue', 'Red', 'Green'], ['Blue', 'Green', 'Green', 'Red', 'Blue'], ['Red', 'Blue', 'Red', 'Red', 'Green']]
color_sorting
sorting
9
[[1, 0], [2, 1], [2, 0], [2, 1], [2, 1], [2, 0], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [0, 2], [0, 1], [0, 1], [0, 1], [0, 2], [0, 1], [0, 1], [2, 0], [2, 0], [2, 1], [2, 0], [2, 0], [1, 2], [1, 2]]
26
131.11853456497192
26
6
15
[[["Blue", "Green", "Blue", "Red", "Green"], ["Blue", "Green", "Green", "Red", "Blue"], ["Red", "Blue", "Red", "Red", "Green"]], 8]
[[["Blue", "Green", "Blue", "Red", "Green"], ["Blue", "Green", "Green", "Red", "Blue"], ["Red", "Blue", "Red", "Red", "Green"]], 8]
["[['Blue', 'Green', 'Blue', 'Red', 'Green'], ['Blue', 'Green', 'Green', 'Red', 'Blue'], ['Red', 'Blue', 'Red', 'Red', 'Green']]", "8"]
63
We have a 4x4 numerical grid, with numbers ranging from 33 to 78 (33 included in the range but 78 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['33' '37' 'x' '58'] ['44' '51' 'x' '63'] ['x' '52' '62' '64'] ['x' 'x' '65' 'x']]
consecutive_grid
underdetermined_system
11
[[0, 0, 48], [0, 3, 75], [1, 1, 49], [2, 0, 42], [2, 2, 51], [2, 3, 55], [3, 2, 50]]
728
4.985894441604614
7
45
16
["[['', '73', '74', ''], ['46', '', '63', '72'], ['', '47', '', ''], ['41', '45', '', '54']]", 35, 80]
["[['', '73', '74', ''], ['46', '', '63', '72'], ['', '47', '', ''], ['41', '45', '', '54']]", 35, 80]
["[['', '73', '74', ''], ['46', '', '63', '72'], ['', '47', '', ''], ['41', '45', '', '54']]", "35", "80"]
63
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 30 to 66. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 207, 208, None for columns 1 to 2 respectively, and the sums of rows must be None, 173, 208, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 201. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['x' 'x' '63' 'x'] ['x' '44' 'x' '36'] ['50' 'x' 'x' '60'] ['x' '52' '38' '64']]
magic_square
underdetermined_system
8
[[0, 0, 30], [0, 1, 58], [0, 3, 32], [1, 0, 31], [1, 2, 62], [2, 1, 53], [2, 2, 45], [3, 0, 54]]
772
65.37240958213806
8
26
16
["[['', '', '63', ''], ['', '44', '', '36'], ['50', '', '', '60'], ['', '52', '38', '64']]", 4, 30, 66]
["[['', '', '63', ''], ['', '44', '', '36'], ['50', '', '', '60'], ['', '52', '38', '64']]", 30, 66, [1, 3], [1, 3], [207, 208], [173, 208], 201]
["[['', '', '63', ''], ['', '44', '', '36'], ['50', '', '', '60'], ['', '52', '38', '64']]", "30", "66", "[None, 207, 208, None]", "[None, 173, 208, None]", "201"]
63
In 'Restricted Sorting', there are 10 stacks each with a capacity of 6 blocks, with 5 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 5 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: 7, 2: 8, 3: 5, 4: 8, 5: 10, 6: 5, 7: 5, 8: 4, 9: 8}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], [], ['Blue', 'Yellow', 'Yellow', 'Yellow', 'Yellow', 'Black'], ['Red', 'Red', 'Blue', 'White', 'Blue', 'Black'], ['White', 'Green', 'Red', 'Black', 'Blue', 'Yellow'], [], ['White', 'Green', 'Green', 'White', 'Green', 'Green'], ['Black', 'Red', 'Red', 'Blue', 'White', 'Black'], [], []]
restricted_sorting
sorting
3
[[3, 8], [3, 8], [2, 0], [4, 1], [6, 1], [4, 9], [4, 8], [4, 5], [4, 0], [7, 5], [7, 8], [7, 8], [7, 0], [7, 1], [3, 0], [3, 1], [3, 0], [6, 9], [6, 9], [6, 1], [2, 4], [2, 4], [3, 7], [2, 3], [2, 4], [3, 4], [6, 9], [6, 9], [2, 7], [5, 7], [5, 7]]
207
13.576901912689209
31
90
30
[[[], [], ["Blue", "Yellow", "Yellow", "Yellow", "Yellow", "Black"], ["Red", "Red", "Blue", "White", "Blue", "Black"], ["White", "Green", "Red", "Black", "Blue", "Yellow"], [], ["White", "Green", "Green", "White", "Green", "Green"], ["Black", "Red", "Red", "Blue", "White", "Black"], [], []], 6, {"0": 7, "1": 7, "2": 8, "3": 5, "4": 8, "5": 10, "6": 5, "7": 5, "8": 4, "9": 8}]
[[[], [], ["Blue", "Yellow", "Yellow", "Yellow", "Yellow", "Black"], ["Red", "Red", "Blue", "White", "Blue", "Black"], ["White", "Green", "Red", "Black", "Blue", "Yellow"], [], ["White", "Green", "Green", "White", "Green", "Green"], ["Black", "Red", "Red", "Blue", "White", "Black"], [], []], 6, {"0": 7, "1": 7, "2": 8, "3": 5, "4": 8, "5": 10, "6": 5, "7": 5, "8": 4, "9": 8}, 5]
["[[], [], ['Blue', 'Yellow', 'Yellow', 'Yellow', 'Yellow', 'Black'], ['Red', 'Red', 'Blue', 'White', 'Blue', 'Black'], ['White', 'Green', 'Red', 'Black', 'Blue', 'Yellow'], [], ['White', 'Green', 'Green', 'White', 'Green', 'Green'], ['Black', 'Red', 'Red', 'Blue', 'White', 'Black'], [], []]", "{0: 7, 1: 7, 2: 8, 3: 5, 4: 8, 5: 10, 6: 5, 7: 5, 8: 4, 9: 8}", "6", "5"]
63
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 0) to his destination workshop at index (8, 9), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 8, and district 3 covering rows 9 to 12. 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 9 19 14 16 19 6 x x x 16 18 x] [19 x x 9 9 x 17 16 3 x x 14 x] [x x 11 x 5 x 15 15 17 10 x 13 5] [2 12 9 18 7 x x x 4 x 10 x 3] [8 9 19 1 x 4 8 x 17 6 x 18 x] [x 6 7 9 1 x x x x x x x x] [x 5 4 12 13 13 x x x 11 x 5 9] [x x 2 20 6 11 2 x x x 10 18 x] [x x 1 18 1 17 2 3 10 12 11 x 19] [x 16 3 x x 16 3 10 19 x x 9 x] [10 x x x x 1 10 13 x x 13 x x] [x x x x 13 x 1 14 x 10 x x 8] [x x x x x 9 2 18 19 14 10 x x]
traffic
pathfinding
5
[[3, 0], [4, 0], [4, 1], [5, 1], [6, 1], [6, 2], [7, 2], [8, 2], [9, 2], [8, 2], [8, 3], [8, 4], [8, 5], [8, 6], [8, 7], [8, 8], [8, 9]]
102
0.01901412010192871
17
4
4
[[["16", "9", "19", "14", "16", "19", "6", "x", "x", "x", "16", "18", "x"], ["19", "x", "x", "9", "9", "x", "17", "16", "3", "x", "x", "14", "x"], ["x", "x", "11", "x", "5", "x", "15", "15", "17", "10", "x", "13", "5"], ["2", "12", "9", "18", "7", "x", "x", "x", "4", "x", "10", "x", "3"], ["8", "9", "19", "1", "x", "4", "8", "x", "17", "6", "x", "18", "x"], ["x", "6", "7", "9", "1", "x", "x", "x", "x", "x", "x", "x", "x"], ["x", "5", "4", "12", "13", "13", "x", "x", "x", "11", "x", "5", "9"], ["x", "x", "2", "20", "6", "11", "2", "x", "x", "x", "10", "18", "x"], ["x", "x", "1", "18", "1", "17", "2", "3", "10", "12", "11", "x", "19"], ["x", "16", "3", "x", "x", "16", "3", "10", "19", "x", "x", "9", "x"], ["10", "x", "x", "x", "x", "1", "10", "13", "x", "x", "13", "x", "x"], ["x", "x", "x", "x", "13", "x", "1", "14", "x", "10", "x", "x", "8"], ["x", "x", "x", "x", "x", "9", "2", "18", "19", "14", "10", "x", "x"]]]
[[["16", "9", "19", "14", "16", "19", "6", "x", "x", "x", "16", "18", "x"], ["19", "x", "x", "9", "9", "x", "17", "16", "3", "x", "x", "14", "x"], ["x", "x", "11", "x", "5", "x", "15", "15", "17", "10", "x", "13", "5"], ["2", "12", "9", "18", "7", "x", "x", "x", "4", "x", "10", "x", "3"], ["8", "9", "19", "1", "x", "4", "8", "x", "17", "6", "x", "18", "x"], ["x", "6", "7", "9", "1", "x", "x", "x", "x", "x", "x", "x", "x"], ["x", "5", "4", "12", "13", "13", "x", "x", "x", "11", "x", "5", "9"], ["x", "x", "2", "20", "6", "11", "2", "x", "x", "x", "10", "18", "x"], ["x", "x", "1", "18", "1", "17", "2", "3", "10", "12", "11", "x", "19"], ["x", "16", "3", "x", "x", "16", "3", "10", "19", "x", "x", "9", "x"], ["10", "x", "x", "x", "x", "1", "10", "13", "x", "x", "13", "x", "x"], ["x", "x", "x", "x", "13", "x", "1", "14", "x", "10", "x", "x", "8"], ["x", "x", "x", "x", "x", "9", "2", "18", "19", "14", "10", "x", "x"]], [3, 0], [8, 9], 3, 8]
["[['16', '9', '19', '14', '16', '19', '6', 'x', 'x', 'x', '16', '18', 'x'], ['19', 'x', 'x', '9', '9', 'x', '17', '16', '3', 'x', 'x', '14', 'x'], ['x', 'x', '11', 'x', '5', 'x', '15', '15', '17', '10', 'x', '13', '5'], ['2', '12', '9', '18', '7', 'x', 'x', 'x', '4', 'x', '10', 'x', '3'], ['8', '9', '19', '1', 'x', '4', '8', 'x', '17', '6', 'x', '18', 'x'], ['x', '6', '7', '9', '1', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x'], ['x', '5', '4', '12', '13', '13', 'x', 'x', 'x', '11', 'x', '5', '9'], ['x', 'x', '2', '20', '6', '11', '2', 'x', 'x', 'x', '10', '18', 'x'], ['x', 'x', '1', '18', '1', '17', '2', '3', '10', '12', '11', 'x', '19'], ['x', '16', '3', 'x', 'x', '16', '3', '10', '19', 'x', 'x', '9', 'x'], ['10', 'x', 'x', 'x', 'x', '1', '10', '13', 'x', 'x', '13', 'x', 'x'], ['x', 'x', 'x', 'x', '13', 'x', '1', '14', 'x', '10', 'x', 'x', '8'], ['x', 'x', 'x', 'x', 'x', '9', '2', '18', '19', '14', '10', 'x', 'x']]", "(3, 0)", "(8, 9)", "3", "8"]
63
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 13x13. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (4, 0) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (12, 12). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 0 1 0 0 0 0 0 1 1 1 1 0 1 0 0 1 1 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 0 1 1 1 1 1 0 1 0 0 0 1 1 0 1 0 1 0 0 0 1 0 0 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 1 0 1 0 0 0 0 1 0 1 1 1 1 1 0 0 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 1 1 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0
trampoline_matrix
pathfinding
13
[[4, 0], [4, 1], [4, 2], [5, 3], [5, 4], [5, 5], [5, 6], [6, 6], [7, 6], [7, 7], [8, 7], [8, 8], [8, 9], [9, 9], [10, 10], [11, 11], [12, 12]]
17
0.03172564506530762
17
8
2
["[[1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0], [1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1], [0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 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1, 1, 0, 0, 1, 0, 1, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0], [0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]", "(4, 0)", "(12, 12)", "4"]
63
Given 5 labeled water jugs with capacities 123, 124, 133, 85, 74 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 276, 277, 355, 425 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
[["+", 85, 4], ["+", 133, 4], ["+", 74, 4], ["+", 133, 4], ["+", 74, 3], ["+", 74, 3], ["+", 74, 3], ["+", 133, 3], ["+", 85, 2], ["+", 133, 2], ["-", 74, 2], ["+", 133, 2], ["+", 133, 1], ["+", 133, 1], ["-", 123, 1], ["+", 133, 1]]
16
0.024725675582885742
16
40
3
[[123, 124, 133, 85, 74], [276, 277, 355, 425]]
[[123, 124, 133, 85, 74], [276, 277, 355, 425]]
["[123, 124, 133, 85, 74]", "[276, 277, 355, 425]"]
64
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: [[54, 100, 91, 80, 56], [19, '_', 38, 74, 29], [14, 36, 44, 13, 10]]
8_puzzle
puzzle
4
[36, 44, 38, 36, 44, 14, 19, 54, 100, 91, 80, 74, 36, 38, 13, 10]
16
0.03679513931274414
16
4
15
[[[54, 100, 91, 80, 56], [19, "_", 38, 74, 29], [14, 36, 44, 13, 10]]]
[[[54, 100, 91, 80, 56], [19, "_", 38, 74, 29], [14, 36, 44, 13, 10]]]
["[[54, 100, 91, 80, 56], [19, '_', 38, 74, 29], [14, 36, 44, 13, 10]]"]
64
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: tue, judy, zein, bord, wiry The initial board: [['u', 't', '_', 'e'], ['j', 'd', 'd', 'u'], ['o', 'e', 'z', 'n'], ['b', 'i', 'r', 'y'], ['w', 'i', 'r', 'y']]
8_puzzle_words
puzzle
2
["down-left", "down-right", "down-right", "down-left", "up-left", "up-left", "up-right", "up-right", "down-right", "down-left", "up-left", "down-left", "down-right", "down-right", "up-right", "up-left", "down-left", "up-left", "up-right", "up-left"]
20
0.3210330009460449
20
4
20
[[["u", "t", "_", "e"], ["j", "d", "d", "u"], ["o", "e", "z", "n"], ["b", "i", "r", "y"], ["w", "i", "r", "y"]]]
[[["u", "t", "_", "e"], ["j", "d", "d", "u"], ["o", "e", "z", "n"], ["b", "i", "r", "y"], ["w", "i", "r", "y"]], ["tue", "judy", "zein", "bord", "wiry"]]
["[['u', 't', '_', 'e'], ['j', 'd', 'd', 'u'], ['o', 'e', 'z', 'n'], ['b', 'i', 'r', 'y'], ['w', 'i', 'r', 'y']]", "['tue', 'judy', 'zein', 'bord', 'wiry']"]
64
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'Y'. Our task is to visit city D 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 D, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. Z J T D W L P Y V H R I A Z 0 0 0 0 0 0 0 0 0 1 1 1 0 J 0 0 0 0 0 0 0 0 1 1 1 0 0 T 1 0 0 1 0 0 0 0 0 0 0 0 0 D 1 0 1 0 0 1 1 0 0 1 0 0 1 W 1 1 1 0 0 0 0 0 0 1 0 0 1 L 0 1 1 0 1 0 0 0 1 1 1 0 1 P 1 1 1 0 1 1 0 0 1 0 0 0 0 Y 0 0 1 0 0 0 0 0 0 1 0 0 0 V 0 0 1 1 0 0 0 0 0 0 1 0 1 H 0 0 1 0 0 0 0 0 0 0 0 1 0 R 1 0 1 0 0 1 0 0 0 1 0 0 0 I 0 0 1 1 0 0 0 0 0 0 1 0 0 A 0 1 0 1 1 0 1 1 0 1 1 0 0
city_directed_graph
pathfinding
13
["Y", "T", "D", "A", "D", "L", "R", "Z", "R"]
9
0.04733538627624512
9
13
16
[[[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1], [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1, 1, 0, 0, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1], [1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0]]", "['Z', 'J', 'T', 'D', 'W', 'L', 'P', 'Y', 'V', 'H', 'R', 'I', 'A']", "['Y']", "['D', 'R']"]
64
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [14, 8, 11, 30, 3, 3, 27, 16, 19, 4, 6, 14, 7, 2, 39, 103, 15, 100, 27, 36, 7, 36, 13, 7, 18, 39, 14, 3, 28], such that the sum of the chosen coins adds up to 410. 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: 11, 18: 8, 36: 15, 11: 4, 6: 1, 16: 8, 100: 12, 39: 10, 28: 9, 27: 20, 103: 6, 19: 5, 30: 14, 2: 1, 4: 3, 3: 3, 15: 10, 8: 5, 7: 2, 14: 14}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
15
[7, 7, 19, 39, 103, 100, 28, 39, 36, 6, 7, 11, 8]
83
0.03669548034667969
13
29
29
[[14, 8, 11, 30, 3, 3, 27, 16, 19, 4, 6, 14, 7, 2, 39, 103, 15, 100, 27, 36, 7, 36, 13, 7, 18, 39, 14, 3, 28]]
[[14, 8, 11, 30, 3, 3, 27, 16, 19, 4, 6, 14, 7, 2, 39, 103, 15, 100, 27, 36, 7, 36, 13, 7, 18, 39, 14, 3, 28], {"13": 11, "18": 8, "36": 15, "11": 4, "6": 1, "16": 8, "100": 12, "39": 10, "28": 9, "27": 20, "103": 6, "19": 5, "30": 14, "2": 1, "4": 3, "3": 3, "15": 10, "8": 5, "7": 2, "14": 14}, 410]
["[14, 8, 11, 30, 3, 3, 27, 16, 19, 4, 6, 14, 7, 2, 39, 103, 15, 100, 27, 36, 7, 36, 13, 7, 18, 39, 14, 3, 28]", "{13: 11, 18: 8, 36: 15, 11: 4, 6: 1, 16: 8, 100: 12, 39: 10, 28: 9, 27: 20, 103: 6, 19: 5, 30: 14, 2: 1, 4: 3, 3: 3, 15: 10, 8: 5, 7: 2, 14: 14}", "410"]
64
The game of 'Sort It' begins with 3 tubes, each filled with 5 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 8 balls. It is not allowed to place a ball in a tube that already has 8 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Blue', 'Red', 'Red', 'Red'], ['Blue', 'Blue', 'Blue', 'Green', 'Green'], ['Red', 'Green', 'Green', 'Green', 'Blue']]
color_sorting
sorting
9
[[0, 2], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [1, 2], [1, 2], [1, 2], [0, 1], [0, 1], [0, 1]]
14
0.2936434745788574
14
6
15
[[["Red", "Blue", "Red", "Red", "Red"], ["Blue", "Blue", "Blue", "Green", "Green"], ["Red", "Green", "Green", "Green", "Blue"]], 8]
[[["Red", "Blue", "Red", "Red", "Red"], ["Blue", "Blue", "Blue", "Green", "Green"], ["Red", "Green", "Green", "Green", "Blue"]], 8]
["[['Red', 'Blue', 'Red', 'Red', 'Red'], ['Blue', 'Blue', 'Blue', 'Green', 'Green'], ['Red', 'Green', 'Green', 'Green', 'Blue']]", "8"]
64
We have a 4x4 numerical grid, with numbers ranging from 35 to 80 (35 included in the range but 80 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' '73' '74' 'x'] ['46' 'x' '63' '72'] ['x' '47' 'x' 'x'] ['41' '45' 'x' '54']]
consecutive_grid
underdetermined_system
12
[[0, 0, 31], [0, 3, 72], [1, 0, 32], [1, 1, 47], [1, 3, 63], [2, 1, 46], [2, 3, 59]]
685
41.66590666770935
7
45
16
["[['', '68', '71', ''], ['', '', '62', ''], ['43', '', '55', ''], ['44', '45', '52', '58']]", 31, 76]
["[['', '68', '71', ''], ['', '', '62', ''], ['43', '', '55', ''], ['44', '45', '52', '58']]", 31, 76]
["[['', '68', '71', ''], ['', '', '62', ''], ['43', '', '55', ''], ['44', '45', '52', '58']]", "31", "76"]
64
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 30 to 66. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 154, 157, None for columns 1 to 2 respectively, and the sums of rows must be None, 173, 194, None for rows 1 to 2 respectively, where None means that we do not have any constraints on the sum of the numbers in the row or column at that index. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 208. 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: [['46' '30' 'x' '49'] ['43' 'x' 'x' '53'] ['x' 'x' '37' 'x'] ['x' '34' '33' 'x']]
magic_square
underdetermined_system
8
[[0, 2, 42], [1, 1, 32], [1, 2, 45], [2, 0, 35], [2, 1, 58], [2, 3, 64], [3, 0, 56], [3, 3, 31]]
688
0.30200624465942383
8
26
16
["[['46', '30', '', '49'], ['43', '', '', '53'], ['', '', '37', ''], ['', '34', '33', '']]", 4, 30, 66]
["[['46', '30', '', '49'], ['43', '', '', '53'], ['', '', '37', ''], ['', '34', '33', '']]", 30, 66, [1, 3], [1, 3], [154, 157], [173, 194], 208]
["[['46', '30', '', '49'], ['43', '', '', '53'], ['', '', '37', ''], ['', '34', '33', '']]", "30", "66", "[None, 154, 157, None]", "[None, 173, 194, None]", "208"]