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
82
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 14x14. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 4 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (2, 13) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (8, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 0 1 0 1 0 0 0 1 0 1 1 0 0 1 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 1 0 1 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 0 1 1 1 1 0 1 0 0 1 1 0 0 1 1 1 0 1 1 1 0 0 1 1 0 1 0 0 1 1 0 1 1 0 0 1 0 0 0 0 0 1 1 1 1 0 1 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 0 0 0 1 1 1 1 0 1 0 1 0 0 0 1 0 0 0
trampoline_matrix
pathfinding
14
[[2, 13], [2, 12], [3, 12], [4, 11], [5, 11], [6, 12], [7, 11], [8, 11], [9, 10], [9, 9], [9, 8], [9, 7], [9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1, 0, 1, 0, 0, 1], [1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1], [0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1], [1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0]]", [2, 13], [8, 0], 4]
["[[1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1], [1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1], [0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1], [1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0], [0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1], [1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1], [0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1], [1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0]]", "(2, 13)", "(8, 0)", "4"]
82
Given 7 labeled water jugs with capacities 52, 55, 84, 135, 136, 47, 139, 76 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 292, 325, 496, 516 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 52, 4], ["+", 139, 4], ["+", 139, 4], ["+", 139, 4], ["+", 47, 4], ["+", 135, 3], ["+", 135, 3], ["+", 139, 3], ["-", 52, 3], ["+", 139, 3], ["+", 139, 2], ["+", 139, 2], ["+", 47, 2], ["+", 135, 1], ["+", 136, 1], ["-", 55, 1], ["+", 76, 1]]
17
0.049492597579956055
17
64
3
[[52, 55, 84, 135, 136, 47, 139, 76], [292, 325, 496, 516]]
[[52, 55, 84, 135, 136, 47, 139, 76], [292, 325, 496, 516]]
["[52, 55, 84, 135, 136, 47, 139, 76]", "[292, 325, 496, 516]"]
83
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[79, 82, 80, 67, 45], [51, '_', 63, 41, 5], [39, 99, 31, 16, 50]]
8_puzzle
puzzle
7
[82, 79, 51, 82, 63, 80, 79, 51, 82, 63, 99, 39, 63, 99, 51, 82, 99, 63, 39, 31, 16, 50, 5, 41, 50, 5, 41, 45, 67, 79, 80, 50, 45, 41]
34
4.1595001220703125
34
4
15
[[[79, 82, 80, 67, 45], [51, "_", 63, 41, 5], [39, 99, 31, 16, 50]]]
[[[79, 82, 80, 67, 45], [51, "_", 63, 41, 5], [39, 99, 31, 16, 50]]]
["[[79, 82, 80, 67, 45], [51, '_', 63, 41, 5], [39, 99, 31, 16, 50]]"]
83
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: rane, sures, liber, bikol, skaff The initial board: [['u', 'r', 'a', 'n', 'e'], ['s', 'l', 'r', 'i', 's'], ['a', 'i', '_', 'e', 'e'], ['b', 'o', 'k', 'b', 'l'], ['s', 'k', 'r', 'f', 'f']]
8_puzzle_words
puzzle
3
["down-right", "down-left", "up-left", "up-left", "up-right", "down-right", "up-right", "down-right", "down-left", "down-left", "up-left", "up-right", "up-left", "up-left"]
14
0.2462632656097412
14
4
25
[[["u", "r", "a", "n", "e"], ["s", "l", "r", "i", "s"], ["a", "i", "_", "e", "e"], ["b", "o", "k", "b", "l"], ["s", "k", "r", "f", "f"]]]
[[["u", "r", "a", "n", "e"], ["s", "l", "r", "i", "s"], ["a", "i", "_", "e", "e"], ["b", "o", "k", "b", "l"], ["s", "k", "r", "f", "f"]], ["rane", "sures", "liber", "bikol", "skaff"]]
["[['u', 'r', 'a', 'n', 'e'], ['s', 'l', 'r', 'i', 's'], ['a', 'i', '_', 'e', 'e'], ['b', 'o', 'k', 'b', 'l'], ['s', 'k', 'r', 'f', 'f']]", "['rane', 'sures', 'liber', 'bikol', 'skaff']"]
83
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 'X'. Our task is to visit city K and city N excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from N and K, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. J H X L F A P M D R T Z N K J 0 1 0 1 1 0 1 0 1 0 0 1 0 0 H 1 0 0 0 0 0 0 0 0 0 0 0 0 0 X 0 1 0 0 0 0 0 0 1 0 0 0 0 0 L 0 0 1 0 0 0 0 0 0 1 1 0 1 0 F 0 0 0 0 0 0 0 0 0 1 0 1 0 0 A 1 0 0 1 1 0 0 0 1 0 0 0 0 0 P 0 1 0 0 0 0 0 1 0 0 0 0 0 1 M 0 0 0 1 0 1 0 0 1 0 1 1 0 0 D 0 0 0 1 0 0 1 1 0 1 0 0 1 0 R 0 1 0 1 0 0 0 1 0 0 0 0 0 1 T 1 1 1 0 1 0 1 1 0 1 0 0 1 0 Z 0 1 0 1 0 0 1 0 1 1 0 0 1 0 N 0 0 0 1 1 0 1 0 1 1 0 1 0 0 K 1 1 1 0 1 1 0 1 0 0 1 0 0 0
city_directed_graph
pathfinding
14
["X", "D", "N", "P", "K", "T", "N", "R", "K"]
9
0.12111306190490723
9
14
17
[[[0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0]], ["J", "H", "X", "L", "F", "A", "P", "M", "D", "R", "T", "Z", "N", "K"], "K", "N"]
[[[0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0]], ["J", "H", "X", "L", "F", "A", "P", "M", "D", "R", "T", "Z", "N", "K"], "X", "K", "N"]
["[[0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0], [1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0]]", "['J', 'H', 'X', 'L', 'F', 'A', 'P', 'M', 'D', 'R', 'T', 'Z', 'N', 'K']", "['X']", "['K', 'N']"]
83
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [12, 5, 22, 10, 4, 26, 26, 31, 13, 30, 37, 14, 14, 38, 9, 30, 7, 16, 21, 37, 4, 24, 10, 41, 13, 16, 3, 40, 24, 117, 34, 7, 11, 14, 28, 37, 21, 32, 2, 15, 5, 13, 3, 28, 31, 22, 30, 32, 38, 25, 10, 4, 30], such that the sum of the chosen coins adds up to 411. 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: 7, 2: 2, 14: 12, 15: 8, 13: 10, 9: 1, 38: 17, 117: 2, 16: 13, 25: 11, 31: 3, 32: 2, 22: 10, 7: 4, 12: 3, 4: 1, 40: 2, 34: 4, 41: 9, 30: 8, 11: 10, 26: 13, 28: 6, 3: 2, 37: 17, 5: 5, 21: 3, 24: 13}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
34
[40, 32, 4, 31, 4, 117, 34, 32, 4, 21, 21, 31, 28, 12]
36
0.06167340278625488
14
53
53
[[12, 5, 22, 10, 4, 26, 26, 31, 13, 30, 37, 14, 14, 38, 9, 30, 7, 16, 21, 37, 4, 24, 10, 41, 13, 16, 3, 40, 24, 117, 34, 7, 11, 14, 28, 37, 21, 32, 2, 15, 5, 13, 3, 28, 31, 22, 30, 32, 38, 25, 10, 4, 30]]
[[12, 5, 22, 10, 4, 26, 26, 31, 13, 30, 37, 14, 14, 38, 9, 30, 7, 16, 21, 37, 4, 24, 10, 41, 13, 16, 3, 40, 24, 117, 34, 7, 11, 14, 28, 37, 21, 32, 2, 15, 5, 13, 3, 28, 31, 22, 30, 32, 38, 25, 10, 4, 30], {"10": 7, "2": 2, "14": 12, "15": 8, "13": 10, "9": 1, "38": 17, "117": 2, "16": 13, "25": 11, "31": 3, "32": 2, "22": 10, "7": 4, "12": 3, "4": 1, "40": 2, "34": 4, "41": 9, "30": 8, "11": 10, "26": 13, "28": 6, "3": 2, "37": 17, "5": 5, "21": 3, "24": 13}, 411]
["[12, 5, 22, 10, 4, 26, 26, 31, 13, 30, 37, 14, 14, 38, 9, 30, 7, 16, 21, 37, 4, 24, 10, 41, 13, 16, 3, 40, 24, 117, 34, 7, 11, 14, 28, 37, 21, 32, 2, 15, 5, 13, 3, 28, 31, 22, 30, 32, 38, 25, 10, 4, 30]", "{10: 7, 2: 2, 14: 12, 15: 8, 13: 10, 9: 1, 38: 17, 117: 2, 16: 13, 25: 11, 31: 3, 32: 2, 22: 10, 7: 4, 12: 3, 4: 1, 40: 2, 34: 4, 41: 9, 30: 8, 11: 10, 26: 13, 28: 6, 3: 2, 37: 17, 5: 5, 21: 3, 24: 13}", "411"]
83
The game of 'Sort It' begins with 3 tubes, each filled with 6 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 9 balls. It is not allowed to place a ball in a tube that already has 9 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Green', 'Blue', 'Blue', 'Blue', 'Red'], ['Red', 'Red', 'Green', 'Blue', 'Green', 'Blue'], ['Red', 'Red', 'Green', 'Green', 'Blue', 'Green']]
color_sorting
sorting
10
[[0, 1], [2, 1], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 2], [1, 0], [2, 1], [2, 1], [2, 1], [2, 1], [2, 1], [2, 1], [2, 1], [2, 0], [1, 2], [1, 2], [1, 2], [0, 1], [0, 2], [0, 2]]
29
281.29705452919006
29
6
18
[[["Red", "Green", "Blue", "Blue", "Blue", "Red"], ["Red", "Red", "Green", "Blue", "Green", "Blue"], ["Red", "Red", "Green", "Green", "Blue", "Green"]], 9]
[[["Red", "Green", "Blue", "Blue", "Blue", "Red"], ["Red", "Red", "Green", "Blue", "Green", "Blue"], ["Red", "Red", "Green", "Green", "Blue", "Green"]], 9]
["[['Red', 'Green', 'Blue', 'Blue', 'Blue', 'Red'], ['Red', 'Red', 'Green', 'Blue', 'Green', 'Blue'], ['Red', 'Red', 'Green', 'Green', 'Blue', 'Green']]", "9"]
83
We have a 4x4 numerical grid, with numbers ranging from 36 to 86 (36 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: [['x' 'x' '58' 'x'] ['44' '54' '59' 'x'] ['43' 'x' '63' '75'] ['x' 'x' 'x' '84']]
consecutive_grid
underdetermined_system
13
[[0, 1, 39], [0, 3, 51], [1, 0, 40], [1, 1, 41], [2, 1, 55], [3, 0, 56]]
705
0.23045659065246582
6
50
16
["[['38', '', '50', ''], ['', '', '64', '67'], ['54', '', '71', '79'], ['', '59', '89', '90']]", 36, 91]
["[['38', '', '50', ''], ['', '', '64', '67'], ['54', '', '71', '79'], ['', '59', '89', '90']]", 36, 91]
["[['38', '', '50', ''], ['', '', '64', '67'], ['54', '', '71', '79'], ['', '59', '89', '90']]", "36", "91"]
83
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 43 to 84. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 240, 226, None for columns 1 to 2 respectively, and the sums of rows must be None, 255, 268, 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 264. 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' '51' 'x' '65'] ['x' 'x' 'x' '68'] ['x' 'x' '64' '75'] ['x' 'x' 'x' 'x']]
magic_square
underdetermined_system
9
[[0, 0, 43], [0, 2, 44], [1, 0, 52], [1, 1, 62], [1, 2, 73], [2, 0, 49], [2, 1, 80], [3, 0, 46], [3, 1, 47], [3, 2, 45], [3, 3, 48]]
912
105.51012396812439
11
31
16
["[['', '51', '', '65'], ['', '', '', '68'], ['', '', '64', '75'], ['', '', '', '']]", 4, 43, 84]
["[['', '51', '', '65'], ['', '', '', '68'], ['', '', '64', '75'], ['', '', '', '']]", 43, 84, [1, 3], [1, 3], [240, 226], [255, 268], 264]
["[['', '51', '', '65'], ['', '', '', '68'], ['', '', '64', '75'], ['', '', '', '']]", "43", "84", "[None, 240, 226, None]", "[None, 255, 268, None]", "264"]
83
In 'Restricted Sorting', there are 12 stacks each with a capacity of 7 blocks, with 6 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 6 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: 10, 1: 8, 2: 12, 3: 3, 4: 5, 5: 11, 6: 5, 7: 12, 8: 3, 9: 3, 10: 11, 11: 6}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], ['Black', 'Green', 'White', 'Pink', 'Yellow', 'Blue', 'Red'], [], ['Green', 'Red', 'Red', 'Red', 'White', 'Black', 'Black'], [], ['Blue', 'Blue', 'Pink', 'Yellow', 'Pink', 'Green', 'Red'], ['Blue', 'Black', 'White', 'Green', 'White', 'Yellow', 'Yellow'], ['White', 'Blue', 'Pink', 'Green', 'Yellow', 'Green', 'Pink'], [], ['Yellow', 'Black', 'White', 'Red', 'Blue', 'Black', 'Pink'], [], []]
restricted_sorting
sorting
4
[[5, 8], [5, 8], [6, 8], [1, 4], [6, 4], [6, 11], [7, 11], [7, 8], [1, 0], [1, 11], [3, 0], [6, 0], [6, 11], [9, 6], [9, 4], [9, 11], [1, 10], [1, 6], [1, 8], [9, 1], [9, 8], [9, 4], [7, 9], [5, 9], [5, 6], [5, 9], [5, 0], [3, 1], [3, 1], [3, 1], [3, 11], [3, 4], [3, 4], [7, 3], [7, 6], [7, 3], [5, 1], [0, 3], [0, 3], [0, 3], [0, 3], [7, 9], [10, 9]]
228
0.21515893936157227
43
132
42
[[[], ["Black", "Green", "White", "Pink", "Yellow", "Blue", "Red"], [], ["Green", "Red", "Red", "Red", "White", "Black", "Black"], [], ["Blue", "Blue", "Pink", "Yellow", "Pink", "Green", "Red"], ["Blue", "Black", "White", "Green", "White", "Yellow", "Yellow"], ["White", "Blue", "Pink", "Green", "Yellow", "Green", "Pink"], [], ["Yellow", "Black", "White", "Red", "Blue", "Black", "Pink"], [], []], 7, {"0": 10, "1": 8, "2": 12, "3": 3, "4": 5, "5": 11, "6": 5, "7": 12, "8": 3, "9": 3, "10": 11, "11": 6}]
[[[], ["Black", "Green", "White", "Pink", "Yellow", "Blue", "Red"], [], ["Green", "Red", "Red", "Red", "White", "Black", "Black"], [], ["Blue", "Blue", "Pink", "Yellow", "Pink", "Green", "Red"], ["Blue", "Black", "White", "Green", "White", "Yellow", "Yellow"], ["White", "Blue", "Pink", "Green", "Yellow", "Green", "Pink"], [], ["Yellow", "Black", "White", "Red", "Blue", "Black", "Pink"], [], []], 7, {"0": 10, "1": 8, "2": 12, "3": 3, "4": 5, "5": 11, "6": 5, "7": 12, "8": 3, "9": 3, "10": 11, "11": 6}, 6]
["[[], ['Black', 'Green', 'White', 'Pink', 'Yellow', 'Blue', 'Red'], [], ['Green', 'Red', 'Red', 'Red', 'White', 'Black', 'Black'], [], ['Blue', 'Blue', 'Pink', 'Yellow', 'Pink', 'Green', 'Red'], ['Blue', 'Black', 'White', 'Green', 'White', 'Yellow', 'Yellow'], ['White', 'Blue', 'Pink', 'Green', 'Yellow', 'Green', 'Pink'], [], ['Yellow', 'Black', 'White', 'Red', 'Blue', 'Black', 'Pink'], [], []]", "{0: 10, 1: 8, 2: 12, 3: 3, 4: 5, 5: 11, 6: 5, 7: 12, 8: 3, 9: 3, 10: 11, 11: 6}", "7", "6"]
83
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, 13) to his destination workshop at index (5, 1), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 2, district 2 covering rows 3 to 5, and district 3 covering rows 6 to 13. 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 14 x 3 x 18 x 4 4 x x 16 x] [x x 1 15 x 18 x 18 x x x x 14 x] [x x 7 14 x x 16 x x x x 5 19 15] [x 13 18 x 17 x 6 8 x 8 x x 13 x] [12 x 15 x x x x 18 x x x 8 6 7] [5 11 14 14 11 5 13 7 x x 10 12 17 17] [14 x 3 15 3 x x 17 12 7 19 15 4 5] [x 2 14 x 8 x 9 19 16 14 17 12 x 13] [x x 2 15 x x x 2 14 17 3 4 x 12] [2 x 11 x x 14 x x 16 x 11 13 x x] [17 x x 2 9 14 8 x 11 5 x 10 5 x] [4 x 8 8 11 x 16 x x x 15 x 2 16] [x 16 x x 9 x x x x 19 6 9 x x] [x 14 9 x 6 1 7 x 10 4 x x x x]
traffic
pathfinding
6
[[2, 13], [2, 12], [3, 12], [4, 12], [4, 11], [5, 11], [5, 10], [6, 10], [6, 9], [6, 8], [6, 7], [5, 7], [5, 6], [5, 5], [5, 4], [5, 3], [5, 2], [5, 1]]
198
0.028166532516479492
18
4
4
[[["x", "x", "14", "x", "3", "x", "18", "x", "4", "4", "x", "x", "16", "x"], ["x", "x", "1", "15", "x", "18", "x", "18", "x", "x", "x", "x", "14", "x"], ["x", "x", "7", "14", "x", "x", "16", "x", "x", "x", "x", "5", "19", "15"], ["x", "13", "18", "x", "17", "x", "6", "8", "x", "8", "x", "x", "13", "x"], ["12", "x", "15", "x", "x", "x", "x", "18", "x", "x", "x", "8", "6", "7"], ["5", "11", "14", "14", "11", "5", "13", "7", "x", "x", "10", "12", "17", "17"], ["14", "x", "3", "15", "3", "x", "x", "17", "12", "7", "19", "15", "4", "5"], ["x", "2", "14", "x", "8", "x", "9", "19", "16", "14", "17", "12", "x", "13"], ["x", "x", "2", "15", "x", "x", "x", "2", "14", "17", "3", "4", "x", "12"], ["2", "x", "11", "x", "x", "14", "x", "x", "16", "x", "11", "13", "x", "x"], ["17", "x", "x", "2", "9", "14", "8", "x", "11", "5", "x", "10", "5", "x"], ["4", "x", "8", "8", "11", "x", "16", "x", "x", "x", "15", "x", "2", "16"], ["x", "16", "x", "x", "9", "x", "x", "x", "x", "19", "6", "9", "x", "x"], ["x", "14", "9", "x", "6", "1", "7", "x", "10", "4", "x", "x", "x", "x"]]]
[[["x", "x", "14", "x", "3", "x", "18", "x", "4", "4", "x", "x", "16", "x"], ["x", "x", "1", "15", "x", "18", "x", "18", "x", "x", "x", "x", "14", "x"], ["x", "x", "7", "14", "x", "x", "16", "x", "x", "x", "x", "5", "19", "15"], ["x", "13", "18", "x", "17", "x", "6", "8", "x", "8", "x", "x", "13", "x"], ["12", "x", "15", "x", "x", "x", "x", "18", "x", "x", "x", "8", "6", "7"], ["5", "11", "14", "14", "11", "5", "13", "7", "x", "x", "10", "12", "17", "17"], ["14", "x", "3", "15", "3", "x", "x", "17", "12", "7", "19", "15", "4", "5"], ["x", "2", "14", "x", "8", "x", "9", "19", "16", "14", "17", "12", "x", "13"], ["x", "x", "2", "15", "x", "x", "x", "2", "14", "17", "3", "4", "x", "12"], ["2", "x", "11", "x", "x", "14", "x", "x", "16", "x", "11", "13", "x", "x"], ["17", "x", "x", "2", "9", "14", "8", "x", "11", "5", "x", "10", "5", "x"], ["4", "x", "8", "8", "11", "x", "16", "x", "x", "x", "15", "x", "2", "16"], ["x", "16", "x", "x", "9", "x", "x", "x", "x", "19", "6", "9", "x", "x"], ["x", "14", "9", "x", "6", "1", "7", "x", "10", "4", "x", "x", "x", "x"]], [2, 13], [5, 1], 2, 5]
["[['x', 'x', '14', 'x', '3', 'x', '18', 'x', '4', '4', 'x', 'x', '16', 'x'], ['x', 'x', '1', '15', 'x', '18', 'x', '18', 'x', 'x', 'x', 'x', '14', 'x'], ['x', 'x', '7', '14', 'x', 'x', '16', 'x', 'x', 'x', 'x', '5', '19', '15'], ['x', '13', '18', 'x', '17', 'x', '6', '8', 'x', '8', 'x', 'x', '13', 'x'], ['12', 'x', '15', 'x', 'x', 'x', 'x', '18', 'x', 'x', 'x', '8', '6', '7'], ['5', '11', '14', '14', '11', '5', '13', '7', 'x', 'x', '10', '12', '17', '17'], ['14', 'x', '3', '15', '3', 'x', 'x', '17', '12', '7', '19', '15', '4', '5'], ['x', '2', '14', 'x', '8', 'x', '9', '19', '16', '14', '17', '12', 'x', '13'], ['x', 'x', '2', '15', 'x', 'x', 'x', '2', '14', '17', '3', '4', 'x', '12'], ['2', 'x', '11', 'x', 'x', '14', 'x', 'x', '16', 'x', '11', '13', 'x', 'x'], ['17', 'x', 'x', '2', '9', '14', '8', 'x', '11', '5', 'x', '10', '5', 'x'], ['4', 'x', '8', '8', '11', 'x', '16', 'x', 'x', 'x', '15', 'x', '2', '16'], ['x', '16', 'x', 'x', '9', 'x', 'x', 'x', 'x', '19', '6', '9', 'x', 'x'], ['x', '14', '9', 'x', '6', '1', '7', 'x', '10', '4', 'x', 'x', 'x', 'x']]", "(2, 13)", "(5, 1)", "2", "5"]
83
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 14x14. 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 (13, 10) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (4, 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 0 0 1 0 1 0 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 0 1 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 0 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 0 0 1 0 0 1 0 1 1 1 1 0 1 0 0 0 1 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 1 1 1 1 1 0 0 0 0
trampoline_matrix
pathfinding
14
[[13, 10], [12, 9], [11, 8], [10, 7], [9, 6], [9, 5], [8, 5], [8, 4], [8, 3], [8, 2], [8, 1], [8, 0], [7, 0], [6, 0], [5, 0], [4, 0]]
16
0.0652778148651123
16
8
2
["[[0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1], [1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], [0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1], [0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1], [0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [1, 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1, 0, 1], [0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1], [0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1], [1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0], [1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0]]", "(13, 10)", "(4, 0)", "4"]
83
Given 7 labeled water jugs with capacities 19, 42, 18, 127, 106, 32, 22, 137 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 245, 252, 264, 314 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 22, 4], ["+", 137, 4], ["+", 18, 4], ["+", 137, 4], ["+", 127, 3], ["+", 137, 3], ["+", 106, 2], ["+", 127, 2], ["+", 19, 2], ["+", 127, 1], ["-", 19, 1], ["+", 137, 1]]
12
0.036943674087524414
12
64
3
[[19, 42, 18, 127, 106, 32, 22, 137], [245, 252, 264, 314]]
[[19, 42, 18, 127, 106, 32, 22, 137], [245, 252, 264, 314]]
["[19, 42, 18, 127, 106, 32, 22, 137]", "[245, 252, 264, 314]"]
84
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: [[85, 96, 29, 80, 12], [60, '_', 76, 42, 82], [27, 89, 72, 37, 55]]
8_puzzle
puzzle
7
[96, 85, 60, 96, 76, 29, 85, 60, 96, 76, 89, 72, 37, 42, 82, 12, 80, 85, 60, 89, 72, 27, 76, 72, 27, 37, 29, 27, 72, 76, 37, 29, 27, 60, 85, 82, 12, 55, 42, 12, 55, 42]
42
31.574211835861206
42
4
15
[[[85, 96, 29, 80, 12], [60, "_", 76, 42, 82], [27, 89, 72, 37, 55]]]
[[[85, 96, 29, 80, 12], [60, "_", 76, 42, 82], [27, 89, 72, 37, 55]]]
["[[85, 96, 29, 80, 12], [60, '_', 76, 42, 82], [27, 89, 72, 37, 55]]"]
84
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: roto, serer, tapas, dinka, desex The initial board: [['e', 'r', 'p', 't', 'o'], ['s', 't', 'r', 'k', 'r'], ['e', 'a', '_', 'a', 'i'], ['d', 'o', 'n', 's', 'a'], ['d', 'e', 's', 'e', 'x']]
8_puzzle_words
puzzle
3
["up-right", "down-right", "down-left", "up-left", "up-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left"]
18
0.3263390064239502
18
4
25
[[["e", "r", "p", "t", "o"], ["s", "t", "r", "k", "r"], ["e", "a", "_", "a", "i"], ["d", "o", "n", "s", "a"], ["d", "e", "s", "e", "x"]]]
[[["e", "r", "p", "t", "o"], ["s", "t", "r", "k", "r"], ["e", "a", "_", "a", "i"], ["d", "o", "n", "s", "a"], ["d", "e", "s", "e", "x"]], ["roto", "serer", "tapas", "dinka", "desex"]]
["[['e', 'r', 'p', 't', 'o'], ['s', 't', 'r', 'k', 'r'], ['e', 'a', '_', 'a', 'i'], ['d', 'o', 'n', 's', 'a'], ['d', 'e', 's', 'e', 'x']]", "['roto', 'serer', 'tapas', 'dinka', 'desex']"]
84
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 H and city K excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from K and H, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. F O L P Y R Q B T V A K S H F 0 0 0 1 1 0 0 1 0 0 0 0 0 0 O 0 0 1 0 1 0 1 0 1 0 0 1 0 0 L 1 0 0 0 0 1 1 0 0 0 1 1 1 0 P 0 0 1 0 1 0 0 1 0 1 1 0 0 0 Y 0 0 0 0 0 0 0 1 0 0 1 0 1 0 R 0 0 0 0 1 0 1 1 0 0 0 0 1 0 Q 0 0 0 1 0 0 0 0 0 0 0 1 0 1 B 0 1 1 0 0 0 1 0 0 1 0 0 1 1 T 1 0 0 0 0 0 1 0 0 1 0 0 0 0 V 0 0 0 0 0 0 0 0 1 0 0 1 1 1 A 1 1 0 0 0 0 0 1 1 1 0 0 0 1 K 1 0 0 1 1 0 0 0 1 0 1 0 0 0 S 0 1 0 0 0 0 1 0 1 1 1 1 0 0 H 1 0 0 1 0 1 0 0 0 0 0 0 1 0
city_directed_graph
pathfinding
14
["T", "Q", "H", "S", "K", "P", "L", "K", "A", "H"]
10
0.10328006744384766
10
14
17
[[[0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0], [0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1], [1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0]], ["F", "O", "L", "P", "Y", "R", "Q", "B", "T", "V", "A", "K", "S", "H"], "H", "K"]
[[[0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0], [0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1], [1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0]], ["F", "O", "L", "P", "Y", "R", "Q", "B", "T", "V", "A", "K", "S", "H"], "T", "H", "K"]
["[[0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0], [0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1], [1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0]]", "['F', 'O', 'L', 'P', 'Y', 'R', 'Q', 'B', 'T', 'V', 'A', 'K', 'S', 'H']", "['T']", "['H', 'K']"]
84
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [17, 4, 35, 10, 42, 11, 10, 11, 2, 14, 29, 31, 33, 3, 38, 4, 32, 9, 19, 14, 4, 39, 6, 36, 31, 25, 40, 8, 33, 31, 11, 34, 18, 2, 32, 40, 4, 16, 1, 36, 37, 3, 33, 20, 10, 8, 9, 20, 14, 35, 36, 22, 35, 4], such that the sum of the chosen coins adds up to 426. 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 {37: 11, 10: 3, 36: 8, 32: 3, 3: 1, 18: 16, 14: 5, 35: 5, 16: 15, 8: 5, 42: 20, 29: 4, 6: 1, 25: 9, 11: 4, 20: 15, 39: 6, 38: 14, 34: 6, 40: 11, 9: 2, 17: 6, 19: 8, 4: 4, 22: 20, 31: 3, 1: 1, 33: 18, 2: 2}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
35
[29, 31, 31, 31, 35, 32, 35, 35, 32, 6, 9, 9, 39, 36, 34, 2]
61
0.06626677513122559
16
54
54
[[17, 4, 35, 10, 42, 11, 10, 11, 2, 14, 29, 31, 33, 3, 38, 4, 32, 9, 19, 14, 4, 39, 6, 36, 31, 25, 40, 8, 33, 31, 11, 34, 18, 2, 32, 40, 4, 16, 1, 36, 37, 3, 33, 20, 10, 8, 9, 20, 14, 35, 36, 22, 35, 4]]
[[17, 4, 35, 10, 42, 11, 10, 11, 2, 14, 29, 31, 33, 3, 38, 4, 32, 9, 19, 14, 4, 39, 6, 36, 31, 25, 40, 8, 33, 31, 11, 34, 18, 2, 32, 40, 4, 16, 1, 36, 37, 3, 33, 20, 10, 8, 9, 20, 14, 35, 36, 22, 35, 4], {"37": 11, "10": 3, "36": 8, "32": 3, "3": 1, "18": 16, "14": 5, "35": 5, "16": 15, "8": 5, "42": 20, "29": 4, "6": 1, "25": 9, "11": 4, "20": 15, "39": 6, "38": 14, "34": 6, "40": 11, "9": 2, "17": 6, "19": 8, "4": 4, "22": 20, "31": 3, "1": 1, "33": 18, "2": 2}, 426]
["[17, 4, 35, 10, 42, 11, 10, 11, 2, 14, 29, 31, 33, 3, 38, 4, 32, 9, 19, 14, 4, 39, 6, 36, 31, 25, 40, 8, 33, 31, 11, 34, 18, 2, 32, 40, 4, 16, 1, 36, 37, 3, 33, 20, 10, 8, 9, 20, 14, 35, 36, 22, 35, 4]", "{37: 11, 10: 3, 36: 8, 32: 3, 3: 1, 18: 16, 14: 5, 35: 5, 16: 15, 8: 5, 42: 20, 29: 4, 6: 1, 25: 9, 11: 4, 20: 15, 39: 6, 38: 14, 34: 6, 40: 11, 9: 2, 17: 6, 19: 8, 4: 4, 22: 20, 31: 3, 1: 1, 33: 18, 2: 2}", "426"]
84
The game of 'Sort It' begins with 3 tubes, each filled with 6 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 9 balls. It is not allowed to place a ball in a tube that already has 9 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', 'Green', 'Blue', 'Green'], ['Blue', 'Blue', 'Blue', 'Red', 'Red', 'Green'], ['Blue', 'Red', 'Blue', 'Red', 'Red', 'Green']]
color_sorting
sorting
10
[[2, 1], [2, 0], [2, 1], [2, 0], [2, 0], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [0, 2], [0, 2], [0, 2], [1, 2], [0, 1], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [2, 1], [2, 1], [2, 1], [2, 1], [2, 0], [2, 1], [0, 2], [0, 2], [0, 2]]
33
137.44458413124084
33
6
18
[[["Green", "Red", "Green", "Green", "Blue", "Green"], ["Blue", "Blue", "Blue", "Red", "Red", "Green"], ["Blue", "Red", "Blue", "Red", "Red", "Green"]], 9]
[[["Green", "Red", "Green", "Green", "Blue", "Green"], ["Blue", "Blue", "Blue", "Red", "Red", "Green"], ["Blue", "Red", "Blue", "Red", "Red", "Green"]], 9]
["[['Green', 'Red', 'Green', 'Green', 'Blue', 'Green'], ['Blue', 'Blue', 'Blue', 'Red', 'Red', 'Green'], ['Blue', 'Red', 'Blue', 'Red', 'Red', 'Green']]", "9"]
84
We have a 4x4 numerical grid, with numbers ranging from 23 to 73 (23 included in the range but 73 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > 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' '35' 'x' 'x'] ['34' '36' '38' 'x'] ['29' 'x' '43' 'x'] ['x' 'x' '49' '53']]
consecutive_grid
underdetermined_system
13
[[0, 2, 51], [1, 2, 50], [1, 3, 52], [2, 0, 40], [2, 1, 48], [2, 3, 53], [3, 0, 39]]
729
0.5444209575653076
7
50
16
["[['91', '57', '', '45'], ['41', '49', '', ''], ['', '', '49', ''], ['', '46', '47', '73']]", 39, 94]
["[['91', '57', '', '45'], ['41', '49', '', ''], ['', '', '49', ''], ['', '46', '47', '73']]", 39, 94]
["[['91', '57', '', '45'], ['41', '49', '', ''], ['', '', '49', ''], ['', '46', '47', '73']]", "39", "94"]
84
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 37 to 83. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 277, 204, None for columns 1 to 2 respectively, and the sums of rows must be None, 253, 221, 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 252. 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' '53' '43' '72'] ['x' '82' '54' 'x'] ['x' '62' '44' 'x'] ['x' 'x' 'x' 'x']]
magic_square
underdetermined_system
9
[[1, 0, 38], [1, 3, 79], [2, 0, 39], [2, 3, 76], [3, 0, 64], [3, 1, 80], [3, 2, 63], [3, 3, 37]]
928
1.0334880352020264
8
31
16
["[['42', '53', '43', '72'], ['', '82', '54', ''], ['', '62', '44', ''], ['', '', '', '']]", 4, 37, 83]
["[['42', '53', '43', '72'], ['', '82', '54', ''], ['', '62', '44', ''], ['', '', '', '']]", 37, 83, [1, 3], [1, 3], [277, 204], [253, 221], 252]
["[['42', '53', '43', '72'], ['', '82', '54', ''], ['', '62', '44', ''], ['', '', '', '']]", "37", "83", "[None, 277, 204, None]", "[None, 253, 221, None]", "252"]
84
In 'Restricted Sorting', there are 12 stacks each with a capacity of 7 blocks, with 6 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 6 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: 12, 1: 3, 2: 11, 3: 5, 4: 11, 5: 13, 6: 2, 7: 2, 8: 12, 9: 4, 10: 2, 11: 10}, 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? [[], [], [], [], ['Pink', 'Red', 'Green', 'Pink', 'White', 'Blue', 'Yellow'], [], ['Yellow', 'White', 'Yellow', 'Blue', 'Yellow', 'Black', 'White'], ['Black', 'Green', 'Pink', 'Pink', 'Green', 'Yellow', 'Green'], ['White', 'Blue', 'Red', 'Red', 'Red', 'Yellow', 'Black'], ['Black', 'Blue', 'Blue', 'Pink', 'Red', 'White', 'Green'], [], ['Blue', 'Black', 'Black', 'White', 'Red', 'Green', 'Pink']]
restricted_sorting
sorting
4
[[7, 10], [9, 10], [8, 1], [8, 3], [11, 3], [11, 10], [11, 10], [11, 1], [11, 2], [11, 0], [9, 3], [9, 3], [9, 11], [9, 2], [9, 1], [7, 9], [7, 11], [7, 11], [4, 11], [4, 2], [4, 9], [4, 11], [4, 1], [4, 3], [7, 9], [7, 4], [7, 9], [6, 7], [6, 1], [6, 7], [6, 3], [6, 7], [6, 10], [0, 9], [6, 1], [8, 6], [8, 6], [8, 6], [8, 7], [2, 6], [2, 6], [2, 6], [4, 7], [4, 7], [8, 10]]
210
3.1606807708740234
45
132
42
[[[], [], [], [], ["Pink", "Red", "Green", "Pink", "White", "Blue", "Yellow"], [], ["Yellow", "White", "Yellow", "Blue", "Yellow", "Black", "White"], ["Black", "Green", "Pink", "Pink", "Green", "Yellow", "Green"], ["White", "Blue", "Red", "Red", "Red", "Yellow", "Black"], ["Black", "Blue", "Blue", "Pink", "Red", "White", "Green"], [], ["Blue", "Black", "Black", "White", "Red", "Green", "Pink"]], 7, {"0": 12, "1": 3, "2": 11, "3": 5, "4": 11, "5": 13, "6": 2, "7": 2, "8": 12, "9": 4, "10": 2, "11": 10}]
[[[], [], [], [], ["Pink", "Red", "Green", "Pink", "White", "Blue", "Yellow"], [], ["Yellow", "White", "Yellow", "Blue", "Yellow", "Black", "White"], ["Black", "Green", "Pink", "Pink", "Green", "Yellow", "Green"], ["White", "Blue", "Red", "Red", "Red", "Yellow", "Black"], ["Black", "Blue", "Blue", "Pink", "Red", "White", "Green"], [], ["Blue", "Black", "Black", "White", "Red", "Green", "Pink"]], 7, {"0": 12, "1": 3, "2": 11, "3": 5, "4": 11, "5": 13, "6": 2, "7": 2, "8": 12, "9": 4, "10": 2, "11": 10}, 6]
["[[], [], [], [], ['Pink', 'Red', 'Green', 'Pink', 'White', 'Blue', 'Yellow'], [], ['Yellow', 'White', 'Yellow', 'Blue', 'Yellow', 'Black', 'White'], ['Black', 'Green', 'Pink', 'Pink', 'Green', 'Yellow', 'Green'], ['White', 'Blue', 'Red', 'Red', 'Red', 'Yellow', 'Black'], ['Black', 'Blue', 'Blue', 'Pink', 'Red', 'White', 'Green'], [], ['Blue', 'Black', 'Black', 'White', 'Red', 'Green', 'Pink']]", "{0: 12, 1: 3, 2: 11, 3: 5, 4: 11, 5: 13, 6: 2, 7: 2, 8: 12, 9: 4, 10: 2, 11: 10}", "7", "6"]
84
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 (9, 10) to his destination workshop at index (2, 3), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 2, district 2 covering rows 3 to 8, and district 3 covering rows 9 to 13. 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 10 16 12 x x x x 18 18 10 x x 19] [7 x x 11 5 13 6 x x x x x 8 14] [x 15 6 20 4 9 16 9 16 x 11 x x 9] [1 16 x x x 6 15 1 10 10 9 4 x 4] [x x x 1 12 x 12 17 x x 13 x x 2] [x x 9 x x x x 17 x x x x 10 11] [7 x 7 12 x x x 2 2 8 10 8 x x] [3 3 x 16 11 x 4 6 x x 4 17 13 16] [4 15 x x x x x x 11 19 16 x x x] [10 5 17 x 2 x x 3 10 3 12 x 8 x] [x 17 12 x x x 6 2 13 x x x x x] [x 10 x x 15 x x x 8 x 3 x x 19] [1 7 x x 16 x x x 3 15 10 12 6 8] [x x x x 9 x x x 7 x x x x 8]
traffic
pathfinding
6
[[9, 10], [8, 10], [7, 10], [6, 10], [6, 9], [6, 8], [6, 7], [5, 7], [4, 7], [3, 7], [3, 6], [3, 5], [2, 5], [2, 4], [2, 3]]
131
0.028569698333740234
15
4
4
[[["x", "10", "16", "12", "x", "x", "x", "x", "18", "18", "10", "x", "x", "19"], ["7", "x", "x", "11", "5", "13", "6", "x", "x", "x", "x", "x", "8", "14"], ["x", "15", "6", "20", "4", "9", "16", "9", "16", "x", "11", "x", "x", "9"], ["1", "16", "x", "x", "x", "6", "15", "1", "10", "10", "9", "4", "x", "4"], ["x", "x", "x", "1", "12", "x", "12", "17", "x", "x", "13", "x", "x", "2"], ["x", "x", "9", "x", "x", "x", "x", "17", "x", "x", "x", "x", "10", "11"], ["7", "x", "7", "12", "x", "x", "x", "2", "2", "8", "10", "8", "x", "x"], ["3", "3", "x", "16", "11", "x", "4", "6", "x", "x", "4", "17", "13", "16"], ["4", "15", "x", "x", "x", "x", "x", "x", "11", "19", "16", "x", "x", "x"], ["10", "5", "17", "x", "2", "x", "x", "3", "10", "3", "12", "x", "8", "x"], ["x", "17", "12", "x", "x", "x", "6", "2", "13", "x", "x", "x", "x", "x"], ["x", "10", "x", "x", "15", "x", "x", "x", "8", "x", "3", "x", "x", "19"], ["1", "7", "x", "x", "16", "x", "x", "x", "3", "15", "10", "12", "6", "8"], ["x", "x", "x", "x", "9", "x", "x", "x", "7", "x", "x", "x", "x", "8"]]]
[[["x", "10", "16", "12", "x", "x", "x", "x", "18", "18", "10", "x", "x", "19"], ["7", "x", "x", "11", "5", "13", "6", "x", "x", "x", "x", "x", "8", "14"], ["x", "15", "6", "20", "4", "9", "16", "9", "16", "x", "11", "x", "x", "9"], ["1", "16", "x", "x", "x", "6", "15", "1", "10", "10", "9", "4", "x", "4"], ["x", "x", "x", "1", "12", "x", "12", "17", "x", "x", "13", "x", "x", "2"], ["x", "x", "9", "x", "x", "x", "x", "17", "x", "x", "x", "x", "10", "11"], ["7", "x", "7", "12", "x", "x", "x", "2", "2", "8", "10", "8", "x", "x"], ["3", "3", "x", "16", "11", "x", "4", "6", "x", "x", "4", "17", "13", "16"], ["4", "15", "x", "x", "x", "x", "x", "x", "11", "19", "16", "x", "x", "x"], ["10", "5", "17", "x", "2", "x", "x", "3", "10", "3", "12", "x", "8", "x"], ["x", "17", "12", "x", "x", "x", "6", "2", "13", "x", "x", "x", "x", "x"], ["x", "10", "x", "x", "15", "x", "x", "x", "8", "x", "3", "x", "x", "19"], ["1", "7", "x", "x", "16", "x", "x", "x", "3", "15", "10", "12", "6", "8"], ["x", "x", "x", "x", "9", "x", "x", "x", "7", "x", "x", "x", "x", "8"]], [9, 10], [2, 3], 2, 8]
["[['x', '10', '16', '12', 'x', 'x', 'x', 'x', '18', '18', '10', 'x', 'x', '19'], ['7', 'x', 'x', '11', '5', '13', '6', 'x', 'x', 'x', 'x', 'x', '8', '14'], ['x', '15', '6', '20', '4', '9', '16', '9', '16', 'x', '11', 'x', 'x', '9'], ['1', '16', 'x', 'x', 'x', '6', '15', '1', '10', '10', '9', '4', 'x', '4'], ['x', 'x', 'x', '1', '12', 'x', '12', '17', 'x', 'x', '13', 'x', 'x', '2'], ['x', 'x', '9', 'x', 'x', 'x', 'x', '17', 'x', 'x', 'x', 'x', '10', '11'], ['7', 'x', '7', '12', 'x', 'x', 'x', '2', '2', '8', '10', '8', 'x', 'x'], ['3', '3', 'x', '16', '11', 'x', '4', '6', 'x', 'x', '4', '17', '13', '16'], ['4', '15', 'x', 'x', 'x', 'x', 'x', 'x', '11', '19', '16', 'x', 'x', 'x'], ['10', '5', '17', 'x', '2', 'x', 'x', '3', '10', '3', '12', 'x', '8', 'x'], ['x', '17', '12', 'x', 'x', 'x', '6', '2', '13', 'x', 'x', 'x', 'x', 'x'], ['x', '10', 'x', 'x', '15', 'x', 'x', 'x', '8', 'x', '3', 'x', 'x', '19'], ['1', '7', 'x', 'x', '16', 'x', 'x', 'x', '3', '15', '10', '12', '6', '8'], ['x', 'x', 'x', 'x', '9', 'x', 'x', 'x', '7', 'x', 'x', 'x', 'x', '8']]", "(9, 10)", "(2, 3)", "2", "8"]
84
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 14x14. 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 (9, 0) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (3, 13). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 1 0 1 1 1 1 0 1 0 1 0 1 1 0 0 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 1 0 0 1 1 0 1 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 1 1 0 1 0 0 0 0 0 0 1 0 0 1 0 1 1 1 0 0 0 0 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 0 1 0 1 1 0 0 0 0 0 0 1 0 1 0 1 1 1 0 0 1 0 1 1 0 0 1 1 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 0 0 1
trampoline_matrix
pathfinding
14
[[9, 0], [8, 1], [7, 2], [6, 3], [5, 4], [5, 5], [5, 6], [4, 6], [3, 6], [3, 7], [3, 8], [3, 9], [4, 9], [4, 10], [4, 11], [4, 12], [4, 13], [3, 13]]
18
0.028172016143798828
18
8
2
["[[0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1], [1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1], [1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1]]", 4]
["[[0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1], [1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1], [1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1]]", [9, 0], [3, 13], 4]
["[[0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1], [1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1], [1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1]]", "(9, 0)", "(3, 13)", "4"]
84
Given 7 labeled water jugs with capacities 82, 91, 135, 11, 12, 19, 143, 60 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 231, 288, 342, 410 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 82, 4], ["+", 91, 4], ["+", 91, 4], ["+", 135, 4], ["+", 11, 4], ["+", 60, 3], ["+", 135, 3], ["+", 12, 3], ["+", 135, 3], ["+", 60, 2], ["+", 82, 2], ["+", 11, 2], ["+", 135, 2], ["+", 91, 1], ["-", 11, 1], ["+", 60, 1], ["+", 91, 1]]
17
0.05072736740112305
17
64
3
[[82, 91, 135, 11, 12, 19, 143, 60], [231, 288, 342, 410]]
[[82, 91, 135, 11, 12, 19, 143, 60], [231, 288, 342, 410]]
["[82, 91, 135, 11, 12, 19, 143, 60]", "[231, 288, 342, 410]"]
85
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, 26, 39, 51, 69], [27, '_', 43, 7, 89], [63, 91, 23, 68, 17]]
8_puzzle
puzzle
8
[26, 39, 51, 7, 43, 23, 91, 26, 27, 63, 26, 91, 23, 27, 91, 23, 27, 51, 39, 91, 51, 43, 89, 17, 68, 27, 43, 89, 17, 68, 27, 17, 7, 39, 89, 43, 17, 7, 39, 69, 68, 27]
42
43.326194763183594
42
4
15
[[[93, 26, 39, 51, 69], [27, "_", 43, 7, 89], [63, 91, 23, 68, 17]]]
[[[93, 26, 39, 51, 69], [27, "_", 43, 7, 89], [63, 91, 23, 68, 17]]]
["[[93, 26, 39, 51, 69], [27, '_', 43, 7, 89], [63, 91, 23, 68, 17]]"]
85
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: snip, scoon, cuber, artie, penta The initial board: [['c', 's', 'n', 'i', 'p'], ['s', 'o', 'o', 'r', 'n'], ['c', 'u', 'i', 'e', '_'], ['a', 'n', 't', 'b', 'e'], ['p', 'e', 'r', 't', 'a']]
8_puzzle_words
puzzle
3
["down-left", "up-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left", "up-right", "down-right", "down-left", "up-left", "down-left", "down-right", "up-right", "down-right", "down-left", "up-left", "up-left", "up-right", "up-left"]
22
1.548938512802124
22
4
25
[[["c", "s", "n", "i", "p"], ["s", "o", "o", "r", "n"], ["c", "u", "i", "e", "_"], ["a", "n", "t", "b", "e"], ["p", "e", "r", "t", "a"]]]
[[["c", "s", "n", "i", "p"], ["s", "o", "o", "r", "n"], ["c", "u", "i", "e", "_"], ["a", "n", "t", "b", "e"], ["p", "e", "r", "t", "a"]], ["snip", "scoon", "cuber", "artie", "penta"]]
["[['c', 's', 'n', 'i', 'p'], ['s', 'o', 'o', 'r', 'n'], ['c', 'u', 'i', 'e', '_'], ['a', 'n', 't', 'b', 'e'], ['p', 'e', 'r', 't', 'a']]", "['snip', 'scoon', 'cuber', 'artie', 'penta']"]
85
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 H and city X excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from X and H, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. I P G S Y A D U E W V H Z X I 0 0 0 1 0 0 0 0 0 0 0 0 0 0 P 0 0 1 1 0 1 1 0 1 0 0 0 1 0 G 1 1 0 0 0 0 0 0 0 1 0 1 0 1 S 0 0 0 0 0 0 1 0 0 0 1 0 0 0 Y 1 0 0 0 0 0 0 0 0 0 0 0 0 0 A 1 0 0 0 1 0 0 0 0 0 0 1 0 0 D 0 0 0 0 0 1 0 0 0 0 0 1 0 0 U 0 0 1 1 0 0 0 0 1 1 0 0 0 0 E 0 0 0 0 0 1 0 1 0 0 0 0 0 0 W 0 0 0 0 0 0 1 0 0 0 0 0 0 1 V 1 1 1 0 0 1 0 0 0 0 0 0 0 1 H 0 0 0 0 1 1 0 0 1 1 1 0 0 0 Z 1 0 0 0 0 1 0 1 1 0 0 0 0 0 X 1 1 1 0 0 0 0 0 1 1 0 0 1 0
city_directed_graph
pathfinding
14
["Y", "I", "S", "D", "H", "V", "X", "W", "X", "G", "H"]
11
0.025726318359375
11
14
17
[[[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1], [0, 0, 0, 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, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 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0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1], [0, 0, 0, 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, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0]]", "['I', 'P', 'G', 'S', 'Y', 'A', 'D', 'U', 'E', 'W', 'V', 'H', 'Z', 'X']", "['Y']", "['H', 'X']"]
85
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [38, 36, 40, 31, 39, 29, 36, 31, 16, 14, 16, 45, 40, 45, 257, 8, 39, 16, 2, 41, 9, 26, 22, 24], such that the sum of the chosen coins adds up to 452. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {9: 6, 14: 9, 24: 8, 26: 12, 16: 6, 45: 14, 8: 3, 22: 8, 38: 9, 40: 14, 31: 9, 257: 11, 36: 2, 2: 1, 41: 6, 29: 6, 39: 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
15
[29, 39, 36, 39, 36, 257, 16]
35
0.03696179389953613
7
24
24
[[38, 36, 40, 31, 39, 29, 36, 31, 16, 14, 16, 45, 40, 45, 257, 8, 39, 16, 2, 41, 9, 26, 22, 24]]
[[38, 36, 40, 31, 39, 29, 36, 31, 16, 14, 16, 45, 40, 45, 257, 8, 39, 16, 2, 41, 9, 26, 22, 24], {"9": 6, "14": 9, "24": 8, "26": 12, "16": 6, "45": 14, "8": 3, "22": 8, "38": 9, "40": 14, "31": 9, "257": 11, "36": 2, "2": 1, "41": 6, "29": 6, "39": 4}, 452]
["[38, 36, 40, 31, 39, 29, 36, 31, 16, 14, 16, 45, 40, 45, 257, 8, 39, 16, 2, 41, 9, 26, 22, 24]", "{9: 6, 14: 9, 24: 8, 26: 12, 16: 6, 45: 14, 8: 3, 22: 8, 38: 9, 40: 14, 31: 9, 257: 11, 36: 2, 2: 1, 41: 6, 29: 6, 39: 4}", "452"]
85
The game of 'Sort It' begins with 3 tubes, each filled with 6 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 9 balls. It is not allowed to place a ball in a tube that already has 9 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Green', 'Red', 'Red', 'Blue', 'Red'], ['Green', 'Blue', 'Green', 'Blue', 'Red', 'Green'], ['Blue', 'Red', 'Green', 'Green', 'Blue', 'Red']]
color_sorting
sorting
10
[[1, 0], [1, 2], [1, 0], [1, 2], [1, 2], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [2, 1], [0, 2], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [1, 2], [1, 2], [1, 2], [1, 0], [1, 2], [0, 1], [0, 2], [0, 1], [0, 1], [0, 1], [2, 0], [2, 0], [1, 2]]
36
402.36865186691284
36
6
18
[[["Blue", "Green", "Red", "Red", "Blue", "Red"], ["Green", "Blue", "Green", "Blue", "Red", "Green"], ["Blue", "Red", "Green", "Green", "Blue", "Red"]], 9]
[[["Blue", "Green", "Red", "Red", "Blue", "Red"], ["Green", "Blue", "Green", "Blue", "Red", "Green"], ["Blue", "Red", "Green", "Green", "Blue", "Red"]], 9]
["[['Blue', 'Green', 'Red', 'Red', 'Blue', 'Red'], ['Green', 'Blue', 'Green', 'Blue', 'Red', 'Green'], ['Blue', 'Red', 'Green', 'Green', 'Blue', 'Red']]", "9"]
85
We have a 4x4 numerical grid, with numbers ranging from 17 to 67 (17 included in the range but 67 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['42' '56' '64' 'x'] ['x' 'x' '55' 'x'] ['30' 'x' 'x' 'x'] ['24' 'x' '45' 'x']]
consecutive_grid
underdetermined_system
14
[[0, 1, 58], [0, 3, 39], [1, 2, 69], [2, 1, 70], [2, 3, 76], [3, 1, 74], [3, 3, 77]]
778
30.918853044509888
7
50
16
["[['71', '', '57', ''], ['67', '68', '', '73'], ['51', '', '72', ''], ['50', '', '75', '']]", 39, 94]
["[['71', '', '57', ''], ['67', '68', '', '73'], ['51', '', '72', ''], ['50', '', '75', '']]", 39, 94]
["[['71', '', '57', ''], ['67', '68', '', '73'], ['51', '', '72', ''], ['50', '', '75', '']]", "39", "94"]
85
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 37 to 83. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 252, 238, None for columns 1 to 2 respectively, and the sums of rows must be None, 221, 257, 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 221. 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' '80' '72'] ['44' 'x' '39' 'x'] ['x' '70' '64' 'x'] ['x' '67' 'x' '42']]
magic_square
underdetermined_system
10
[[0, 0, 37], [0, 1, 38], [1, 1, 77], [1, 3, 61], [2, 0, 41], [2, 3, 82], [3, 0, 40], [3, 2, 55]]
909
0.9668257236480713
8
31
16
["[['', '', '80', '72'], ['44', '', '39', ''], ['', '70', '64', ''], ['', '67', '', '42']]", 4, 37, 83]
["[['', '', '80', '72'], ['44', '', '39', ''], ['', '70', '64', ''], ['', '67', '', '42']]", 37, 83, [1, 3], [1, 3], [252, 238], [221, 257], 221]
["[['', '', '80', '72'], ['44', '', '39', ''], ['', '70', '64', ''], ['', '67', '', '42']]", "37", "83", "[None, 252, 238, None]", "[None, 221, 257, None]", "221"]
85
In 'Restricted Sorting', there are 12 stacks each with a capacity of 7 blocks, with 6 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 6 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: 5, 2: 4, 3: 12, 4: 9, 5: 9, 6: 3, 7: 2, 8: 11, 9: 9, 10: 3, 11: 2}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Pink', 'Red', 'Black', 'Green', 'Yellow', 'Yellow', 'Pink'], [], [], ['Pink', 'White', 'Yellow', 'Blue', 'Green', 'Blue', 'Black'], ['Black', 'Blue', 'Red', 'Pink', 'Yellow', 'Yellow', 'Blue'], [], ['White', 'Black', 'Yellow', 'Green', 'Red', 'Green', 'Green'], [], [], ['Pink', 'Red', 'Black', 'White', 'White', 'Red', 'White'], ['Blue', 'Green', 'Pink', 'Blue', 'White', 'Red', 'Black'], []]
restricted_sorting
sorting
4
[[0, 7], [0, 11], [3, 7], [9, 7], [9, 11], [0, 2], [4, 2], [9, 2], [3, 1], [6, 1], [6, 2], [4, 5], [4, 11], [4, 7], [0, 8], [9, 1], [9, 1], [9, 11], [9, 1], [3, 9], [6, 9], [0, 9], [0, 9], [10, 5], [0, 7], [10, 0], [10, 7], [10, 5], [10, 1], [10, 11], [3, 5], [3, 0], [3, 5], [4, 9], [4, 9], [4, 5], [3, 2], [10, 2], [6, 10], [6, 11], [0, 6], [0, 6], [8, 6], [10, 6]]
228
6.149892091751099
44
132
42
[[["Pink", "Red", "Black", "Green", "Yellow", "Yellow", "Pink"], [], [], ["Pink", "White", "Yellow", "Blue", "Green", "Blue", "Black"], ["Black", "Blue", "Red", "Pink", "Yellow", "Yellow", "Blue"], [], ["White", "Black", "Yellow", "Green", "Red", "Green", "Green"], [], [], ["Pink", "Red", "Black", "White", "White", "Red", "White"], ["Blue", "Green", "Pink", "Blue", "White", "Red", "Black"], []], 7, {"0": 8, "1": 5, "2": 4, "3": 12, "4": 9, "5": 9, "6": 3, "7": 2, "8": 11, "9": 9, "10": 3, "11": 2}]
[[["Pink", "Red", "Black", "Green", "Yellow", "Yellow", "Pink"], [], [], ["Pink", "White", "Yellow", "Blue", "Green", "Blue", "Black"], ["Black", "Blue", "Red", "Pink", "Yellow", "Yellow", "Blue"], [], ["White", "Black", "Yellow", "Green", "Red", "Green", "Green"], [], [], ["Pink", "Red", "Black", "White", "White", "Red", "White"], ["Blue", "Green", "Pink", "Blue", "White", "Red", "Black"], []], 7, {"0": 8, "1": 5, "2": 4, "3": 12, "4": 9, "5": 9, "6": 3, "7": 2, "8": 11, "9": 9, "10": 3, "11": 2}, 6]
["[['Pink', 'Red', 'Black', 'Green', 'Yellow', 'Yellow', 'Pink'], [], [], ['Pink', 'White', 'Yellow', 'Blue', 'Green', 'Blue', 'Black'], ['Black', 'Blue', 'Red', 'Pink', 'Yellow', 'Yellow', 'Blue'], [], ['White', 'Black', 'Yellow', 'Green', 'Red', 'Green', 'Green'], [], [], ['Pink', 'Red', 'Black', 'White', 'White', 'Red', 'White'], ['Blue', 'Green', 'Pink', 'Blue', 'White', 'Red', 'Black'], []]", "{0: 8, 1: 5, 2: 4, 3: 12, 4: 9, 5: 9, 6: 3, 7: 2, 8: 11, 9: 9, 10: 3, 11: 2}", "7", "6"]
85
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 (10, 12) to his destination workshop at index (4, 3), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 4, district 2 covering rows 5 to 9, and district 3 covering rows 10 to 13. 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 10 x x x 16 x x x 16 x 10 8 x] [1 x 13 x 7 x x x 10 3 3 13 18 11] [14 x x x 9 16 16 15 x x 15 x 4 4] [15 x 3 x x 17 x 16 10 9 x 6 16 17] [12 8 x 10 x x 13 10 x x 6 3 x 1] [x x x 5 8 9 6 14 1 x x 2 12 x] [13 x x x 16 6 x 17 12 18 x 17 8 x] [10 x 14 15 x x x 20 x 17 18 8 x 4] [x 11 3 x x x x 7 x 4 x x 11 2] [7 x x 10 x 19 x 7 17 x x 14 x 15] [12 11 x x 9 7 x 15 1 5 5 11 15 x] [x 9 9 x x x x 8 x 8 19 11 12 12] [x 17 5 x x 17 x x 12 x 15 12 10 x] [18 x x x 3 x 7 x 8 5 12 8 10 x]
traffic
pathfinding
6
[[10, 12], [10, 11], [10, 10], [10, 9], [10, 8], [10, 7], [9, 7], [8, 7], [7, 7], [6, 7], [5, 7], [5, 6], [5, 5], [5, 4], [5, 3], [4, 3]]
140
0.026478052139282227
16
4
4
[[["5", "10", "x", "x", "x", "16", "x", "x", "x", "16", "x", "10", "8", "x"], ["1", "x", "13", "x", "7", "x", "x", "x", "10", "3", "3", "13", "18", "11"], ["14", "x", "x", "x", "9", "16", "16", "15", "x", "x", "15", "x", "4", "4"], ["15", "x", "3", "x", "x", "17", "x", "16", "10", "9", "x", "6", "16", "17"], ["12", "8", "x", "10", "x", "x", "13", "10", "x", "x", "6", "3", "x", "1"], ["x", "x", "x", "5", "8", "9", "6", "14", "1", "x", "x", "2", "12", "x"], ["13", "x", "x", "x", "16", "6", "x", "17", "12", "18", "x", "17", "8", "x"], ["10", "x", "14", "15", "x", "x", "x", "20", "x", "17", "18", "8", "x", "4"], ["x", "11", "3", "x", "x", "x", "x", "7", "x", "4", "x", "x", "11", "2"], ["7", "x", "x", "10", "x", "19", "x", "7", "17", "x", "x", "14", "x", "15"], ["12", "11", "x", "x", "9", "7", "x", "15", "1", "5", "5", "11", "15", "x"], ["x", "9", "9", "x", "x", "x", "x", "8", "x", "8", "19", "11", "12", "12"], ["x", "17", "5", "x", "x", "17", "x", "x", "12", "x", "15", "12", "10", "x"], ["18", "x", "x", "x", "3", "x", "7", "x", "8", "5", "12", "8", "10", "x"]]]
[[["5", "10", "x", "x", "x", "16", "x", "x", "x", "16", "x", "10", "8", "x"], ["1", "x", "13", "x", "7", "x", "x", "x", "10", "3", "3", "13", "18", "11"], ["14", "x", "x", "x", "9", "16", "16", "15", "x", "x", "15", "x", "4", "4"], ["15", "x", "3", "x", "x", "17", "x", "16", "10", "9", "x", "6", "16", "17"], ["12", "8", "x", "10", "x", "x", "13", "10", "x", "x", "6", "3", "x", "1"], ["x", "x", "x", "5", "8", "9", "6", "14", "1", "x", "x", "2", "12", "x"], ["13", "x", "x", "x", "16", "6", "x", "17", "12", "18", "x", "17", "8", "x"], ["10", "x", "14", "15", "x", "x", "x", "20", "x", "17", "18", "8", "x", "4"], ["x", "11", "3", "x", "x", "x", "x", "7", "x", "4", "x", "x", "11", "2"], ["7", "x", "x", "10", "x", "19", "x", "7", "17", "x", "x", "14", "x", "15"], ["12", "11", "x", "x", "9", "7", "x", "15", "1", "5", "5", "11", "15", "x"], ["x", "9", "9", "x", "x", "x", "x", "8", "x", "8", "19", "11", "12", "12"], ["x", "17", "5", "x", "x", "17", "x", "x", "12", "x", "15", "12", "10", "x"], ["18", "x", "x", "x", "3", "x", "7", "x", "8", "5", "12", "8", "10", "x"]], [10, 12], [4, 3], 4, 9]
["[['5', '10', 'x', 'x', 'x', '16', 'x', 'x', 'x', '16', 'x', '10', '8', 'x'], ['1', 'x', '13', 'x', '7', 'x', 'x', 'x', '10', '3', '3', '13', '18', '11'], ['14', 'x', 'x', 'x', '9', '16', '16', '15', 'x', 'x', '15', 'x', '4', '4'], ['15', 'x', '3', 'x', 'x', '17', 'x', '16', '10', '9', 'x', '6', '16', '17'], ['12', '8', 'x', '10', 'x', 'x', '13', '10', 'x', 'x', '6', '3', 'x', '1'], ['x', 'x', 'x', '5', '8', '9', '6', '14', '1', 'x', 'x', '2', '12', 'x'], ['13', 'x', 'x', 'x', '16', '6', 'x', '17', '12', '18', 'x', '17', '8', 'x'], ['10', 'x', '14', '15', 'x', 'x', 'x', '20', 'x', '17', '18', '8', 'x', '4'], ['x', '11', '3', 'x', 'x', 'x', 'x', '7', 'x', '4', 'x', 'x', '11', '2'], ['7', 'x', 'x', '10', 'x', '19', 'x', '7', '17', 'x', 'x', '14', 'x', '15'], ['12', '11', 'x', 'x', '9', '7', 'x', '15', '1', '5', '5', '11', '15', 'x'], ['x', '9', '9', 'x', 'x', 'x', 'x', '8', 'x', '8', '19', '11', '12', '12'], ['x', '17', '5', 'x', 'x', '17', 'x', 'x', '12', 'x', '15', '12', '10', 'x'], ['18', 'x', 'x', 'x', '3', 'x', '7', 'x', '8', '5', '12', '8', '10', 'x']]", "(10, 12)", "(4, 3)", "4", "9"]
85
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 14x14. 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, 3) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (12, 11). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 1 1 0 1 0 1 0 1 1 1 0 0 1 0 0 0 0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1 1 0 1 0 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 0 1 1 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 1 0 0 1 1 0 0 1 1 1 0 1 0 0 1 0 0 0 1 1 0 1 0 1 0 0 1 1 1 0 1 0 0 0 1 1 1 1 0 1 1
trampoline_matrix
pathfinding
14
[[1, 3], [2, 3], [3, 3], [4, 4], [5, 4], [5, 5], [5, 6], [5, 7], [6, 8], [6, 9], [7, 10], [8, 10], [9, 10], [10, 10], [11, 11], [12, 11]]
16
0.030063152313232422
16
8
2
["[[0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1], [0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0], [1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0], [1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1]]", 4]
["[[0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1], [0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1], [1, 0, 0,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 66, 59, 37, 61, 128, 92 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 308, 309, 387, 433 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 59, 4], ["+", 128, 4], ["+", 128, 4], ["+", 59, 4], ["+", 59, 4], ["+", 98, 3], ["+", 128, 3], ["+", 128, 3], ["-", 59, 3], ["+", 92, 3], ["+", 59, 2], ["+", 92, 2], ["+", 92, 2], ["+", 66, 2], ["+", 59, 1], ["+", 92, 1], ["+", 98, 1], ["+", 59, 1]]
18
0.08887290954589844
18
64
3
[[67, 98, 66, 59, 37, 61, 128, 92], [308, 309, 387, 433]]
[[67, 98, 66, 59, 37, 61, 128, 92], [308, 309, 387, 433]]
["[67, 98, 66, 59, 37, 61, 128, 92]", "[308, 309, 387, 433]"]
86
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[88, 71, 83, 72, 37], [98, 43, 53, '_', 82], [24, 20, 54, 14, 21]]
8_puzzle
puzzle
8
[82, 21, 14, 82, 21, 37, 72, 83, 53, 43, 20, 54, 43, 21, 82, 43, 21, 20, 71, 88, 98, 71, 54, 21, 20, 53, 83, 82, 43, 14]
30
1.5921499729156494
30
4
15
[[[88, 71, 83, 72, 37], [98, 43, 53, "_", 82], [24, 20, 54, 14, 21]]]
[[[88, 71, 83, 72, 37], [98, 43, 53, "_", 82], [24, 20, 54, 14, 21]]]
["[[88, 71, 83, 72, 37], [98, 43, 53, '_', 82], [24, 20, 54, 14, 21]]"]
86
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: card, sylva, shune, solum, bichy The initial board: [['y', 'c', 'a', 'r', 'd'], ['s', 'u', 'l', 'c', 'a'], ['v', 'h', '_', 'n', 'o'], ['s', 'e', 'l', 's', 'm'], ['b', 'i', 'u', 'h', 'y']]
8_puzzle_words
puzzle
3
["down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "down-left", "up-left", "up-right", "down-right", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left", "down-left", "down-right", "down-right", "up-right", "up-left", "up-left", "up-left"]
24
0.686600923538208
24
4
25
[[["y", "c", "a", "r", "d"], ["s", "u", "l", "c", "a"], ["v", "h", "_", "n", "o"], ["s", "e", "l", "s", "m"], ["b", "i", "u", "h", "y"]]]
[[["y", "c", "a", "r", "d"], ["s", "u", "l", "c", "a"], ["v", "h", "_", "n", "o"], ["s", "e", "l", "s", "m"], ["b", "i", "u", "h", "y"]], ["card", "sylva", "shune", "solum", "bichy"]]
["[['y', 'c', 'a', 'r', 'd'], ['s', 'u', 'l', 'c', 'a'], ['v', 'h', '_', 'n', 'o'], ['s', 'e', 'l', 's', 'm'], ['b', 'i', 'u', 'h', 'y']]", "['card', 'sylva', 'shune', 'solum', 'bichy']"]
86
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'G'. Our task is to visit city P and city 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 P, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. P U Q G E K M J N T Y R Z X O P 0 0 0 0 0 0 0 1 1 1 0 1 0 1 0 U 1 0 0 0 1 0 0 1 0 0 1 1 0 1 0 Q 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 E 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 K 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 M 0 0 1 0 0 1 0 1 0 0 0 0 1 0 1 J 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 N 0 1 0 1 0 1 0 0 0 0 1 0 1 0 0 T 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 Y 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 R 0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 Z 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 X 1 0 0 1 1 0 0 1 0 0 1 1 1 0 0 O 1 0 0 0 0 0 0 0 1 1 0 0 1 1 0
city_directed_graph
pathfinding
15
["G", "O", "P", "N", "Y", "Z", "P", "T", "Y"]
9
0.05178332328796387
9
15
18
[[[0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0], [1, 0, 0, 0, 1, 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, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1], [0, 0, 1, 1, 0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xed coin exchange' problem, you are required to choose a subset of coins from this list [31, 8, 22, 27, 2, 25, 2, 8, 49, 26, 65, 6, 37, 49, 15, 21, 27, 5, 34, 28, 47, 15, 7, 42, 32, 20, 34, 48, 39, 7, 13], such that the sum of the chosen coins adds up to 490. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {7: 1, 65: 16, 21: 18, 25: 18, 15: 14, 31: 15, 6: 2, 37: 2, 5: 1, 22: 1, 8: 7, 26: 2, 2: 1, 32: 8, 27: 2, 13: 8, 39: 17, 28: 11, 47: 6, 42: 10, 34: 15, 20: 8, 48: 11, 49: 13}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
16
[7, 7, 27, 37, 22, 27, 2, 5, 47, 42, 26, 2, 65, 48, 49, 49, 28]
94
0.05118918418884277
17
31
31
[[31, 8, 22, 27, 2, 25, 2, 8, 49, 26, 65, 6, 37, 49, 15, 21, 27, 5, 34, 28, 47, 15, 7, 42, 32, 20, 34, 48, 39, 7, 13]]
[[31, 8, 22, 27, 2, 25, 2, 8, 49, 26, 65, 6, 37, 49, 15, 21, 27, 5, 34, 28, 47, 15, 7, 42, 32, 20, 34, 48, 39, 7, 13], {"7": 1, "65": 16, "21": 18, "25": 18, "15": 14, "31": 15, "6": 2, "37": 2, "5": 1, "22": 1, "8": 7, "26": 2, "2": 1, "32": 8, "27": 2, "13": 8, "39": 17, "28": 11, "47": 6, "42": 10, "34": 15, "20": 8, "48": 11, "49": 13}, 490]
["[31, 8, 22, 27, 2, 25, 2, 8, 49, 26, 65, 6, 37, 49, 15, 21, 27, 5, 34, 28, 47, 15, 7, 42, 32, 20, 34, 48, 39, 7, 13]", "{7: 1, 65: 16, 21: 18, 25: 18, 15: 14, 31: 15, 6: 2, 37: 2, 5: 1, 22: 1, 8: 7, 26: 2, 2: 1, 32: 8, 27: 2, 13: 8, 39: 17, 28: 11, 47: 6, 42: 10, 34: 15, 20: 8, 48: 11, 49: 13}", "490"]
86
The game of 'Sort It' begins with 3 tubes, each filled with 6 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 9 balls. It is not allowed to place a ball in a tube that already has 9 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Red', 'Blue', 'Red', 'Blue', 'Green'], ['Green', 'Red', 'Green', 'Green', 'Blue', 'Blue'], ['Red', 'Green', 'Blue', 'Red', 'Blue', 'Green']]
color_sorting
sorting
10
[[0, 1], [0, 1], [0, 2], [0, 1], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [2, 0], [2, 1], [2, 1], [2, 1], [2, 0], [2, 1], [2, 1], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [0, 1], [0, 2], [1, 0], [1, 2], [1, 0], [1, 2], [1, 0], [2, 1], [2, 1]]
34
154.73638343811035
34
6
18
[[["Red", "Red", "Blue", "Red", "Blue", "Green"], ["Green", "Red", "Green", "Green", "Blue", "Blue"], ["Red", "Green", "Blue", "Red", "Blue", "Green"]], 9]
[[["Red", "Red", "Blue", "Red", "Blue", "Green"], ["Green", "Red", "Green", "Green", "Blue", "Blue"], ["Red", "Green", "Blue", "Red", "Blue", "Green"]], 9]
["[['Red', 'Red', 'Blue', 'Red', 'Blue', 'Green'], ['Green', 'Red', 'Green', 'Green', 'Blue', 'Blue'], ['Red', 'Green', 'Blue', 'Red', 'Blue', 'Green']]", "9"]
86
We have a 4x4 numerical grid, with numbers ranging from 6 to 56 (6 included in the range but 56 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > 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' '54'] ['x' 'x' '44' '53'] ['x' '17' 'x' 'x'] ['18' '22' '36' 'x']]
consecutive_grid
underdetermined_system
14
[[0, 2, 29], [0, 3, 28], [1, 0, 43], [1, 3, 55], [2, 1, 44], [3, 0, 30], [3, 1, 31]]
686
0.6507663726806641
7
50
16
["[['81', '52', '', ''], ['', '50', '53', ''], ['42', '', '54', '74'], ['', '', '56', '77']]", 28, 83]
["[['81', '52', '', ''], ['', '50', '53', ''], ['42', '', '54', '74'], ['', '', '56', '77']]", 28, 83]
["[['81', '52', '', ''], ['', '50', '53', ''], ['42', '', '54', '74'], ['', '', '56', '77']]", "28", "83"]
86
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 37 to 83. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 214, 240, None for columns 1 to 2 respectively, and the sums of rows must be None, 213, 197, 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 215. 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' '48' '64' '67'] ['x' '50' '61' 'x'] ['42' 'x' 'x' '74'] ['x' 'x' '72' 'x']]
magic_square
underdetermined_system
10
[[0, 0, 37], [1, 0, 40], [1, 3, 62], [2, 1, 38], [2, 2, 43], [3, 0, 49], [3, 1, 78], [3, 3, 39]]
864
4.137092590332031
8
31
16
["[['', '48', '64', '67'], ['', '50', '61', ''], ['42', '', '', '74'], ['', '', '72', '']]", 4, 37, 83]
["[['', '48', '64', '67'], ['', '50', '61', ''], ['42', '', '', '74'], ['', '', '72', '']]", 37, 83, [1, 3], [1, 3], [214, 240], [213, 197], 215]
["[['', '48', '64', '67'], ['', '50', '61', ''], ['42', '', '', '74'], ['', '', '72', '']]", "37", "83", "[None, 214, 240, None]", "[None, 213, 197, None]", "215"]
86
In 'Restricted Sorting', there are 12 stacks each with a capacity of 7 blocks, with 6 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 6 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: 10, 1: 7, 2: 7, 3: 7, 4: 9, 5: 3, 6: 8, 7: 5, 8: 4, 9: 10, 10: 7, 11: 7}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Black', 'Black', 'Yellow', 'Blue', 'Black', 'Black', 'Green'], [], ['Blue', 'Yellow', 'Green', 'Black', 'White', 'White', 'Blue'], ['Red', 'White', 'Pink', 'White', 'Pink', 'Green', 'Pink'], ['Green', 'Blue', 'Black', 'Green', 'Red', 'Green', 'Yellow'], [], [], ['Red', 'White', 'Blue', 'Yellow', 'Blue', 'White', 'Red'], ['Yellow', 'Yellow', 'Red', 'Pink', 'Red', 'Pink', 'Pink'], [], [], []]
restricted_sorting
sorting
4
[[3, 5], [7, 5], [2, 1], [2, 10], [2, 11], [8, 10], [8, 10], [8, 5], [3, 6], [7, 6], [2, 9], [4, 11], [4, 1], [4, 9], [4, 11], [4, 5], [4, 11], [7, 1], [7, 10], [7, 1], [7, 6], [7, 5], [8, 7], [8, 5], [3, 8], [3, 6], [7, 8], [0, 7], [0, 7], [0, 10], [0, 1], [0, 7], [0, 7], [3, 8], [3, 11], [2, 6], [2, 6], [0, 11], [2, 1], [4, 10], [9, 7], [9, 7], [3, 8]]
263
3.3329944610595703
43
132
42
[[["Black", "Black", "Yellow", "Blue", "Black", "Black", "Green"], [], ["Blue", "Yellow", "Green", "Black", "White", "White", "Blue"], ["Red", "White", "Pink", "White", "Pink", "Green", "Pink"], ["Green", "Blue", "Black", "Green", "Red", "Green", "Yellow"], [], [], ["Red", "White", "Blue", "Yellow", "Blue", "White", "Red"], ["Yellow", "Yellow", "Red", "Pink", "Red", "Pink", "Pink"], [], [], []], 7, {"0": 10, "1": 7, "2": 7, "3": 7, "4": 9, "5": 3, "6": 8, "7": 5, "8": 4, "9": 10, "10": 7, "11": 7}]
[[["Black", "Black", "Yellow", "Blue", "Black", "Black", "Green"], [], ["Blue", "Yellow", "Green", "Black", "White", "White", "Blue"], ["Red", "White", "Pink", "White", "Pink", "Green", "Pink"], ["Green", "Blue", "Black", "Green", "Red", "Green", "Yellow"], [], [], ["Red", "White", "Blue", "Yellow", "Blue", "White", "Red"], ["Yellow", "Yellow", "Red", "Pink", "Red", "Pink", "Pink"], [], [], []], 7, {"0": 10, "1": 7, "2": 7, "3": 7, "4": 9, "5": 3, "6": 8, "7": 5, "8": 4, "9": 10, "10": 7, "11": 7}, 6]
["[['Black', 'Black', 'Yellow', 'Blue', 'Black', 'Black', 'Green'], [], ['Blue', 'Yellow', 'Green', 'Black', 'White', 'White', 'Blue'], ['Red', 'White', 'Pink', 'White', 'Pink', 'Green', 'Pink'], ['Green', 'Blue', 'Black', 'Green', 'Red', 'Green', 'Yellow'], [], [], ['Red', 'White', 'Blue', 'Yellow', 'Blue', 'White', 'Red'], ['Yellow', 'Yellow', 'Red', 'Pink', 'Red', 'Pink', 'Pink'], [], [], []]", "{0: 10, 1: 7, 2: 7, 3: 7, 4: 9, 5: 3, 6: 8, 7: 5, 8: 4, 9: 10, 10: 7, 11: 7}", "7", "6"]
86
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 (5, 12), 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 13. 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 11 16 x x x x 4 x 14 5 x x] [3 1 13 x x 14 11 x x 15 12 15 x x] [17 15 17 10 11 x 7 1 1 14 x 9 x x] [8 x x 13 2 12 x 8 x x 9 13 19 5] [4 x 2 3 8 x x 17 x x 16 10 x x] [x x x x 3 13 14 16 18 11 4 19 20 x] [x 11 x x 3 10 8 9 18 7 1 14 x 6] [11 x 12 11 x 11 10 3 10 12 15 x 11 x] [x x 4 18 x x 13 x 14 10 x 8 x 17] [x x x x x x x 7 7 x x 18 19 18] [19 4 x 2 14 2 x 9 x 10 7 17 4 12] [13 2 x x 18 5 x 11 x x x 18 x x] [x x 13 1 13 x 2 x x x x x x 14] [x 12 x x x x x x x 19 x x 9 1]
traffic
pathfinding
6
[[3, 0], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [3, 4], [4, 4], [5, 4], [6, 4], [6, 5], [6, 6], [6, 7], [7, 7], [7, 8], [7, 9], [6, 9], [6, 10], [5, 10], [5, 11], [5, 12]]
189
0.02854442596435547
21
4
4
[[["x", "x", "11", "16", "x", "x", "x", "x", "4", "x", "14", "5", "x", "x"], ["3", "1", "13", "x", "x", "14", "11", "x", "x", "15", "12", "15", "x", "x"], ["17", "15", "17", "10", "11", "x", "7", "1", "1", "14", "x", "9", "x", "x"], ["8", "x", "x", "13", "2", "12", "x", "8", "x", "x", "9", "13", "19", "5"], ["4", "x", "2", "3", "8", "x", "x", "17", "x", "x", "16", "10", "x", "x"], ["x", "x", "x", "x", "3", "13", "14", "16", "18", "11", "4", "19", "20", "x"], ["x", "11", "x", "x", "3", "10", "8", "9", "18", "7", "1", "14", "x", "6"], ["11", "x", "12", "11", "x", "11", "10", "3", "10", "12", "15", "x", "11", "x"], ["x", "x", "4", "18", "x", "x", "13", "x", "14", "10", "x", "8", "x", "17"], ["x", "x", "x", "x", "x", "x", "x", "7", "7", "x", "x", "18", "19", "18"], ["19", "4", "x", "2", "14", "2", "x", "9", "x", "10", "7", "17", "4", "12"], ["13", "2", "x", "x", "18", "5", "x", "11", "x", "x", "x", "18", "x", "x"], ["x", "x", "13", "1", "13", "x", "2", "x", "x", "x", "x", "x", "x", "14"], ["x", "12", "x", "x", "x", "x", "x", "x", "x", "19", "x", "x", "9", "1"]]]
[[["x", "x", "11", "16", "x", "x", "x", "x", "4", "x", "14", "5", "x", "x"], ["3", "1", "13", "x", "x", "14", "11", "x", "x", "15", "12", "15", "x", "x"], ["17", "15", "17", "10", "11", "x", "7", "1", "1", "14", "x", "9", "x", "x"], ["8", "x", "x", "13", "2", "12", "x", "8", "x", "x", "9", "13", "19", "5"], ["4", "x", "2", "3", "8", "x", "x", "17", "x", "x", "16", "10", "x", "x"], ["x", "x", "x", "x", "3", "13", "14", "16", "18", "11", "4", "19", "20", "x"], ["x", "11", "x", "x", "3", "10", "8", "9", "18", "7", "1", "14", "x", "6"], ["11", "x", "12", "11", "x", "11", "10", "3", "10", "12", "15", "x", "11", "x"], ["x", "x", "4", "18", "x", "x", "13", "x", "14", "10", "x", "8", "x", "17"], ["x", "x", "x", "x", "x", "x", "x", "7", "7", "x", "x", "18", "19", "18"], ["19", "4", "x", "2", "14", "2", "x", "9", "x", "10", "7", "17", "4", "12"], ["13", "2", "x", "x", "18", "5", "x", "11", "x", "x", "x", "18", "x", "x"], ["x", "x", "13", "1", "13", "x", "2", "x", "x", "x", "x", "x", "x", "14"], ["x", "12", "x", "x", "x", "x", "x", "x", "x", "19", "x", "x", "9", "1"]], [3, 0], [5, 12], 3, 6]
["[['x', 'x', '11', '16', 'x', 'x', 'x', 'x', '4', 'x', '14', '5', 'x', 'x'], ['3', '1', '13', 'x', 'x', '14', '11', 'x', 'x', '15', '12', '15', 'x', 'x'], ['17', '15', '17', '10', '11', 'x', '7', '1', '1', '14', 'x', '9', 'x', 'x'], ['8', 'x', 'x', '13', '2', '12', 'x', '8', 'x', 'x', '9', '13', '19', '5'], ['4', 'x', '2', '3', '8', 'x', 'x', '17', 'x', 'x', '16', '10', 'x', 'x'], ['x', 'x', 'x', 'x', '3', '13', '14', '16', '18', '11', '4', '19', '20', 'x'], ['x', '11', 'x', 'x', '3', '10', '8', '9', '18', '7', '1', '14', 'x', '6'], ['11', 'x', '12', '11', 'x', '11', '10', '3', '10', '12', '15', 'x', '11', 'x'], ['x', 'x', '4', '18', 'x', 'x', '13', 'x', '14', '10', 'x', '8', 'x', '17'], ['x', 'x', 'x', 'x', 'x', 'x', 'x', '7', '7', 'x', 'x', '18', '19', '18'], ['19', '4', 'x', '2', '14', '2', 'x', '9', 'x', '10', '7', '17', '4', '12'], ['13', '2', 'x', 'x', '18', '5', 'x', '11', 'x', 'x', 'x', '18', 'x', 'x'], ['x', 'x', '13', '1', '13', 'x', '2', 'x', 'x', 'x', 'x', 'x', 'x', '14'], ['x', '12', 'x', 'x', 'x', 'x', 'x', 'x', 'x', '19', 'x', 'x', '9', '1']]", "(3, 0)", "(5, 12)", "3", "6"]
86
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 14x14. 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, 4) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (13, 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. 0 1 1 1 0 0 0 0 0 0 1 1 0 1 0 1 1 0 1 1 1 0 0 0 1 0 0 1 0 0 1 1 0 1 1 0 1 0 0 0 1 1 1 1 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 1 1 0 0 1 1 0 0 1 1 1 1 1 0 1 0 1 0 0 0 1 0 0 0 1 1 1 1 1 1 0 0 1 1 1 0 0 1 0 1 1 0 1 1 0 1 0 0 1 1 0 1 1 0 1 0 0 1 1 1 1 0 1 0 0 1 0 1 0 1 1 0 0 1 0 1 1 0 0 1 0 0 0 1 1 1 1 1 1 1 0 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0 0 0 1 0 0 1 1 1 1 0 1 0 0 0 0
trampoline_matrix
pathfinding
14
[[0, 4], [0, 5], [0, 6], [0, 7], [1, 7], [1, 8], [1, 9], [2, 9], [2, 10], [3, 11], [4, 11], [5, 12], [6, 12], [7, 13], [8, 13], [9, 13], [10, 13], [11, 13], [12, 13], [13, 12]]
20
0.022798776626586914
20
8
2
["[[0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1], [0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1], [1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1],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[13, 12], 4]
["[[0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1], [0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1], [1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1], [1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0], [1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0], [1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0], [1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], [1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0], [0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0]]", "(0, 4)", "(13, 12)", "4"]
86
Given 7 labeled water jugs with capacities 87, 13, 27, 106, 18, 91, 17, 138 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 205, 365, 391, 414 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 138, 4], ["+", 138, 4], ["+", 138, 4], ["+", 106, 3], ["+", 138, 3], ["+", 138, 3], ["-", 18, 3], ["+", 27, 3], ["+", 138, 2], ["+", 138, 2], ["-", 17, 2], ["+", 106, 2], ["+", 87, 1], ["+", 91, 1], ["+", 27, 1]]
15
0.04750704765319824
15
64
3
[[87, 13, 27, 106, 18, 91, 17, 138], [205, 365, 391, 414]]
[[87, 13, 27, 106, 18, 91, 17, 138], [205, 365, 391, 414]]
["[87, 13, 27, 106, 18, 91, 17, 138]", "[205, 365, 391, 414]"]
87
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, 43, 58, 77], [96, 100, 75, 84, 52], [50, 29, 60, 27, 74]]
8_puzzle
puzzle
8
[96, 100, 75, 43, 58, 84, 27, 74, 52, 77, 84, 58, 94, 96, 100, 75, 43, 60, 74, 27, 60, 74, 29, 43, 74, 60, 58, 84, 77, 52]
30
0.9509561061859131
30
4
15
[[["_", 94, 43, 58, 77], [96, 100, 75, 84, 52], [50, 29, 60, 27, 74]]]
[[["_", 94, 43, 58, 77], [96, 100, 75, 84, 52], [50, 29, 60, 27, 74]]]
["[['_', 94, 43, 58, 77], [96, 100, 75, 84, 52], [50, 29, 60, 27, 74]]"]
87
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: echo, metin, perch, tulip, mulga The initial board: [['e', 'e', 'l', 'h', 'o'], ['m', 'r', 't', 'u', 'n'], ['p', 'e', '_', 'c', 'i'], ['t', 'c', 'l', 'h', 'p'], ['m', 'u', 'i', 'g', 'a']]
8_puzzle_words
puzzle
3
["down-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "down-left", "up-left", "up-right", "up-right", "down-right", "down-left", "up-left", "down-left", "down-right", "up-right", "down-right", "down-left", "up-left", "up-right", "up-left", "up-left"]
26
3.2265894412994385
26
4
25
[[["e", "e", "l", "h", "o"], ["m", "r", "t", "u", "n"], ["p", "e", "_", "c", "i"], ["t", "c", "l", "h", "p"], ["m", "u", "i", "g", "a"]]]
[[["e", "e", "l", "h", "o"], ["m", "r", "t", "u", "n"], ["p", "e", "_", "c", "i"], ["t", "c", "l", "h", "p"], ["m", "u", "i", "g", "a"]], ["echo", "metin", "perch", "tulip", "mulga"]]
["[['e', 'e', 'l', 'h', 'o'], ['m', 'r', 't', 'u', 'n'], ['p', 'e', '_', 'c', 'i'], ['t', 'c', 'l', 'h', 'p'], ['m', 'u', 'i', 'g', 'a']]", "['echo', 'metin', 'perch', 'tulip', 'mulga']"]
87
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'E'. Our task is to visit city A and city P excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from P and A, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. A P Z O R I L X E T W D S G Q A 0 0 1 1 0 0 0 0 1 1 0 0 0 1 0 P 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 Z 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 O 1 0 0 0 0 1 0 0 0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 0, 0, 1, 1, 0, 1, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0]], ["A", "P", "Z", "O", "R", "I", "L", "X", "E", "T", "W", "D", "S", "G", "Q"], "A", "P"]
[[[0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0]], ["A", "P", "Z", "O", "R", "I", "L", "X", "E", "T", "W", "D", "S", "G", "Q"], "E", "A", "P"]
["[[0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1], [1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0]]", "['A', 'P', 'Z', 'O', 'R', 'I', 'L', 'X', 'E', 'T', 'W', 'D', 'S', 'G', 'Q']", "['E']", "['A', 'P']"]
87
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [25, 41, 34, 19, 19, 36, 37, 13, 28, 26, 181, 7, 14, 6, 29, 36, 33, 7, 8, 43, 19, 9, 3, 2, 18, 40, 43, 22, 23, 21], such that the sum of the chosen coins adds up to 449. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {21: 5, 26: 13, 36: 8, 28: 8, 34: 12, 3: 2, 6: 2, 23: 10, 2: 2, 9: 5, 41: 4, 29: 19, 7: 6, 18: 18, 43: 2, 8: 7, 181: 9, 25: 10, 33: 8, 14: 13, 13: 1, 22: 13, 40: 7, 37: 11, 19: 11}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
17
[13, 21, 41, 43, 181, 40, 43, 6, 33, 28]
48
0.04537367820739746
10
30
30
[[25, 41, 34, 19, 19, 36, 37, 13, 28, 26, 181, 7, 14, 6, 29, 36, 33, 7, 8, 43, 19, 9, 3, 2, 18, 40, 43, 22, 23, 21]]
[[25, 41, 34, 19, 19, 36, 37, 13, 28, 26, 181, 7, 14, 6, 29, 36, 33, 7, 8, 43, 19, 9, 3, 2, 18, 40, 43, 22, 23, 21], {"21": 5, "26": 13, "36": 8, "28": 8, "34": 12, "3": 2, "6": 2, "23": 10, "2": 2, "9": 5, "41": 4, "29": 19, "7": 6, "18": 18, "43": 2, "8": 7, "181": 9, "25": 10, "33": 8, "14": 13, "13": 1, "22": 13, "40": 7, "37": 11, "19": 11}, 449]
["[25, 41, 34, 19, 19, 36, 37, 13, 28, 26, 181, 7, 14, 6, 29, 36, 33, 7, 8, 43, 19, 9, 3, 2, 18, 40, 43, 22, 23, 21]", "{21: 5, 26: 13, 36: 8, 28: 8, 34: 12, 3: 2, 6: 2, 23: 10, 2: 2, 9: 5, 41: 4, 29: 19, 7: 6, 18: 18, 43: 2, 8: 7, 181: 9, 25: 10, 33: 8, 14: 13, 13: 1, 22: 13, 40: 7, 37: 11, 19: 11}", "449"]
87
The game of 'Sort It' begins with 3 tubes, each filled with 6 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 9 balls. It is not allowed to place a ball in a tube that already has 9 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Green', 'Red', 'Red', 'Blue', 'Green'], ['Blue', 'Red', 'Green', 'Green', 'Green', 'Red'], ['Blue', 'Blue', 'Blue', 'Red', 'Red', 'Green']]
color_sorting
sorting
10
[[0, 2], [1, 2], [0, 2], [0, 1], [0, 1], [2, 1], [0, 2], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [1, 2], [1, 0], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [0, 1], [0, 1], [0, 1], [2, 0], [2, 0], [2, 0], [2, 1], [2, 1], [0, 2], [0, 2], [0, 2]]
35
125.82809782028198
35
6
18
[[["Blue", "Green", "Red", "Red", "Blue", "Green"], ["Blue", "Red", "Green", "Green", "Green", "Red"], ["Blue", "Blue", "Blue", "Red", "Red", "Green"]], 9]
[[["Blue", "Green", "Red", "Red", "Blue", "Green"], ["Blue", "Red", "Green", "Green", "Green", "Red"], ["Blue", "Blue", "Blue", "Red", "Red", "Green"]], 9]
["[['Blue', 'Green', 'Red', 'Red', 'Blue', 'Green'], ['Blue', 'Red', 'Green', 'Green', 'Green', 'Red'], ['Blue', 'Blue', 'Blue', 'Red', 'Red', 'Green']]", "9"]
87
We have a 4x4 numerical grid, with numbers ranging from 14 to 64 (14 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' '33' 'x' '54'] ['x' '39' '51' '58'] ['41' '48' 'x' 'x'] ['x' 'x' 'x' 'x']]
consecutive_grid
underdetermined_system
14
[[0, 0, 17], [0, 2, 39], [1, 0, 18], [1, 1, 40], [1, 3, 57], [2, 0, 19], [2, 1, 41], [3, 0, 20]]
580
30.668219327926636
8
50
16
["[['', '38', '', '56'], ['', '', '55', ''], ['', '', '61', '65'], ['', '59', '64', '67']]", 17, 72]
["[['', '38', '', '56'], ['', '', '55', ''], ['', '', '61', '65'], ['', '59', '64', '67']]", 17, 72]
["[['', '38', '', '56'], ['', '', '55', ''], ['', '', '61', '65'], ['', '59', '64', '67']]", "17", "72"]
87
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 37 to 83. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 258, 247, None for columns 1 to 2 respectively, and the sums of rows must be None, 233, 237, 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 242. 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: [['72' '76' '68' '69'] ['56' 'x' 'x' 'x'] ['49' 'x' 'x' '43'] ['x' 'x' '61' 'x']]
magic_square
underdetermined_system
10
[[1, 1, 64], [1, 2, 53], [1, 3, 60], [2, 1, 80], [2, 2, 65], [3, 0, 40], [3, 1, 38], [3, 3, 37]]
931
4.630835771560669
8
31
16
["[['72', '76', '68', '69'], ['56', '', '', ''], ['49', '', '', '43'], ['', '', '61', '']]", 4, 37, 83]
["[['72', '76', '68', '69'], ['56', '', '', ''], ['49', '', '', '43'], ['', '', '61', '']]", 37, 83, [1, 3], [1, 3], [258, 247], [233, 237], 242]
["[['72', '76', '68', '69'], ['56', '', '', ''], ['49', '', '', '43'], ['', '', '61', '']]", "37", "83", "[None, 258, 247, None]", "[None, 233, 237, None]", "242"]
87
In 'Restricted Sorting', there are 12 stacks each with a capacity of 7 blocks, with 6 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 6 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: 11, 1: 13, 2: 4, 3: 4, 4: 13, 5: 7, 6: 12, 7: 6, 8: 4, 9: 6, 10: 11, 11: 4}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Black', 'Blue', 'Pink', 'Green', 'Blue', 'Red', 'Red'], ['Yellow', 'White', 'White', 'Black', 'Yellow', 'Green', 'Green'], ['Yellow', 'Pink', 'White', 'Pink', 'Black', 'Red', 'Black'], [], ['Pink', 'Red', 'Blue', 'White', 'Blue', 'Blue', 'Red'], ['Blue', 'Yellow', 'White', 'Pink', 'Pink', 'Green', 'Green'], [], [], ['Yellow', 'Black', 'Yellow', 'White', 'Red', 'Black', 'Green'], [], [], []]
restricted_sorting
sorting
4
[[0, 3], [0, 11], [5, 11], [0, 7], [0, 9], [0, 11], [4, 7], [1, 10], [2, 10], [2, 7], [4, 0], [5, 10], [8, 10], [1, 6], [1, 6], [1, 3], [1, 10], [2, 6], [2, 7], [5, 6], [5, 7], [5, 7], [9, 5], [2, 3], [2, 9], [2, 3], [4, 11], [4, 2], [4, 11], [4, 11], [8, 3], [8, 10], [8, 2], [8, 0], [1, 5], [1, 5], [8, 1], [4, 0], [9, 0], [8, 5], [1, 3], [6, 2], [6, 2], [6, 2], [6, 2]]
319
183.4848072528839
45
132
42
[[["Black", "Blue", "Pink", "Green", "Blue", "Red", "Red"], ["Yellow", "White", "White", "Black", "Yellow", "Green", "Green"], ["Yellow", "Pink", "White", "Pink", "Black", "Red", "Black"], [], ["Pink", "Red", "Blue", "White", "Blue", "Blue", "Red"], ["Blue", "Yellow", "White", "Pink", "Pink", "Green", "Green"], [], [], ["Yellow", "Black", "Yellow", "White", "Red", "Black", "Green"], [], [], []], 7, {"0": 11, "1": 13, "2": 4, "3": 4, "4": 13, "5": 7, "6": 12, "7": 6, "8": 4, "9": 6, "10": 11, "11": 4}]
[[["Black", "Blue", "Pink", "Green", "Blue", "Red", "Red"], ["Yellow", "White", "White", "Black", "Yellow", "Green", "Green"], ["Yellow", "Pink", "White", "Pink", "Black", "Red", "Black"], [], ["Pink", "Red", "Blue", "White", "Blue", "Blue", "Red"], ["Blue", "Yellow", "White", "Pink", "Pink", "Green", "Green"], [], [], ["Yellow", "Black", "Yellow", "White", "Red", "Black", "Green"], [], [], []], 7, {"0": 11, "1": 13, "2": 4, "3": 4, "4": 13, "5": 7, "6": 12, "7": 6, "8": 4, "9": 6, "10": 11, "11": 4}, 6]
["[['Black', 'Blue', 'Pink', 'Green', 'Blue', 'Red', 'Red'], ['Yellow', 'White', 'White', 'Black', 'Yellow', 'Green', 'Green'], ['Yellow', 'Pink', 'White', 'Pink', 'Black', 'Red', 'Black'], [], ['Pink', 'Red', 'Blue', 'White', 'Blue', 'Blue', 'Red'], ['Blue', 'Yellow', 'White', 'Pink', 'Pink', 'Green', 'Green'], [], [], ['Yellow', 'Black', 'Yellow', 'White', 'Red', 'Black', 'Green'], [], [], []]", "{0: 11, 1: 13, 2: 4, 3: 4, 4: 13, 5: 7, 6: 12, 7: 6, 8: 4, 9: 6, 10: 11, 11: 4}", "7", "6"]
87
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 0) to his destination workshop at index (6, 12), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 2, district 2 covering rows 3 to 5, and district 3 covering rows 6 to 13. 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 6 19 13 x 16 11 6 14 15 7 x x x] [x 6 16 15 x 19 16 18 x 8 10 x x x] [x 5 10 14 2 x x x 11 x 11 x x x] [6 13 15 10 x x x x 19 x x x 2 x] [x 15 10 6 6 8 10 9 11 x x x 16 x] [x x x 8 15 12 10 19 1 18 19 4 x 10] [1 17 x x 6 8 4 x 15 8 10 6 4 x] [x x x x 13 x 5 x 9 10 x x x x] [12 x 11 x 13 x 11 7 5 13 x x 6 15] [x 18 19 x x x 3 x 16 11 x 15 x x] [x x x x x x 2 15 x x 8 x x x] [11 x 6 13 12 x 12 x x 9 x 17 x x] [x 1 x 18 18 3 x 11 13 1 13 x x x] [x x x x x 6 x x 8 x x x 4 11]
traffic
pathfinding
6
[[3, 0], [3, 1], [2, 1], [2, 2], [2, 3], [3, 3], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [5, 8], [6, 8], [6, 9], [6, 10], [6, 11], [6, 12]]
146
0.027922391891479492
18
4
4
[[["x", "6", "19", "13", "x", "16", "11", "6", "14", "15", "7", "x", "x", "x"], ["x", "6", "16", "15", "x", "19", "16", "18", "x", "8", "10", "x", "x", "x"], ["x", "5", "10", "14", "2", "x", "x", "x", "11", "x", "11", "x", "x", "x"], ["6", "13", "15", "10", "x", "x", "x", "x", "19", "x", "x", "x", "2", "x"], ["x", "15", "10", "6", "6", "8", "10", "9", "11", "x", "x", "x", "16", "x"], ["x", "x", "x", "8", "15", "12", "10", "19", "1", "18", "19", "4", "x", "10"], ["1", "17", "x", "x", "6", "8", "4", "x", "15", "8", "10", "6", "4", "x"], ["x", "x", "x", "x", "13", "x", "5", "x", "9", "10", "x", "x", "x", "x"], ["12", "x", "11", "x", "13", "x", "11", "7", "5", "13", "x", "x", "6", "15"], ["x", "18", "19", "x", "x", "x", "3", "x", "16", "11", "x", "15", "x", "x"], ["x", "x", "x", "x", "x", "x", "2", "15", "x", "x", "8", "x", "x", "x"], ["11", "x", "6", "13", "12", "x", "12", "x", "x", "9", "x", "17", "x", "x"], ["x", "1", "x", "18", "18", "3", "x", "11", "13", "1", "13", "x", "x", "x"], ["x", "x", "x", "x", "x", "6", "x", "x", "8", "x", "x", "x", "4", "11"]]]
[[["x", "6", "19", "13", "x", "16", "11", "6", "14", "15", "7", "x", "x", "x"], ["x", "6", "16", "15", "x", "19", "16", "18", "x", "8", "10", "x", "x", "x"], ["x", "5", "10", "14", "2", "x", "x", "x", "11", "x", "11", "x", "x", "x"], ["6", "13", "15", "10", "x", "x", "x", "x", "19", "x", "x", "x", "2", "x"], ["x", "15", "10", "6", "6", "8", "10", "9", "11", "x", "x", "x", "16", "x"], ["x", "x", "x", "8", "15", "12", "10", "19", "1", "18", "19", "4", "x", "10"], ["1", "17", "x", "x", "6", "8", "4", "x", "15", "8", "10", "6", "4", "x"], ["x", "x", "x", "x", "13", "x", "5", "x", "9", "10", "x", "x", "x", "x"], ["12", "x", "11", "x", "13", "x", "11", "7", "5", "13", "x", "x", "6", "15"], ["x", "18", "19", "x", "x", "x", "3", "x", "16", "11", "x", "15", "x", "x"], ["x", "x", "x", "x", "x", "x", "2", "15", "x", "x", "8", "x", "x", "x"], ["11", "x", "6", "13", "12", "x", "12", "x", "x", "9", "x", "17", "x", "x"], ["x", "1", "x", "18", "18", "3", "x", "11", "13", "1", "13", "x", "x", "x"], ["x", "x", "x", "x", "x", "6", "x", "x", "8", "x", "x", "x", "4", "11"]], [3, 0], [6, 12], 2, 5]
["[['x', '6', '19', '13', 'x', '16', '11', '6', '14', '15', '7', 'x', 'x', 'x'], ['x', '6', '16', '15', 'x', '19', '16', '18', 'x', '8', '10', 'x', 'x', 'x'], ['x', '5', '10', '14', '2', 'x', 'x', 'x', '11', 'x', '11', 'x', 'x', 'x'], ['6', '13', '15', '10', 'x', 'x', 'x', 'x', '19', 'x', 'x', 'x', '2', 'x'], ['x', '15', '10', '6', '6', '8', '10', '9', '11', 'x', 'x', 'x', '16', 'x'], ['x', 'x', 'x', '8', '15', '12', '10', '19', '1', '18', '19', '4', 'x', '10'], ['1', '17', 'x', 'x', '6', '8', '4', 'x', '15', '8', '10', '6', '4', 'x'], ['x', 'x', 'x', 'x', '13', 'x', '5', 'x', '9', '10', 'x', 'x', 'x', 'x'], ['12', 'x', '11', 'x', '13', 'x', '11', '7', '5', '13', 'x', 'x', '6', '15'], ['x', '18', '19', 'x', 'x', 'x', '3', 'x', '16', '11', 'x', '15', 'x', 'x'], ['x', 'x', 'x', 'x', 'x', 'x', '2', '15', 'x', 'x', '8', 'x', 'x', 'x'], ['11', 'x', '6', '13', '12', 'x', '12', 'x', 'x', '9', 'x', '17', 'x', 'x'], ['x', '1', 'x', '18', '18', '3', 'x', '11', '13', '1', '13', 'x', 'x', 'x'], ['x', 'x', 'x', 'x', 'x', '6', 'x', 'x', '8', 'x', 'x', 'x', '4', '11']]", "(3, 0)", "(6, 12)", "2", "5"]
87
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 14x14. 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 (12, 2). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 1 1 0 1 1 0 1 0 0 0 1 1 1 1 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 0 0 0 0 1 1 0 1 1 1 1 1 1 0 0 0 1 0 1 1 1 1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[1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0], [1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0], [1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1]]", "(0, 11)", "(12, 2)", "4"]
87
Given 7 labeled water jugs with capacities 36, 95, 47, 149, 58, 96, 81, 148 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 252, 307, 412, 431 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 58, 4], ["+", 96, 4], ["+", 149, 4], ["+", 81, 4], ["+", 47, 4], ["+", 148, 3], ["+", 148, 3], ["+", 58, 3], ["+", 58, 3], ["+", 148, 2], ["+", 148, 2], ["-", 36, 2], ["+", 47, 2], ["+", 81, 1], ["+", 148, 1], ["-", 58, 1], ["+", 81, 1]]
17
0.04282355308532715
17
64
3
[[36, 95, 47, 149, 58, 96, 81, 148], [252, 307, 412, 431]]
[[36, 95, 47, 149, 58, 96, 81, 148], [252, 307, 412, 431]]
["[36, 95, 47, 149, 58, 96, 81, 148]", "[252, 307, 412, 431]"]
88
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, 74, 70, 26, 65], [91, 55, 12, '_', 68], [27, 18, 67, 40, 54]]
8_puzzle
puzzle
8
[12, 55, 91, 27, 18, 67, 55, 12, 26, 65, 68, 54, 40, 55, 12, 26, 65, 70, 74, 91, 67, 18, 27, 67, 26, 65, 55, 12, 18, 26, 65, 55, 54, 40]
34
2.9298317432403564
34
4
15
[[[98, 74, 70, 26, 65], [91, 55, 12, "_", 68], [27, 18, 67, 40, 54]]]
[[[98, 74, 70, 26, 65], [91, 55, 12, "_", 68], [27, 18, 67, 40, 54]]]
["[[98, 74, 70, 26, 65], [91, 55, 12, '_', 68], [27, 18, 67, 40, 54]]"]
88
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: frim, agate, askip, floey, zonar The initial board: [['g', 'f', 't', 'i', 'm'], ['a', 'l', 'a', 'a', 'e'], ['n', 's', '_', 'i', 'e'], ['f', 'p', 'o', 'k', 'y'], ['z', 'o', 'r', 'a', 'r']]
8_puzzle_words
puzzle
3
["down-left", "up-left", "up-right", "up-right", "down-right", "down-left", "down-right", "down-left", "up-left", "up-right", "down-right", "up-right", "up-left", "down-left", "up-left", "up-right", "down-right", "down-left", "down-left", "up-left", "up-right", "up-left"]
22
0.5754249095916748
22
4
25
[[["g", "f", "t", "i", "m"], ["a", "l", "a", "a", "e"], ["n", "s", "_", "i", "e"], ["f", "p", "o", "k", "y"], ["z", "o", "r", "a", "r"]]]
[[["g", "f", "t", "i", "m"], ["a", "l", "a", "a", "e"], ["n", "s", "_", "i", "e"], ["f", "p", "o", "k", "y"], ["z", "o", "r", "a", "r"]], ["frim", "agate", "askip", "floey", "zonar"]]
["[['g', 'f', 't', 'i', 'm'], ['a', 'l', 'a', 'a', 'e'], ['n', 's', '_', 'i', 'e'], ['f', 'p', 'o', 'k', 'y'], ['z', 'o', 'r', 'a', 'r']]", "['frim', 'agate', 'askip', 'floey', 'zonar']"]
88
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'A'. Our task is to visit city M 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 M, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. T W Y B I J R O P A V X M K F T 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 W 0 0 1 1 0 0 1 0 0 0 0 1 0 0 0 Y 1 0 0 1 0 0 1 1 0 1 0 0 1 0 0 B 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 I 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 J 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 R 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 O 0 1 0 0 0 0 0 0 1 0 0 1 0 1 0 P 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 A 0 1 0 1 0 0 0 1 1 0 0 0 0 1 0 V 1 0 0 0 0 1 1 0 0 1 0 0 0 0 0 X 0 0 1 0 0 1 1 0 1 1 0 0 1 0 0 M 1 0 0 0 0 1 0 0 1 1 1 0 0 0 1 K 0 1 0 1 0 1 0 0 1 0 0 0 0 0 0 F 0 1 1 0 1 0 0 1 0 0 1 0 0 1 0
city_directed_graph
pathfinding
15
["A", "O", "X", "M", "J", "F", "Y", "M", "J"]
9
0.0450282096862793
9
15
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 0, 0, 0, 1], [0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]]", "['T', 'W', 'Y', 'B', 'I', 'J', 'R', 'O', 'P', 'A', 'V', 'X', 'M', 'K', 'F']", "['A']", "['M', 'J']"]
88
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [21, 31, 30, 31, 10, 17, 13, 35, 12, 2, 16, 40, 23, 10, 29, 13, 23, 2, 9, 5, 107, 46, 23, 11, 42, 9, 46, 28, 44, 22, 106, 10], such that the sum of the chosen coins adds up to 465. 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: 9, 106: 19, 28: 20, 44: 14, 9: 6, 35: 6, 22: 19, 46: 17, 11: 7, 40: 12, 17: 15, 10: 4, 12: 6, 30: 20, 2: 2, 23: 11, 42: 10, 16: 1, 107: 11, 21: 12, 5: 3, 31: 13, 29: 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
18
[10, 35, 10, 107, 106, 46, 44, 42, 40, 16, 2, 5, 2]
105
0.05189323425292969
13
32
32
[[21, 31, 30, 31, 10, 17, 13, 35, 12, 2, 16, 40, 23, 10, 29, 13, 23, 2, 9, 5, 107, 46, 23, 11, 42, 9, 46, 28, 44, 22, 106, 10]]
[[21, 31, 30, 31, 10, 17, 13, 35, 12, 2, 16, 40, 23, 10, 29, 13, 23, 2, 9, 5, 107, 46, 23, 11, 42, 9, 46, 28, 44, 22, 106, 10], {"13": 9, "106": 19, "28": 20, "44": 14, "9": 6, "35": 6, "22": 19, "46": 17, "11": 7, "40": 12, "17": 15, "10": 4, "12": 6, "30": 20, "2": 2, "23": 11, "42": 10, "16": 1, "107": 11, "21": 12, "5": 3, "31": 13, "29": 20}, 465]
["[21, 31, 30, 31, 10, 17, 13, 35, 12, 2, 16, 40, 23, 10, 29, 13, 23, 2, 9, 5, 107, 46, 23, 11, 42, 9, 46, 28, 44, 22, 106, 10]", "{13: 9, 106: 19, 28: 20, 44: 14, 9: 6, 35: 6, 22: 19, 46: 17, 11: 7, 40: 12, 17: 15, 10: 4, 12: 6, 30: 20, 2: 2, 23: 11, 42: 10, 16: 1, 107: 11, 21: 12, 5: 3, 31: 13, 29: 20}", "465"]
88
The game of 'Sort It' begins with 3 tubes, each filled with 6 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 9 balls. It is not allowed to place a ball in a tube that already has 9 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Green', 'Red', 'Green', 'Green', 'Red'], ['Green', 'Blue', 'Red', 'Blue', 'Blue', 'Red'], ['Red', 'Green', 'Blue', 'Blue', 'Green', 'Red']]
color_sorting
sorting
10
[[0, 2], [0, 1], [0, 2], [0, 1], [0, 1], [0, 2], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [2, 1], [2, 1], [2, 0], [2, 1], [2, 1], [2, 1], [2, 1], [2, 1], [2, 1], [0, 2], [0, 2], [0, 2], [1, 0], [1, 0], [1, 2], [1, 2], [0, 2], [1, 2], [0, 1], [0, 1], [0, 1], [2, 0], [2, 0], [1, 2]]
38
564.8052530288696
38
6
18
[[["Blue", "Green", "Red", "Green", "Green", "Red"], ["Green", "Blue", "Red", "Blue", "Blue", "Red"], ["Red", "Green", "Blue", "Blue", "Green", "Red"]], 9]
[[["Blue", "Green", "Red", "Green", "Green", "Red"], ["Green", "Blue", "Red", "Blue", "Blue", "Red"], ["Red", "Green", "Blue", "Blue", "Green", "Red"]], 9]
["[['Blue', 'Green', 'Red', 'Green', 'Green', 'Red'], ['Green', 'Blue', 'Red', 'Blue', 'Blue', 'Red'], ['Red', 'Green', 'Blue', 'Blue', 'Green', 'Red']]", "9"]
88
We have a 4x4 numerical grid, with numbers ranging from 30 to 80 (30 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' 'x' '68'] ['x' '58' 'x' 'x'] ['41' 'x' 'x' 'x'] ['x' '66' '67' '79']]
consecutive_grid
underdetermined_system
15
[[0, 1, 52], [0, 3, 71], [1, 3, 72], [2, 0, 28], [2, 1, 55], [2, 3, 73], [3, 0, 27], [3, 1, 56]]
787
19.980714321136475
8
50
16
["[['51', '', '68', ''], ['50', '54', '69', ''], ['', '', '70', ''], ['', '', '76', '77']]", 27, 82]
["[['51', '', '68', ''], ['50', '54', '69', ''], ['', '', '70', ''], ['', '', '76', '77']]", 27, 82]
["[['51', '', '68', ''], ['50', '54', '69', ''], ['', '', '70', ''], ['', '', '76', '77']]", "27", "82"]
88
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 22 to 68. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 183, 202, None for columns 1 to 2 respectively, and the sums of rows must be None, 190, 154, 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 183. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position. Grid: [['27' '48' 'x' 'x'] ['x' 'x' '63' 'x'] ['28' 'x' '33' '26'] ['x' 'x' 'x' '39']]
magic_square
underdetermined_system
10
[[0, 2, 40], [0, 3, 23], [1, 0, 24], [1, 1, 46], [1, 3, 57], [2, 1, 67], [3, 0, 30], [3, 1, 22], [3, 2, 66]]
639
497.1962370872498
9
31
16
["[['27', '48', '', ''], ['', '', '63', ''], ['28', '', '33', '26'], ['', '', '', '39']]", 4, 22, 68]
["[['27', '48', '', ''], ['', '', '63', ''], ['28', '', '33', '26'], ['', '', '', '39']]", 22, 68, [1, 3], [1, 3], [183, 202], [190, 154], 183]
["[['27', '48', '', ''], ['', '', '63', ''], ['28', '', '33', '26'], ['', '', '', '39']]", "22", "68", "[None, 183, 202, None]", "[None, 190, 154, None]", "183"]
88
In 'Restricted Sorting', there are 12 stacks each with a capacity of 7 blocks, with 6 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 6 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: 11, 1: 11, 2: 12, 3: 4, 4: 12, 5: 2, 6: 10, 7: 8, 8: 6, 9: 10, 10: 8, 11: 3}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Yellow', 'Green', 'White', 'Pink', 'Black', 'Pink', 'Pink'], ['Pink', 'Red', 'White', 'Black', 'Green', 'White', 'Pink'], ['Red', 'Black', 'Green', 'Blue', 'Red', 'Black', 'Yellow'], ['Blue', 'White', 'Blue', 'Blue', 'Black', 'White', 'Blue'], ['Yellow', 'Blue', 'Green', 'Green', 'Red', 'Red', 'Yellow'], [], [], [], ['Black', 'Yellow', 'Red', 'Green', 'Yellow', 'Pink', 'White'], [], [], []]
restricted_sorting
sorting
4
[[0, 5], [4, 5], [0, 11], [0, 7], [4, 10], [4, 11], [4, 11], [2, 6], [8, 9], [8, 5], [8, 6], [8, 11], [8, 5], [2, 9], [2, 11], [2, 10], [2, 6], [2, 9], [3, 10], [3, 7], [3, 10], [3, 10], [3, 9], [3, 7], [3, 10], [1, 3], [8, 3], [1, 6], [1, 7], [1, 9], [1, 11], [1, 7], [4, 6], [4, 6], [0, 3], [0, 9], [8, 7], [0, 3], [0, 3], [1, 3], [2, 5], [4, 5]]
270
1.9822285175323486
42
132
42
[[["Yellow", "Green", "White", "Pink", "Black", "Pink", "Pink"], ["Pink", "Red", "White", "Black", "Green", "White", "Pink"], ["Red", "Black", "Green", "Blue", "Red", "Black", "Yellow"], ["Blue", "White", "Blue", "Blue", "Black", "White", "Blue"], ["Yellow", "Blue", "Green", "Green", "Red", "Red", "Yellow"], [], [], [], ["Black", "Yellow", "Red", "Green", "Yellow", "Pink", "White"], [], [], []], 7, {"0": 11, "1": 11, "2": 12, "3": 4, "4": 12, "5": 2, "6": 10, "7": 8, "8": 6, "9": 10, "10": 8, "11": 3}]
[[["Yellow", "Green", "White", "Pink", "Black", "Pink", "Pink"], ["Pink", "Red", "White", "Black", "Green", "White", "Pink"], ["Red", "Black", "Green", "Blue", "Red", "Black", "Yellow"], ["Blue", "White", "Blue", "Blue", "Black", "White", "Blue"], ["Yellow", "Blue", "Green", "Green", "Red", "Red", "Yellow"], [], [], [], ["Black", "Yellow", "Red", "Green", "Yellow", "Pink", "White"], [], [], []], 7, {"0": 11, "1": 11, "2": 12, "3": 4, "4": 12, "5": 2, "6": 10, "7": 8, "8": 6, "9": 10, "10": 8, "11": 3}, 6]
["[['Yellow', 'Green', 'White', 'Pink', 'Black', 'Pink', 'Pink'], ['Pink', 'Red', 'White', 'Black', 'Green', 'White', 'Pink'], ['Red', 'Black', 'Green', 'Blue', 'Red', 'Black', 'Yellow'], ['Blue', 'White', 'Blue', 'Blue', 'Black', 'White', 'Blue'], ['Yellow', 'Blue', 'Green', 'Green', 'Red', 'Red', 'Yellow'], [], [], [], ['Black', 'Yellow', 'Red', 'Green', 'Yellow', 'Pink', 'White'], [], [], []]", "{0: 11, 1: 11, 2: 12, 3: 4, 4: 12, 5: 2, 6: 10, 7: 8, 8: 6, 9: 10, 10: 8, 11: 3}", "7", "6"]
88
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 1) to his destination workshop at index (5, 13), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 5, and district 3 covering rows 6 to 13. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x 7 x 13 8 2 15 2 5 15 6 4 7 x] [x 6 19 17 5 13 15 2 11 5 x x 9 8] [16 12 10 7 8 19 19 9 5 10 2 x x 12] [x 1 19 20 x 3 4 18 x x 10 1 12 2] [x 1 4 1 1 10 4 x 12 x 5 10 3 8] [x x x 7 x x 16 12 x x x 13 6 10] [x x 11 12 13 15 8 x 12 1 16 14 8 15] [x 11 x 15 x x x x x x 5 x x 14] [1 x x 8 x 13 17 x 3 12 x x x x] [14 3 x 4 x x x 12 x 7 x x x x] [x 5 15 x 10 17 x x 6 9 2 x x x] [1 7 17 1 x x x x 11 x x x x 12] [x x 14 18 8 19 19 16 x 6 5 16 17 7] [x x x x x x 19 17 x x 2 12 x x]
traffic
pathfinding
6
[[3, 1], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [3, 5], [3, 6], [3, 7], [2, 7], [2, 8], [2, 9], [2, 10], [3, 10], [3, 11], [4, 11], [4, 12], [5, 12], [6, 12], [5, 12], [5, 13]]
122
0.027570009231567383
21
4
4
[[["x", "7", "x", "13", "8", "2", "15", "2", "5", "15", "6", "4", "7", "x"], ["x", "6", "19", "17", "5", "13", "15", "2", "11", "5", "x", "x", "9", "8"], ["16", "12", "10", "7", "8", "19", "19", "9", "5", "10", "2", "x", "x", "12"], ["x", "1", "19", "20", "x", "3", "4", "18", "x", "x", "10", "1", "12", "2"], ["x", "1", "4", "1", "1", "10", "4", "x", "12", "x", "5", "10", "3", "8"], ["x", "x", "x", "7", "x", "x", "16", "12", "x", "x", "x", "13", "6", "10"], ["x", "x", "11", "12", "13", "15", "8", "x", "12", "1", "16", "14", "8", "15"], ["x", "11", "x", "15", "x", "x", "x", "x", "x", "x", "5", "x", "x", "14"], ["1", "x", "x", "8", "x", "13", "17", "x", "3", "12", "x", "x", "x", "x"], ["14", "3", "x", "4", "x", "x", "x", "12", "x", "7", "x", "x", "x", "x"], ["x", "5", "15", "x", "10", "17", "x", "x", "6", "9", "2", "x", "x", "x"], ["1", "7", "17", "1", "x", "x", "x", "x", "11", "x", "x", "x", "x", "12"], ["x", "x", "14", "18", "8", "19", "19", "16", "x", "6", "5", "16", "17", "7"], ["x", "x", "x", "x", "x", "x", "19", "17", "x", "x", "2", "12", "x", "x"]]]
[[["x", "7", "x", "13", "8", "2", "15", "2", "5", "15", "6", "4", "7", "x"], ["x", "6", "19", "17", "5", "13", "15", "2", "11", "5", "x", "x", "9", "8"], ["16", "12", "10", "7", "8", "19", "19", "9", "5", "10", "2", "x", "x", "12"], ["x", "1", "19", "20", "x", "3", "4", "18", "x", "x", "10", "1", "12", "2"], ["x", "1", "4", "1", "1", "10", "4", "x", "12", "x", "5", "10", "3", "8"], ["x", "x", "x", "7", "x", "x", "16", "12", "x", "x", "x", "13", "6", "10"], ["x", "x", "11", "12", "13", "15", "8", "x", "12", "1", "16", "14", "8", "15"], ["x", "11", "x", "15", "x", "x", "x", "x", "x", "x", "5", "x", "x", "14"], ["1", "x", "x", "8", "x", "13", "17", "x", "3", "12", "x", "x", "x", "x"], ["14", "3", "x", "4", "x", "x", "x", "12", "x", "7", "x", "x", "x", "x"], ["x", "5", "15", "x", "10", "17", "x", "x", "6", "9", "2", "x", "x", "x"], ["1", "7", "17", "1", "x", "x", "x", "x", "11", "x", "x", "x", "x", "12"], ["x", "x", "14", "18", "8", "19", "19", "16", "x", "6", "5", "16", "17", "7"], ["x", "x", "x", "x", "x", "x", "19", "17", "x", "x", "2", "12", "x", "x"]], [3, 1], [5, 13], 3, 5]
["[['x', '7', 'x', '13', '8', '2', '15', '2', '5', '15', '6', '4', '7', 'x'], ['x', '6', '19', '17', '5', '13', '15', '2', '11', '5', 'x', 'x', '9', '8'], ['16', '12', '10', '7', '8', '19', '19', '9', '5', '10', '2', 'x', 'x', '12'], ['x', '1', '19', '20', 'x', '3', '4', '18', 'x', 'x', '10', '1', '12', '2'], ['x', '1', '4', '1', '1', '10', '4', 'x', '12', 'x', '5', '10', '3', '8'], ['x', 'x', 'x', '7', 'x', 'x', '16', '12', 'x', 'x', 'x', '13', '6', '10'], ['x', 'x', '11', '12', '13', '15', '8', 'x', '12', '1', '16', '14', '8', '15'], ['x', '11', 'x', '15', 'x', 'x', 'x', 'x', 'x', 'x', '5', 'x', 'x', '14'], ['1', 'x', 'x', '8', 'x', '13', '17', 'x', '3', '12', 'x', 'x', 'x', 'x'], ['14', '3', 'x', '4', 'x', 'x', 'x', '12', 'x', '7', 'x', 'x', 'x', 'x'], ['x', '5', '15', 'x', '10', '17', 'x', 'x', '6', '9', '2', 'x', 'x', 'x'], ['1', '7', '17', '1', 'x', 'x', 'x', 'x', '11', 'x', 'x', 'x', 'x', '12'], ['x', 'x', '14', '18', '8', '19', '19', '16', 'x', '6', '5', '16', '17', '7'], ['x', 'x', 'x', 'x', 'x', 'x', '19', '17', 'x', 'x', '2', '12', 'x', 'x']]", "(3, 1)", "(5, 13)", "3", "5"]
88
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 14x14. 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 (9, 1). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 0 0 0 0 1 1 0 0 1 0 1 1 0 0 0 0 0 1 1 0 1 0 1 0 1 0 0 1 0 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 1 0 1 1 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 0 0 1 1 0 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 1 0 1 1 0 0 1 0 1 0 1 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 0 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1
trampoline_matrix
pathfinding
14
[[0, 11], [1, 11], [2, 11], [3, 10], [4, 9], [4, 8], [4, 7], [4, 6], [4, 5], [5, 5], [6, 4], [7, 3], [8, 3], [9, 3], [9, 2], [9, 1]]
16
0.023496627807617188
16
8
2
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 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1], [0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1]]", [0, 11], [9, 1], 4]
["[[1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1], [0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1], [0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1]]", "(0, 11)", "(9, 1)", "4"]
88
Given 7 labeled water jugs with capacities 95, 111, 144, 57, 13, 58, 12 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 226, 271, 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
6
[["+", 95, 4], ["+", 144, 4], ["+", 57, 4], ["-", 13, 4], ["+", 111, 4], ["+", 58, 3], ["+", 144, 3], ["+", 13, 3], ["+", 58, 3], ["+", 58, 3], ["+", 57, 2], ["+", 58, 2], ["+", 144, 2], ["+", 12, 2], ["+", 57, 1], ["+", 58, 1], ["+", 111, 1]]
17
0.051752328872680664
17
56
3
[[95, 111, 144, 57, 13, 58, 12], [226, 271, 331, 394]]
[[95, 111, 144, 57, 13, 58, 12], [226, 271, 331, 394]]
["[95, 111, 144, 57, 13, 58, 12]", "[226, 271, 331, 394]"]
89
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, 36, 63, 32, 15], [20, 21, 65, '_', 54], [45, 96, 29, 31, 55]]
8_puzzle
puzzle
8
[54, 55, 31, 54, 32, 15, 55, 32, 15, 63, 65, 21, 20, 45, 96, 29, 54, 15, 63, 65, 36, 71, 45, 96, 29, 20, 21, 54, 20, 21, 54, 36, 71, 45, 96, 54, 45, 71, 65, 63, 32, 31]
42
37.91888380050659
42
4
15
[[[71, 36, 63, 32, 15], [20, 21, 65, "_", 54], [45, 96, 29, 31, 55]]]
[[[71, 36, 63, 32, 15], [20, 21, 65, "_", 54], [45, 96, 29, 31, 55]]]
["[[71, 36, 63, 32, 15], [20, 21, 65, '_', 54], [45, 96, 29, 31, 55]]"]
89
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: fage, palay, mowra, gemot, puffy The initial board: [['a', 'f', 'w', 'g', 'e'], ['p', 'f', 'l', 'm', 'y'], ['o', 'o', 'a', 'r', 'a'], ['g', 'a', 'm', 'e', 't'], ['p', 'u', '_', 'f', 'y']]
8_puzzle_words
puzzle
3
["up-right", "up-left", "down-left", "up-left", "up-right", "down-right", "up-right", "up-left", "down-left", "down-right", "down-right", "down-left", "up-left", "up-left", "up-right", "down-right", "down-right", "down-left", "up-left", "up-right", "up-right", "up-left", "down-left", "up-left"]
24
1.2028648853302002
24
4
25
[[["a", "f", "w", "g", "e"], ["p", "f", "l", "m", "y"], ["o", "o", "a", "r", "a"], ["g", "a", "m", "e", "t"], ["p", "u", "_", "f", "y"]]]
[[["a", "f", "w", "g", "e"], ["p", "f", "l", "m", "y"], ["o", "o", "a", "r", "a"], ["g", "a", "m", "e", "t"], ["p", "u", "_", "f", "y"]], ["fage", "palay", "mowra", "gemot", "puffy"]]
["[['a', 'f', 'w', 'g', 'e'], ['p', 'f', 'l', 'm', 'y'], ['o', 'o', 'a', 'r', 'a'], ['g', 'a', 'm', 'e', 't'], ['p', 'u', '_', 'f', 'y']]", "['fage', 'palay', 'mowra', 'gemot', 'puffy']"]
89
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'B'. Our task is to visit city Q 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 Q, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. K P O U Q D G R C B J X S E I K 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 P 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 O 1 0 0 0 1 0 0 0 0 1 0 0 1 0 1 U 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 Q 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 D 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 G 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 R 0 0 1 0 0 1 0 0 0 1 1 0 0 0 0 C 1 1 1 1 0 0 1 1 0 0 1 0 0 0 0 B 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 J 0 1 0 0 0 0 1 0 0 0 0 0 1 0 1 X 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 S 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 E 0 0 0 0 1 0 1 0 1 0 1 1 0 0 0 I 0 0 0 0 1 1 0 1 1 1 0 0 0 0 0
city_directed_graph
pathfinding
15
["B", "E", "J", "I", "Q", "K", "I", "Q"]
8
0.2261185646057129
8
15
18
[[[0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 1, 1, 0, 0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K", "P", "O", "U", "Q", "D", "G", "R", "C", "B", "J", "X", "S", "E", "I"], "B", "Q", "I"]
["[[0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1], [0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0]]", "['K', 'P', 'O', 'U', 'Q', 'D', 'G', 'R', 'C', 'B', 'J', 'X', 'S', 'E', 'I']", "['B']", "['Q', 'I']"]
89
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [27, 23, 11, 23, 6, 197, 7, 21, 2, 22, 12, 38, 15, 32, 5, 19, 6, 28, 31, 31, 10, 10, 28, 24, 41, 6, 39, 16, 11, 37, 23, 7, 2], such that the sum of the chosen coins adds up to 445. 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 {41: 14, 23: 15, 31: 19, 21: 18, 22: 2, 6: 3, 11: 5, 12: 11, 37: 10, 7: 2, 32: 19, 28: 10, 16: 12, 2: 2, 197: 7, 39: 18, 19: 18, 15: 4, 10: 9, 5: 4, 27: 10, 38: 3, 24: 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
19
[38, 24, 22, 2, 7, 15, 37, 28, 197, 28, 41, 6]
72
0.04321479797363281
12
33
33
[[27, 23, 11, 23, 6, 197, 7, 21, 2, 22, 12, 38, 15, 32, 5, 19, 6, 28, 31, 31, 10, 10, 28, 24, 41, 6, 39, 16, 11, 37, 23, 7, 2]]
[[27, 23, 11, 23, 6, 197, 7, 21, 2, 22, 12, 38, 15, 32, 5, 19, 6, 28, 31, 31, 10, 10, 28, 24, 41, 6, 39, 16, 11, 37, 23, 7, 2], {"41": 14, "23": 15, "31": 19, "21": 18, "22": 2, "6": 3, "11": 5, "12": 11, "37": 10, "7": 2, "32": 19, "28": 10, "16": 12, "2": 2, "197": 7, "39": 18, "19": 18, "15": 4, "10": 9, "5": 4, "27": 10, "38": 3, "24": 5}, 445]
["[27, 23, 11, 23, 6, 197, 7, 21, 2, 22, 12, 38, 15, 32, 5, 19, 6, 28, 31, 31, 10, 10, 28, 24, 41, 6, 39, 16, 11, 37, 23, 7, 2]", "{41: 14, 23: 15, 31: 19, 21: 18, 22: 2, 6: 3, 11: 5, 12: 11, 37: 10, 7: 2, 32: 19, 28: 10, 16: 12, 2: 2, 197: 7, 39: 18, 19: 18, 15: 4, 10: 9, 5: 4, 27: 10, 38: 3, 24: 5}", "445"]
89
The game of 'Sort It' begins with 3 tubes, each filled with 6 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 9 balls. It is not allowed to place a ball in a tube that already has 9 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Green', 'Blue', 'Red', 'Red', 'Green'], ['Blue', 'Green', 'Blue', 'Blue', 'Red', 'Green'], ['Blue', 'Green', 'Red', 'Red', 'Green', 'Red']]
color_sorting
sorting
10
[[1, 2], [1, 0], [1, 2], [1, 2], [1, 0], [1, 0], [2, 1], [2, 1], [2, 1], [2, 1], [0, 2], [0, 2], [0, 2], [0, 1], [0, 2], [0, 1], [0, 1], [0, 1], [2, 0], [2, 0], [2, 1], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [0, 1], [0, 2], [0, 2], [1, 0], [1, 2], [1, 2]]
33
59.62572884559631
33
6
18
[[["Blue", "Green", "Blue", "Red", "Red", "Green"], ["Blue", "Green", "Blue", "Blue", "Red", "Green"], ["Blue", "Green", "Red", "Red", "Green", "Red"]], 9]
[[["Blue", "Green", "Blue", "Red", "Red", "Green"], ["Blue", "Green", "Blue", "Blue", "Red", "Green"], ["Blue", "Green", "Red", "Red", "Green", "Red"]], 9]
["[['Blue', 'Green', 'Blue', 'Red', 'Red', 'Green'], ['Blue', 'Green', 'Blue', 'Blue', 'Red', 'Green'], ['Blue', 'Green', 'Red', 'Red', 'Green', 'Red']]", "9"]
89
We have a 4x4 numerical grid, with numbers ranging from 10 to 60 (10 included in the range but 60 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third > fourth or first < second < third < fourth in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows: Grid: [['x' '33' '34' '47'] ['x' 'x' 'x' '50'] ['x' 'x' 'x' '52'] ['x' 'x' 'x' '53']]
consecutive_grid
underdetermined_system
15
[[0, 2, 31], [0, 3, 30], [1, 2, 59], [1, 3, 60], [2, 1, 51], [2, 2, 61], [3, 1, 49], [3, 2, 63]]
681
21.286011219024658
8
50
16
["[['62', '58', '', ''], ['56', '57', '', ''], ['50', '', '', '74'], ['48', '', '', '78']]", 30, 85]
["[['62', '58', '', ''], ['56', '57', '', ''], ['50', '', '', '74'], ['48', '', '', '78']]", 30, 85]
["[['62', '58', '', ''], ['56', '57', '', ''], ['50', '', '', '74'], ['48', '', '', '78']]", "30", "85"]
89
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 22 to 68. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 187, 186, None for columns 1 to 2 respectively, and the sums of rows must be None, 139, 178, 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 160. 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'] ['24' 'x' '27' '41'] ['22' '37' 'x' 'x'] ['29' 'x' 'x' '46']]
magic_square
underdetermined_system
7
[[0, 0, 23], [0, 1, 38], [0, 2, 30], [0, 3, 67], [1, 1, 47], [2, 2, 66], [2, 3, 53], [3, 1, 65], [3, 2, 63]]
678
413.0599796772003
9
36
16
["[['', '', '', ''], ['24', '', '27', '41'], ['22', '37', '', ''], ['29', '', '', '46']]", 4, 22, 68]
["[['', '', '', ''], ['24', '', '27', '41'], ['22', '37', '', ''], ['29', '', '', '46']]", 22, 68, [1, 3], [1, 3], [187, 186], [139, 178], 160]
["[['', '', '', ''], ['24', '', '27', '41'], ['22', '37', '', ''], ['29', '', '', '46']]", "22", "68", "[None, 187, 186, None]", "[None, 139, 178, None]", "160"]
89
In 'Restricted Sorting', there are 12 stacks each with a capacity of 7 blocks, with 6 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 6 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: 10, 1: 8, 2: 6, 3: 4, 4: 11, 5: 5, 6: 11, 7: 5, 8: 7, 9: 7, 10: 10, 11: 10}, 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', 'Pink', 'Green', 'Pink', 'Red', 'Red'], [], ['Pink', 'White', 'Pink', 'Black', 'White', 'Black', 'Pink'], ['Yellow', 'Green', 'White', 'Red', 'Yellow', 'Yellow', 'Red'], ['Green', 'Pink', 'White', 'Blue', 'Red', 'White', 'Red'], [], [], ['Blue', 'Blue', 'Yellow', 'Blue', 'Black', 'Blue', 'Green'], ['Yellow', 'Black', 'Black', 'White', 'Green', 'Green', 'Black'], [], []]
restricted_sorting
sorting
4
[[1, 7], [1, 2], [9, 2], [1, 0], [1, 10], [1, 0], [5, 10], [5, 0], [5, 11], [5, 7], [8, 7], [8, 7], [8, 2], [4, 2], [4, 10], [4, 11], [4, 1], [4, 2], [4, 2], [5, 1], [5, 11], [5, 1], [8, 7], [8, 5], [8, 7], [9, 5], [9, 5], [9, 11], [9, 8], [9, 8], [9, 5], [3, 9], [3, 11], [3, 9], [3, 5], [3, 11], [3, 5], [4, 1], [10, 8], [10, 8], [10, 8], [0, 3], [0, 3], [0, 3], [9, 3], [9, 3]]
317
39.28877377510071
46
132
42
[[[], ["Blue", "Yellow", "Pink", "Green", "Pink", "Red", "Red"], [], ["Pink", "White", "Pink", "Black", "White", "Black", "Pink"], ["Yellow", "Green", "White", "Red", "Yellow", "Yellow", "Red"], ["Green", "Pink", "White", "Blue", "Red", "White", "Red"], [], [], ["Blue", "Blue", "Yellow", "Blue", "Black", "Blue", "Green"], ["Yellow", "Black", "Black", "White", "Green", "Green", "Black"], [], []], 7, {"0": 10, "1": 8, "2": 6, "3": 4, "4": 11, "5": 5, "6": 11, "7": 5, "8": 7, "9": 7, "10": 10, "11": 10}]
[[[], ["Blue", "Yellow", "Pink", "Green", "Pink", "Red", "Red"], [], ["Pink", "White", "Pink", "Black", "White", "Black", "Pink"], ["Yellow", "Green", "White", "Red", "Yellow", "Yellow", "Red"], ["Green", "Pink", "White", "Blue", "Red", "White", "Red"], [], [], ["Blue", "Blue", "Yellow", "Blue", "Black", "Blue", "Green"], ["Yellow", "Black", "Black", "White", "Green", "Green", "Black"], [], []], 7, {"0": 10, "1": 8, "2": 6, "3": 4, "4": 11, "5": 5, "6": 11, "7": 5, "8": 7, "9": 7, "10": 10, "11": 10}, 6]
["[[], ['Blue', 'Yellow', 'Pink', 'Green', 'Pink', 'Red', 'Red'], [], ['Pink', 'White', 'Pink', 'Black', 'White', 'Black', 'Pink'], ['Yellow', 'Green', 'White', 'Red', 'Yellow', 'Yellow', 'Red'], ['Green', 'Pink', 'White', 'Blue', 'Red', 'White', 'Red'], [], [], ['Blue', 'Blue', 'Yellow', 'Blue', 'Black', 'Blue', 'Green'], ['Yellow', 'Black', 'Black', 'White', 'Green', 'Green', 'Black'], [], []]", "{0: 10, 1: 8, 2: 6, 3: 4, 4: 11, 5: 5, 6: 11, 7: 5, 8: 7, 9: 7, 10: 10, 11: 10}", "7", "6"]
89
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, 13) to his destination workshop at index (4, 0), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 5, and district 3 covering rows 6 to 13. 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 7 11 16 13 19 15 x 19 x x 16] [9 x 14 x 7 3 x x 17 9 x x x 19] [x 11 6 18 x 19 4 x x x 19 12 4 17] [5 12 15 3 x x x x 7 x 11 17 20 20] [6 x 11 15 11 17 16 5 x 3 4 20 x 14] [x 11 x 6 x 16 2 18 5 11 x 14 4 7] [x 6 x 17 x x 15 7 x 2 3 16 7 15] [7 x x 8 1 x x x 14 x x 18 x 19] [13 x x x x 2 9 19 x 16 11 5 x 11] [x 17 15 18 x 7 x 15 13 x 14 2 x 19] [x x x 14 7 19 x x 9 9 x x x x] [x 3 13 15 18 17 x x 9 4 x 12 10 14] [15 x 6 19 19 19 x 1 8 4 17 14 x x] [8 x 14 7 12 6 8 x 5 x 11 11 x x]
traffic
pathfinding
6
[[3, 13], [4, 13], [5, 13], [5, 12], [6, 12], [6, 11], [6, 10], [6, 9], [5, 9], [5, 8], [5, 7], [5, 6], [4, 6], [4, 5], [4, 4], [4, 3], [3, 3], [3, 2], [3, 1], [3, 0], [4, 0]]
189
0.029392480850219727
21
4
4
[[["x", "x", "x", "7", "11", "16", "13", "19", "15", "x", "19", "x", "x", "16"], ["9", "x", "14", "x", "7", "3", "x", "x", "17", "9", "x", "x", "x", "19"], ["x", "11", "6", "18", "x", "19", "4", "x", "x", "x", "19", "12", "4", "17"], ["5", "12", "15", "3", "x", "x", "x", "x", "7", "x", "11", "17", "20", "20"], ["6", "x", "11", "15", "11", "17", "16", "5", "x", "3", "4", "20", "x", "14"], ["x", "11", "x", "6", "x", "16", "2", "18", "5", "11", "x", "14", "4", "7"], ["x", "6", "x", "17", "x", "x", "15", "7", "x", "2", "3", "16", "7", "15"], ["7", "x", "x", "8", "1", "x", "x", "x", "14", "x", "x", "18", "x", "19"], ["13", "x", "x", "x", "x", "2", "9", "19", "x", "16", "11", "5", "x", "11"], ["x", "17", "15", "18", "x", "7", "x", "15", "13", "x", "14", "2", "x", "19"], ["x", "x", "x", "14", "7", "19", "x", "x", "9", "9", "x", "x", "x", "x"], ["x", "3", "13", "15", "18", "17", "x", "x", "9", "4", "x", "12", "10", "14"], ["15", "x", "6", "19", "19", "19", "x", "1", "8", "4", "17", "14", "x", "x"], ["8", "x", "14", "7", "12", "6", "8", "x", "5", "x", "11", "11", "x", "x"]]]
[[["x", "x", "x", "7", "11", "16", "13", "19", "15", "x", "19", "x", "x", "16"], ["9", "x", "14", "x", "7", "3", "x", "x", "17", "9", "x", "x", "x", "19"], ["x", "11", "6", "18", "x", "19", "4", "x", "x", "x", "19", "12", "4", "17"], ["5", "12", "15", "3", "x", "x", "x", "x", "7", "x", "11", "17", "20", "20"], ["6", "x", "11", "15", "11", "17", "16", "5", "x", "3", "4", "20", "x", "14"], ["x", "11", "x", "6", "x", "16", "2", "18", "5", "11", "x", "14", "4", "7"], ["x", "6", "x", "17", "x", "x", "15", "7", "x", "2", "3", "16", "7", "15"], ["7", "x", "x", "8", "1", "x", "x", "x", "14", "x", "x", "18", "x", "19"], ["13", "x", "x", "x", "x", "2", "9", "19", "x", "16", "11", "5", "x", "11"], ["x", "17", "15", "18", "x", "7", "x", "15", "13", "x", "14", "2", "x", "19"], ["x", "x", "x", "14", "7", "19", "x", "x", "9", "9", "x", "x", "x", "x"], ["x", "3", "13", "15", "18", "17", "x", "x", "9", "4", "x", "12", "10", "14"], ["15", "x", "6", "19", "19", "19", "x", "1", "8", "4", "17", "14", "x", "x"], ["8", "x", "14", "7", "12", "6", "8", "x", "5", "x", "11", "11", "x", "x"]], [3, 13], [4, 0], 3, 5]
["[['x', 'x', 'x', '7', '11', '16', '13', '19', '15', 'x', '19', 'x', 'x', '16'], ['9', 'x', '14', 'x', '7', '3', 'x', 'x', '17', '9', 'x', 'x', 'x', '19'], ['x', '11', '6', '18', 'x', '19', '4', 'x', 'x', 'x', '19', '12', '4', '17'], ['5', '12', '15', '3', 'x', 'x', 'x', 'x', '7', 'x', '11', '17', '20', '20'], ['6', 'x', '11', '15', '11', '17', '16', '5', 'x', '3', '4', '20', 'x', '14'], ['x', '11', 'x', '6', 'x', '16', '2', '18', '5', '11', 'x', '14', '4', '7'], ['x', '6', 'x', '17', 'x', 'x', '15', '7', 'x', '2', '3', '16', '7', '15'], ['7', 'x', 'x', '8', '1', 'x', 'x', 'x', '14', 'x', 'x', '18', 'x', '19'], ['13', 'x', 'x', 'x', 'x', '2', '9', '19', 'x', '16', '11', '5', 'x', '11'], ['x', '17', '15', '18', 'x', '7', 'x', '15', '13', 'x', '14', '2', 'x', '19'], ['x', 'x', 'x', '14', '7', '19', 'x', 'x', '9', '9', 'x', 'x', 'x', 'x'], ['x', '3', '13', '15', '18', '17', 'x', 'x', '9', '4', 'x', '12', '10', '14'], ['15', 'x', '6', '19', '19', '19', 'x', '1', '8', '4', '17', '14', 'x', 'x'], ['8', 'x', '14', '7', '12', '6', '8', 'x', '5', 'x', '11', '11', 'x', 'x']]", "(3, 13)", "(4, 0)", "3", "5"]
89
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 14x14. 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 (13, 7) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (0, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 0 0 1 1 1 1 1 1 0 0 0 1 0 0 0 0 0 1 1 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 1 0 0 1 0 0 0 0 0 1 1 0 1 1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 1 0 0 0 1 0 1 0 1 0 0 1 1 0 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 1 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 1 1 0 1 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 0 1 1 1 1 1 1 0 0 1 1 0 1 1 1 0 0 1 1 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 0 0 0 1 1 1 1 1 0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 0
trampoline_matrix
pathfinding
14
[[13, 7], [12, 6], [11, 5], [11, 4], [10, 4], [9, 4], [8, 4], [7, 4], [6, 3], [5, 3], [4, 3], [3, 2], [3, 1], [2, 1], [1, 1], [0, 1], [0, 0]]
17
0.02617049217224121
17
8
2
["[[0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1], [0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0], [1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 1, 0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, 1, 1, 1, 0, 0, 0, 1, 0], [1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0], [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0], [1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0]]", "(13, 7)", "(0, 0)", "4"]
89
Given 7 labeled water jugs with capacities 30, 26, 116, 76, 98, 48, 46, 45 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 201, 269, 315, 333 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 76, 4], ["+", 116, 4], ["+", 45, 4], ["+", 48, 4], ["+", 48, 4], ["+", 76, 3], ["+", 98, 3], ["+", 45, 3], ["+", 48, 3], ["+", 48, 3], ["+", 76, 2], ["+", 76, 2], ["+", 98, 2], ["-", 26, 2], ["+", 45, 2], ["+", 116, 1], ["-", 76, 1], ["+", 45, 1], ["+", 116, 1]]
19
0.04046440124511719
19
64
3
[[30, 26, 116, 76, 98, 48, 46, 45], [201, 269, 315, 333]]
[[30, 26, 116, 76, 98, 48, 46, 45], [201, 269, 315, 333]]
["[30, 26, 116, 76, 98, 48, 46, 45]", "[201, 269, 315, 333]"]
90
In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[88, 59, 84, 71, 80], [72, 79, 74, 96, 51], ['_', 28, 25, 24, 19]]
8_puzzle
puzzle
8
[28, 79, 74, 96, 24, 25, 79, 74, 96, 79, 25, 24, 79, 84, 59, 88, 72, 96, 74, 25, 24, 19, 51, 79, 71, 59, 88, 72, 96, 74, 72, 88, 84, 71, 59, 80, 79, 51]
38
19.18411660194397
38
4
15
[[[88, 59, 84, 71, 80], [72, 79, 74, 96, 51], ["_", 28, 25, 24, 19]]]
[[[88, 59, 84, 71, 80], [72, 79, 74, 96, 51], ["_", 28, 25, 24, 19]]]
["[[88, 59, 84, 71, 80], [72, 79, 74, 96, 51], ['_', 28, 25, 24, 19]]"]
90
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: sour, mangy, kizil, logia, urian The initial board: [['a', 's', 'i', 'u', 'r'], ['m', 'z', 'n', 'k', 'y'], ['g', 'i', 'o', 'i', 'l'], ['l', 'o', 'g', 'i', 'a'], ['u', 'r', '_', 'a', 'n']]
8_puzzle_words
puzzle
3
["up-left", "up-right", "up-right", "up-left", "down-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "down-left", "down-right", "down-right", "up-right", "up-left", "up-right", "up-left", "down-left", "up-left"]
20
0.5282673835754395
20
4
25
[[["a", "s", "i", "u", "r"], ["m", "z", "n", "k", "y"], ["g", "i", "o", "i", "l"], ["l", "o", "g", "i", "a"], ["u", "r", "_", "a", "n"]]]
[[["a", "s", "i", "u", "r"], ["m", "z", "n", "k", "y"], ["g", "i", "o", "i", "l"], ["l", "o", "g", "i", "a"], ["u", "r", "_", "a", "n"]], ["sour", "mangy", "kizil", "logia", "urian"]]
["[['a', 's', 'i', 'u', 'r'], ['m', 'z', 'n', 'k', 'y'], ['g', 'i', 'o', 'i', 'l'], ['l', 'o', 'g', 'i', 'a'], ['u', 'r', '_', 'a', 'n']]", "['sour', 'mangy', 'kizil', 'logia', 'urian']"]
90
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 G 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 G, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. C Z F U W T H Y P O A R I G B C 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 Z 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 F 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 U 1 0 1 0 0 0 1 1 0 1 1 0 0 0 1 W 1 1 1 0 0 0 0 1 0 0 0 1 0 1 0 T 0 0 0 0 0 0 0 1 0 0 1 1 0 1 0 H 0 0 1 0 1 1 0 0 1 1 0 1 1 1 0 Y 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 P 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 O 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0 A 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 R 1 1 0 1 0 0 0 0 1 0 0 0 1 1 1 I 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 G 1 0 0 1 0 1 1 0 0 0 0 0 1 0 0 B 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0
city_directed_graph
pathfinding
15
["F", "B", "T", "R", "G", "C", "R", "G"]
8
0.05848503112792969
8
15
18
[[[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0], [0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1], [1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0]], ["C", "Z", "F", "U", "W", "T", "H", "Y", "P", "O", "A", "R", "I", "G", "B"], "G", "R"]
[[[0, 1, 0, 0, 0, 0, 0, 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, 1, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1], [1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0]]", "['C', 'Z', 'F', 'U', 'W', 'T', 'H', 'Y', 'P', 'O', 'A', 'R', 'I', 'G', 'B']", "['F']", "['G', 'R']"]
90
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [45, 45, 40, 38, 26, 3, 3, 21, 3, 35, 24, 9, 43, 10, 19, 5, 21, 36, 15, 18, 13, 33, 42, 34, 6, 20, 38, 25, 42, 19, 32, 9, 31, 4, 4, 25, 30, 8], such that the sum of the chosen coins adds up to 453. 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: 7, 9: 1, 38: 9, 19: 4, 31: 18, 25: 18, 40: 13, 4: 2, 15: 8, 45: 2, 10: 10, 20: 18, 5: 3, 35: 12, 30: 8, 8: 5, 21: 5, 43: 12, 32: 10, 6: 2, 24: 18, 3: 2, 33: 7, 42: 4, 36: 10, 34: 6, 26: 5, 18: 6}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
20
[9, 9, 19, 45, 42, 38, 45, 42, 34, 26, 33, 43, 38, 30]
74
0.07263016700744629
14
38
38
[[45, 45, 40, 38, 26, 3, 3, 21, 3, 35, 24, 9, 43, 10, 19, 5, 21, 36, 15, 18, 13, 33, 42, 34, 6, 20, 38, 25, 42, 19, 32, 9, 31, 4, 4, 25, 30, 8]]
[[45, 45, 40, 38, 26, 3, 3, 21, 3, 35, 24, 9, 43, 10, 19, 5, 21, 36, 15, 18, 13, 33, 42, 34, 6, 20, 38, 25, 42, 19, 32, 9, 31, 4, 4, 25, 30, 8], {"13": 7, "9": 1, "38": 9, "19": 4, "31": 18, "25": 18, "40": 13, "4": 2, "15": 8, "45": 2, "10": 10, "20": 18, "5": 3, "35": 12, "30": 8, "8": 5, "21": 5, "43": 12, "32": 10, "6": 2, "24": 18, "3": 2, "33": 7, "42": 4, "36": 10, "34": 6, "26": 5, "18": 6}, 453]
["[45, 45, 40, 38, 26, 3, 3, 21, 3, 35, 24, 9, 43, 10, 19, 5, 21, 36, 15, 18, 13, 33, 42, 34, 6, 20, 38, 25, 42, 19, 32, 9, 31, 4, 4, 25, 30, 8]", "{13: 7, 9: 1, 38: 9, 19: 4, 31: 18, 25: 18, 40: 13, 4: 2, 15: 8, 45: 2, 10: 10, 20: 18, 5: 3, 35: 12, 30: 8, 8: 5, 21: 5, 43: 12, 32: 10, 6: 2, 24: 18, 3: 2, 33: 7, 42: 4, 36: 10, 34: 6, 26: 5, 18: 6}", "453"]
90
The game of 'Sort It' begins with 3 tubes, each filled with 6 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 9 balls. It is not allowed to place a ball in a tube that already has 9 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Green', 'Green', 'Red', 'Green', 'Red', 'Red'], ['Green', 'Red', 'Blue', 'Blue', 'Red', 'Blue'], ['Blue', 'Green', 'Blue', 'Blue', 'Red', 'Green']]
color_sorting
sorting
10
[[0, 1], [0, 1], [2, 0], [2, 1], [2, 0], [2, 0], [2, 0], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [0, 2], [1, 0], [1, 0], [1, 2], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [2, 0], [2, 0], [2, 0], [1, 2], [1, 0]]
28
211.78803420066833
28
6
18
[[["Green", "Green", "Red", "Green", "Red", "Red"], ["Green", "Red", "Blue", "Blue", "Red", "Blue"], ["Blue", "Green", "Blue", "Blue", "Red", "Green"]], 9]
[[["Green", "Green", "Red", "Green", "Red", "Red"], ["Green", "Red", "Blue", "Blue", "Red", "Blue"], ["Blue", "Green", "Blue", "Blue", "Red", "Green"]], 9]
["[['Green', 'Green', 'Red', 'Green', 'Red', 'Red'], ['Green', 'Red', 'Blue', 'Blue', 'Red', 'Blue'], ['Blue', 'Green', 'Blue', 'Blue', 'Red', 'Green']]", "9"]
90
We have a 4x4 numerical grid, with numbers ranging from 18 to 68 (18 included in the range but 68 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: [['20' 'x' '34' 'x'] ['x' 'x' '43' 'x'] ['x' 'x' '48' 'x'] ['65' 'x' 'x' '48']]
consecutive_grid
underdetermined_system
15
[[0, 3, 90], [1, 0, 46], [1, 2, 69], [2, 1, 66], [2, 2, 67], [2, 3, 68], [3, 0, 86], [3, 2, 43], [3, 3, 42]]
787
36.04757237434387
9
50
16
["[['45', '60', '89', ''], ['', '65', '', '84'], ['55', '', '', ''], ['', '85', '', '']]", 42, 97]
["[['45', '60', '89', ''], ['', '65', '', '84'], ['55', '', '', ''], ['', '85', '', '']]", 42, 97]
["[['45', '60', '89', ''], ['', '65', '', '84'], ['55', '', '', ''], ['', '85', '', '']]", "42", "97"]
90
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 22 to 68. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 143, 170, None for columns 1 to 2 respectively, and the sums of rows must be None, 211, 161, 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 146. 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' '32' 'x'] ['37' '61' 'x' '54'] ['x' 'x' 'x' '62'] ['x' '30' 'x' '44']]
magic_square
underdetermined_system
7
[[0, 0, 22], [0, 1, 23], [0, 3, 27], [1, 2, 59], [2, 0, 24], [2, 1, 29], [2, 2, 46], [3, 0, 31], [3, 2, 33]]
614
16.494971752166748
9
36
16
["[['', '', '32', ''], ['37', '61', '', '54'], ['', '', '', '62'], ['', '30', '', '44']]", 4, 22, 68]
["[['', '', '32', ''], ['37', '61', '', '54'], ['', '', '', '62'], ['', '30', '', '44']]", 22, 68, [1, 3], [1, 3], [143, 170], [211, 161], 146]
["[['', '', '32', ''], ['37', '61', '', '54'], ['', '', '', '62'], ['', '30', '', '44']]", "22", "68", "[None, 143, 170, None]", "[None, 211, 161, None]", "146"]
90
In 'Restricted Sorting', there are 12 stacks each with a capacity of 7 blocks, with 6 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 6 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: 7, 2: 2, 3: 2, 4: 4, 5: 13, 6: 4, 7: 6, 8: 8, 9: 6, 10: 10, 11: 10}, 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? [['Pink', 'Black', 'Red', 'White', 'White', 'Black', 'Pink'], [], [], ['Green', 'Green', 'Blue', 'White', 'Pink', 'Pink', 'White'], [], ['Blue', 'Yellow', 'Yellow', 'Black', 'White', 'Green', 'Red'], ['Blue', 'Yellow', 'Blue', 'White', 'Green', 'Red', 'Pink'], ['Pink', 'Yellow', 'Yellow', 'Green', 'Green', 'Black', 'Blue'], [], ['Blue', 'Red', 'Red', 'Black', 'Black', 'Red', 'Yellow'], [], []]
restricted_sorting
sorting
4
[[3, 2], [3, 2], [3, 4], [5, 4], [9, 4], [0, 1], [7, 1], [7, 8], [7, 8], [6, 4], [6, 8], [6, 4], [0, 10], [0, 11], [5, 8], [5, 8], [5, 10], [7, 2], [7, 2], [7, 10], [7, 4], [3, 7], [5, 7], [5, 2], [6, 7], [6, 2], [3, 1], [3, 1], [0, 7], [0, 7], [3, 7], [0, 3], [0, 1], [6, 0], [9, 0], [9, 0], [9, 3], [9, 3], [9, 0], [9, 8], [6, 1], [5, 0], [10, 3], [10, 3], [10, 3], [11, 0]]
226
9.712183237075806
46
132
42
[[["Pink", "Black", "Red", "White", "White", "Black", "Pink"], [], [], ["Green", "Green", "Blue", "White", "Pink", "Pink", "White"], [], ["Blue", "Yellow", "Yellow", "Black", "White", "Green", "Red"], ["Blue", "Yellow", "Blue", "White", "Green", "Red", "Pink"], ["Pink", "Yellow", "Yellow", "Green", "Green", "Black", "Blue"], [], ["Blue", "Red", "Red", "Black", "Black", "Red", "Yellow"], [], []], 7, {"0": 2, "1": 7, "2": 2, "3": 2, "4": 4, "5": 13, "6": 4, "7": 6, "8": 8, "9": 6, "10": 10, "11": 10}]
[[["Pink", "Black", "Red", "White", "White", "Black", "Pink"], [], [], ["Green", "Green", "Blue", "White", "Pink", "Pink", "White"], [], ["Blue", "Yellow", "Yellow", "Black", "White", "Green", "Red"], ["Blue", "Yellow", "Blue", "White", "Green", "Red", "Pink"], ["Pink", "Yellow", "Yellow", "Green", "Green", "Black", "Blue"], [], ["Blue", "Red", "Red", "Black", "Black", "Red", "Yellow"], [], []], 7, {"0": 2, "1": 7, "2": 2, "3": 2, "4": 4, "5": 13, "6": 4, "7": 6, "8": 8, "9": 6, "10": 10, "11": 10}, 6]
["[['Pink', 'Black', 'Red', 'White', 'White', 'Black', 'Pink'], [], [], ['Green', 'Green', 'Blue', 'White', 'Pink', 'Pink', 'White'], [], ['Blue', 'Yellow', 'Yellow', 'Black', 'White', 'Green', 'Red'], ['Blue', 'Yellow', 'Blue', 'White', 'Green', 'Red', 'Pink'], ['Pink', 'Yellow', 'Yellow', 'Green', 'Green', 'Black', 'Blue'], [], ['Blue', 'Red', 'Red', 'Black', 'Black', 'Red', 'Yellow'], [], []]", "{0: 2, 1: 7, 2: 2, 3: 2, 4: 4, 5: 13, 6: 4, 7: 6, 8: 8, 9: 6, 10: 10, 11: 10}", "7", "6"]
90
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, 0) to his destination workshop at index (4, 13), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 4, district 2 covering rows 5 to 6, and district 3 covering rows 7 to 13. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path. [x x x x x x x x x 15 x x 19 1] [x 12 x 19 x x 13 x 14 13 8 x 1 6] [x 17 x 19 5 4 x x 12 x x 10 14 x] [x 18 x 1 x 14 x x 12 x 11 4 4 7] [2 15 x x x 14 x 16 5 2 4 x 10 2] [8 2 15 18 19 6 13 7 6 x x x 1 x] [5 x 11 2 8 8 x 1 10 8 13 7 12 18] [x 18 8 19 x x 16 11 2 x 9 x 9 8] [4 10 x 12 12 13 13 2 13 x x x 8 18] [1 x x x 5 12 18 16 5 17 x 16 11 18] [19 x x x x 1 x x x x 10 19 x x] [x 14 x x x 15 16 9 x x x x x x] [6 x 16 18 6 x 18 x 5 x x x 6 1] [x x x 17 4 x 6 x x 19 17 x 19 15]
traffic
pathfinding
6
[[6, 0], [5, 0], [5, 1], [5, 2], [6, 2], [7, 2], [6, 2], [6, 3], [6, 4], [6, 5], [5, 5], [5, 6], [5, 7], [5, 8], [4, 8], [4, 9], [4, 10], [3, 10], [3, 11], [3, 12], [3, 13], [4, 13]]
144
0.032550811767578125
22
4
4
[[["x", "x", "x", "x", "x", "x", "x", "x", "x", "15", "x", "x", "19", "1"], ["x", "12", "x", "19", "x", "x", "13", "x", "14", "13", "8", "x", "1", "6"], ["x", "17", "x", "19", "5", "4", "x", "x", "12", "x", "x", "10", "14", "x"], ["x", "18", "x", "1", "x", "14", "x", "x", "12", "x", "11", "4", "4", "7"], ["2", "15", "x", "x", "x", "14", "x", "16", "5", "2", "4", "x", "10", "2"], ["8", "2", "15", "18", "19", "6", "13", "7", "6", "x", "x", "x", "1", "x"], ["5", "x", "11", "2", "8", "8", "x", "1", "10", "8", "13", "7", "12", "18"], ["x", "18", "8", "19", "x", "x", "16", "11", "2", "x", "9", "x", "9", "8"], ["4", "10", "x", "12", "12", "13", "13", "2", "13", "x", "x", "x", "8", "18"], ["1", "x", "x", "x", "5", "12", "18", "16", "5", "17", "x", "16", "11", "18"], ["19", "x", "x", "x", "x", "1", "x", "x", "x", "x", "10", "19", "x", "x"], ["x", "14", "x", "x", "x", "15", "16", "9", "x", "x", "x", "x", "x", "x"], ["6", "x", "16", "18", "6", "x", "18", "x", "5", "x", "x", "x", "6", "1"], ["x", "x", "x", "17", "4", "x", "6", "x", "x", "19", "17", "x", "19", "15"]]]
[[["x", "x", "x", "x", "x", "x", "x", "x", "x", "15", "x", "x", "19", "1"], ["x", "12", "x", "19", "x", "x", "13", "x", "14", "13", "8", "x", "1", "6"], ["x", "17", "x", "19", "5", "4", "x", "x", "12", "x", "x", "10", "14", "x"], ["x", "18", "x", "1", "x", "14", "x", "x", "12", "x", "11", "4", "4", "7"], ["2", "15", "x", "x", "x", "14", "x", "16", "5", "2", "4", "x", "10", "2"], ["8", "2", "15", "18", "19", "6", "13", "7", "6", "x", "x", "x", "1", "x"], ["5", "x", "11", "2", "8", "8", "x", "1", "10", "8", "13", "7", "12", "18"], ["x", "18", "8", "19", "x", "x", "16", "11", "2", "x", "9", "x", "9", "8"], ["4", "10", "x", "12", "12", "13", "13", "2", "13", "x", "x", "x", "8", "18"], ["1", "x", "x", "x", "5", "12", "18", "16", "5", "17", "x", "16", "11", "18"], ["19", "x", "x", "x", "x", "1", "x", "x", "x", "x", "10", "19", "x", "x"], ["x", "14", "x", "x", "x", "15", "16", "9", "x", "x", "x", "x", "x", "x"], ["6", "x", "16", "18", "6", "x", "18", "x", "5", "x", "x", "x", "6", "1"], ["x", "x", "x", "17", "4", "x", "6", "x", "x", "19", "17", "x", "19", "15"]], [6, 0], [4, 13], 4, 6]
["[['x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', '15', 'x', 'x', '19', '1'], ['x', '12', 'x', '19', 'x', 'x', '13', 'x', '14', '13', '8', 'x', '1', '6'], ['x', '17', 'x', '19', '5', '4', 'x', 'x', '12', 'x', 'x', '10', '14', 'x'], ['x', '18', 'x', '1', 'x', '14', 'x', 'x', '12', 'x', '11', '4', '4', '7'], ['2', '15', 'x', 'x', 'x', '14', 'x', '16', '5', '2', '4', 'x', '10', '2'], ['8', '2', '15', '18', '19', '6', '13', '7', '6', 'x', 'x', 'x', '1', 'x'], ['5', 'x', '11', '2', '8', '8', 'x', '1', '10', '8', '13', '7', '12', '18'], ['x', '18', '8', '19', 'x', 'x', '16', '11', '2', 'x', '9', 'x', '9', '8'], ['4', '10', 'x', '12', '12', '13', '13', '2', '13', 'x', 'x', 'x', '8', '18'], ['1', 'x', 'x', 'x', '5', '12', '18', '16', '5', '17', 'x', '16', '11', '18'], ['19', 'x', 'x', 'x', 'x', '1', 'x', 'x', 'x', 'x', '10', '19', 'x', 'x'], ['x', '14', 'x', 'x', 'x', '15', '16', '9', 'x', 'x', 'x', 'x', 'x', 'x'], ['6', 'x', '16', '18', '6', 'x', '18', 'x', '5', 'x', 'x', 'x', '6', '1'], ['x', 'x', 'x', '17', '4', 'x', '6', 'x', 'x', '19', '17', 'x', '19', '15']]", "(6, 0)", "(4, 13)", "4", "6"]
90
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 14x14. 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 (12, 11) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (0, 4). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 1 1 1 1 0 0 1 1 1 0 0 1 0 1 0 1 0 0 0 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1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0], [1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0], [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1]]", "(12, 11)", "(0, 4)", "4"]
90
Given 7 labeled water jugs with capacities 88, 125, 100, 62, 134, 89, 33, 133 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 306, 407, 457, 518 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax.
water_jug
subset_sum
6
[["+", 125, 4], ["+", 125, 4], ["+", 134, 4], ["+", 134, 4], ["+", 89, 3], ["+", 100, 3], ["+", 134, 3], ["+", 134, 3], ["+", 133, 2], ["+", 133, 2], ["+", 133, 2], ["-", 125, 2], ["+", 133, 2], ["+", 89, 1], ["+", 125, 1], ["-", 33, 1], ["+", 125, 1]]
17
0.05500078201293945
17
64
3
[[88, 125, 100, 62, 134, 89, 33, 133], [306, 407, 457, 518]]
[[88, 125, 100, 62, 134, 89, 33, 133], [306, 407, 457, 518]]
["[88, 125, 100, 62, 134, 89, 33, 133]", "[306, 407, 457, 518]"]
91
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, 81, 68, 57, 28, 6], [55, 54, 58, 69, 38, 10], [21, '_', 19, 44, 51, 18]]
8_puzzle
puzzle
5
[19, 44, 51, 18, 10, 6, 28, 57, 68, 58, 69, 68, 58, 69, 44, 51, 18, 10, 6, 28, 57, 58, 68, 44, 51, 18, 10, 6]
28
0.08781838417053223
28
4
18
[[[93, 81, 68, 57, 28, 6], [55, 54, 58, 69, 38, 10], [21, "_", 19, 44, 51, 18]]]
[[[93, 81, 68, 57, 28, 6], [55, 54, 58, 69, 38, 10], [21, "_", 19, 44, 51, 18]]]
["[[93, 81, 68, 57, 28, 6], [55, 54, 58, 69, 38, 10], [21, '_', 19, 44, 51, 18]]"]
91
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: peppy, stocky, pistol, swathe, cancan The initial board: [['t', 'p', 'c', 'p', 'o', 'y'], ['s', 'e', 'o', 't', 'k', 's'], ['p', 'i', 'w', 't', '_', 'l'], ['s', 'n', 'a', 'y', 'h', 'a'], ['c', 'a', 'e', 'c', 'p', 'n']]
8_puzzle_words
puzzle
4
["down-left", "down-left", "up-left", "up-right", "up-right", "down-right", "down-left", "down-right", "up-right", "up-left", "up-right", "up-left", "down-left", "down-right", "down-left", "up-left", "up-right", "down-right", "up-right", "up-left", "down-left", "up-left", "down-left", "up-left"]
24
0.4025259017944336
24
4
30
[[["t", "p", "c", "p", "o", "y"], ["s", "e", "o", "t", "k", "s"], ["p", "i", "w", "t", "_", "l"], ["s", "n", "a", "y", "h", "a"], ["c", "a", "e", "c", "p", "n"]]]
[[["t", "p", "c", "p", "o", "y"], ["s", "e", "o", "t", "k", "s"], ["p", "i", "w", "t", "_", "l"], ["s", "n", "a", "y", "h", "a"], ["c", "a", "e", "c", "p", "n"]], ["peppy", "stocky", "pistol", "swathe", "cancan"]]
["[['t', 'p', 'c', 'p', 'o', 'y'], ['s', 'e', 'o', 't', 'k', 's'], ['p', 'i', 'w', 't', '_', 'l'], ['s', 'n', 'a', 'y', 'h', 'a'], ['c', 'a', 'e', 'c', 'p', 'n']]", "['peppy', 'stocky', 'pistol', 'swathe', 'cancan']"]
91
We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'A'. Our task is to visit city G and city O 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 O and G, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax. O F U W T Y A Z S G X H D M Q O 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 F 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 U 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 W 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 T 1 0 0 0 0 0 1 0 0 1 0 1 0 0 1 Y 0 0 1 0 1 0 1 0 1 0 0 1 0 0 0 A 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 Z 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 S 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 G 0 1 0 0 1 1 0 1 1 0 1 0 0 0 1 X 0 0 0 0 1 1 0 1 0 1 0 0 0 1 0 H 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 D 1 1 1 1 1 0 0 0 0 1 0 0 0 0 0 M 0 1 0 1 0 0 0 0 1 1 0 0 0 0 0 Q 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0
city_directed_graph
pathfinding
15
["A", "H", "D", "G", "T", "O", "F", "O", "M", "G"]
10
0.059241533279418945
10
15
18
[[[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1], [0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1], [0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0], [1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0]], ["O", "F", "U", "W", "T", "Y", "A", "Z", "S", "G", "X", "H", "D", "M", "Q"], "G", "O"]
[[[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0,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 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0], [1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0]]", "['O', 'F', 'U', 'W', 'T', 'Y', 'A', 'Z', 'S', 'G', 'X', 'H', 'D', 'M', 'Q']", "['A']", "['G', 'O']"]
91
In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [36, 40, 17, 7, 15, 23, 18, 26, 29, 24, 15, 43, 13, 12, 31, 33, 30, 31, 26, 37, 14, 31, 43, 25, 30, 7, 37, 27, 221, 13, 26, 21], such that the sum of the chosen coins adds up to 445. 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 {36: 14, 27: 19, 21: 6, 13: 8, 23: 17, 26: 17, 15: 6, 25: 7, 31: 20, 30: 5, 18: 14, 12: 6, 37: 2, 221: 18, 14: 13, 24: 10, 33: 4, 43: 11, 29: 18, 40: 1, 7: 6, 17: 2}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax.
coin_exchange
subset_sum
21
[17, 33, 37, 37, 30, 221, 40, 30]
39
0.04606795310974121
8
32
32
[[36, 40, 17, 7, 15, 23, 18, 26, 29, 24, 15, 43, 13, 12, 31, 33, 30, 31, 26, 37, 14, 31, 43, 25, 30, 7, 37, 27, 221, 13, 26, 21]]
[[36, 40, 17, 7, 15, 23, 18, 26, 29, 24, 15, 43, 13, 12, 31, 33, 30, 31, 26, 37, 14, 31, 43, 25, 30, 7, 37, 27, 221, 13, 26, 21], {"36": 14, "27": 19, "21": 6, "13": 8, "23": 17, "26": 17, "15": 6, "25": 7, "31": 20, "30": 5, "18": 14, "12": 6, "37": 2, "221": 18, "14": 13, "24": 10, "33": 4, "43": 11, "29": 18, "40": 1, "7": 6, "17": 2}, 445]
["[36, 40, 17, 7, 15, 23, 18, 26, 29, 24, 15, 43, 13, 12, 31, 33, 30, 31, 26, 37, 14, 31, 43, 25, 30, 7, 37, 27, 221, 13, 26, 21]", "{36: 14, 27: 19, 21: 6, 13: 8, 23: 17, 26: 17, 15: 6, 25: 7, 31: 20, 30: 5, 18: 14, 12: 6, 37: 2, 221: 18, 14: 13, 24: 10, 33: 4, 43: 11, 29: 18, 40: 1, 7: 6, 17: 2}", "445"]
91
The game of 'Sort It' begins with 3 tubes, each filled with 6 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 9 balls. It is not allowed to place a ball in a tube that already has 9 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Green', 'Blue', 'Red', 'Blue', 'Blue'], ['Red', 'Blue', 'Green', 'Green', 'Blue', 'Red'], ['Green', 'Green', 'Red', 'Blue', 'Green', 'Red']]
color_sorting
sorting
10
[[0, 1], [2, 0], [2, 0], [2, 1], [2, 0], [2, 0], [1, 2], [1, 2], [1, 2], [0, 2], [0, 2], [1, 2], [1, 0], [1, 0], [1, 2], [1, 2], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [2, 1], [0, 2], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [1, 2], [0, 1]]
32
75.25922632217407
32
6
18
[[["Red", "Green", "Blue", "Red", "Blue", "Blue"], ["Red", "Blue", "Green", "Green", "Blue", "Red"], ["Green", "Green", "Red", "Blue", "Green", "Red"]], 9]
[[["Red", "Green", "Blue", "Red", "Blue", "Blue"], ["Red", "Blue", "Green", "Green", "Blue", "Red"], ["Green", "Green", "Red", "Blue", "Green", "Red"]], 9]
["[['Red', 'Green', 'Blue', 'Red', 'Blue', 'Blue'], ['Red', 'Blue', 'Green', 'Green', 'Blue', 'Red'], ['Green', 'Green', 'Red', 'Blue', 'Green', 'Red']]", "9"]
91
We have a 4x4 numerical grid, with numbers ranging from 10 to 65 (10 included in the range but 65 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' '21' 'x' 'x'] ['18' '27' 'x' '51'] ['24' '29' 'x' 'x'] ['54' '33' '25' '12']]
consecutive_grid
underdetermined_system
11
[[0, 0, 18], [0, 1, 19], [0, 3, 39], [1, 0, 17], [1, 1, 20], [1, 3, 40], [2, 1, 21], [3, 1, 22], [3, 2, 23]]
410
5.110289812088013
9
55
16
["[['', '', '38', ''], ['', '', '33', ''], ['16', '', '28', '47'], ['14', '', '', '52']]", 14, 69]
["[['', '', '38', ''], ['', '', '33', ''], ['16', '', '28', '47'], ['14', '', '', '52']]", 14, 69]
["[['', '', '38', ''], ['', '', '33', ''], ['16', '', '28', '47'], ['14', '', '', '52']]", "14", "69"]
91
In the magic square problem, a 4x4 grid is filled with unique integers ranging from 22 to 68. Some numbers are already given, while others are unknown and represented as 'x'. The sums of columns must be None, 177, 192, None for columns 1 to 2 respectively, and the sums of rows must be None, 217, 193, 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: [['62' 'x' 'x' 'x'] ['x' '35' '60' 'x'] ['x' '39' 'x' '54'] ['x' '55' '34' 'x']]
magic_square
underdetermined_system
7
[[0, 1, 48], [0, 2, 31], [0, 3, 23], [1, 0, 56], [1, 3, 66], [2, 0, 33], [2, 2, 67], [3, 0, 27], [3, 3, 22]]
712
5.191744089126587
9
36
16
["[['62', '', '', ''], ['', '35', '60', ''], ['', '39', '', '54'], ['', '55', '34', '']]", 4, 22, 68]
["[['62', '', '', ''], ['', '35', '60', ''], ['', '39', '', '54'], ['', '55', '34', '']]", 22, 68, [1, 3], [1, 3], [177, 192], [217, 193], 149]
["[['62', '', '', ''], ['', '35', '60', ''], ['', '39', '', '54'], ['', '55', '34', '']]", "22", "68", "[None, 177, 192, None]", "[None, 217, 193, None]", "149"]
91
Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (5, 2) to his destination workshop at index (8, 14), 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 5, district 2 covering rows 6 to 7, and district 3 covering rows 8 to 14. 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 12 x 18 3 2 15 6 11 13 x 7 17 x] [13 x 20 13 5 2 x x 10 12 19 19 16 x 17] [12 12 7 x x x 9 x x 10 10 18 4 x x] [x 14 3 13 9 2 19 19 x x x 4 x 2 15] [x 14 2 x 3 x 10 11 x 4 x 12 4 x x] [x 9 7 16 x x 19 17 17 14 14 12 14 19 12] [2 x x 7 15 x x 13 x 8 1 1 x 14 19] [16 x 14 x x 6 x x 16 x x 9 10 18 4] [3 x x 3 x x x x 9 8 x 9 14 x 14] [x x x 4 19 x 4 15 x x x 17 x x x] [16 17 x x 13 x 18 5 x 14 x x x x x] [2 x 17 x x x x x x 12 3 8 x 2 9] [x x 14 7 11 x x 10 9 3 7 16 x 7 1] [x 12 14 1 x x 3 12 x 7 x x 8 x x] [x 2 x 15 2 x 14 16 13 19 16 1 11 x x]
traffic
pathfinding
7
[[5, 2], [4, 2], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [4, 6], [4, 7], [5, 7], [5, 8], [5, 9], [6, 9], [6, 10], [6, 11], [7, 11], [7, 12], [7, 13], [7, 14], [8, 14]]
182
0.028976917266845703
20
4
4
[[["x", "x", "12", "x", "18", "3", "2", "15", "6", "11", "13", "x", "7", "17", "x"], ["13", "x", "20", "13", "5", "2", "x", "x", "10", "12", "19", "19", "16", "x", "17"], ["12", "12", "7", "x", "x", "x", "9", "x", "x", "10", "10", "18", "4", "x", "x"], ["x", "14", "3", "13", "9", "2", "19", "19", "x", "x", "x", "4", "x", "2", "15"], ["x", "14", "2", "x", "3", "x", "10", "11", "x", "4", "x", "12", "4", "x", "x"], ["x", "9", "7", "16", "x", "x", "19", "17", "17", "14", "14", "12", "14", "19", "12"], ["2", "x", "x", "7", "15", "x", "x", "13", "x", "8", "1", "1", "x", "14", "19"], ["16", "x", "14", "x", "x", "6", "x", "x", "16", "x", "x", "9", "10", "18", "4"], ["3", "x", "x", "3", "x", "x", "x", "x", "9", "8", "x", "9", "14", "x", "14"], ["x", "x", "x", "4", "19", "x", "4", "15", "x", "x", "x", "17", "x", "x", "x"], ["16", "17", "x", "x", "13", "x", "18", "5", "x", "14", "x", "x", "x", "x", "x"], ["2", "x", "17", "x", "x", "x", "x", "x", "x", "12", "3", "8", "x", "2", "9"], ["x", "x", "14", "7", "11", "x", "x", "10", "9", "3", "7", "16", "x", "7", "1"], ["x", "12", "14", "1", "x", "x", "3", "12", "x", "7", "x", "x", "8", "x", "x"], ["x", "2", "x", "15", "2", "x", "14", "16", "13", "19", "16", "1", "11", "x", "x"]]]
[[["x", "x", "12", "x", "18", "3", "2", "15", "6", "11", "13", "x", "7", "17", "x"], ["13", "x", "20", "13", "5", "2", "x", "x", "10", "12", "19", "19", "16", "x", "17"], ["12", "12", "7", "x", "x", "x", "9", "x", "x", "10", "10", "18", "4", "x", "x"], ["x", "14", "3", "13", "9", "2", "19", "19", "x", "x", "x", "4", "x", "2", "15"], ["x", "14", "2", "x", "3", "x", "10", "11", "x", "4", "x", "12", "4", "x", "x"], ["x", "9", "7", "16", "x", "x", "19", "17", "17", "14", "14", "12", "14", "19", "12"], ["2", "x", "x", "7", "15", "x", "x", "13", "x", "8", "1", "1", "x", "14", "19"], ["16", "x", "14", "x", "x", "6", "x", "x", "16", "x", "x", "9", "10", "18", "4"], ["3", "x", "x", "3", "x", "x", "x", "x", "9", "8", "x", "9", "14", "x", "14"], ["x", "x", "x", "4", "19", "x", "4", "15", "x", "x", "x", "17", "x", "x", "x"], ["16", "17", "x", "x", "13", "x", "18", "5", "x", "14", "x", "x", "x", "x", "x"], ["2", "x", "17", "x", "x", "x", "x", "x", "x", "12", "3", "8", "x", "2", "9"], ["x", "x", "14", "7", "11", "x", "x", "10", "9", "3", "7", "16", "x", "7", "1"], ["x", "12", "14", "1", "x", "x", "3", "12", "x", "7", "x", "x", "8", "x", "x"], ["x", "2", "x", "15", "2", "x", "14", "16", "13", "19", "16", "1", "11", "x", "x"]], [5, 2], [8, 14], 5, 7]
["[['x', 'x', '12', 'x', '18', '3', '2', '15', '6', '11', '13', 'x', '7', '17', 'x'], ['13', 'x', '20', '13', '5', '2', 'x', 'x', '10', '12', '19', '19', '16', 'x', '17'], ['12', '12', '7', 'x', 'x', 'x', '9', 'x', 'x', '10', '10', '18', '4', 'x', 'x'], ['x', '14', '3', '13', '9', '2', '19', '19', 'x', 'x', 'x', '4', 'x', '2', '15'], ['x', '14', '2', 'x', '3', 'x', '10', '11', 'x', '4', 'x', '12', '4', 'x', 'x'], ['x', '9', '7', '16', 'x', 'x', '19', '17', '17', '14', '14', '12', '14', '19', '12'], ['2', 'x', 'x', '7', '15', 'x', 'x', '13', 'x', '8', '1', '1', 'x', '14', '19'], ['16', 'x', '14', 'x', 'x', '6', 'x', 'x', '16', 'x', 'x', '9', '10', '18', '4'], ['3', 'x', 'x', '3', 'x', 'x', 'x', 'x', '9', '8', 'x', '9', '14', 'x', '14'], ['x', 'x', 'x', '4', '19', 'x', '4', '15', 'x', 'x', 'x', '17', 'x', 'x', 'x'], ['16', '17', 'x', 'x', '13', 'x', '18', '5', 'x', '14', 'x', 'x', 'x', 'x', 'x'], ['2', 'x', '17', 'x', 'x', 'x', 'x', 'x', 'x', '12', '3', '8', 'x', '2', '9'], ['x', 'x', '14', '7', '11', 'x', 'x', '10', '9', '3', '7', '16', 'x', '7', '1'], ['x', '12', '14', '1', 'x', 'x', '3', '12', 'x', '7', 'x', 'x', '8', 'x', 'x'], ['x', '2', 'x', '15', '2', 'x', '14', '16', '13', '19', '16', '1', '11', 'x', 'x']]", "(5, 2)", "(8, 14)", "5", "7"]
91
Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 15x15. 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 5 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (14, 2) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (1, 9). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on. 0 1 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], [0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1], [0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1], [1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1], [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1], [0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1]]", "(14, 2)", "(1, 9)", "5"]
91
Given 9 labeled water jugs with capacities 51, 75, 112, 122, 54, 129, 31, 127, 113 liters, we aim to fill 4 unlabeled buckets, numbered 1 to 4 and arranged in a line in ascending order, with 338, 431, 493, 550 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
7
[["+", 75, 4], ["+", 112, 4], ["+", 112, 4], ["+", 122, 4], ["+", 129, 4], ["+", 112, 3], ["+", 127, 3], ["+", 127, 3], ["+", 127, 3], ["+", 51, 2], ["+", 122, 2], ["+", 129, 2], ["+", 129, 2], ["+", 112, 1], ["+", 113, 1], ["+", 113, 1]]
16
0.05792498588562012
16
72
3
[[51, 75, 112, 122, 54, 129, 31, 127, 113], [338, 431, 493, 550]]
[[51, 75, 112, 122, 54, 129, 31, 127, 113], [338, 431, 493, 550]]
["[51, 75, 112, 122, 54, 129, 31, 127, 113]", "[338, 431, 493, 550]"]