Files
adventcode2024/12/12.ipynb
2024-12-12 20:42:02 +01:00

162 lines
61 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"with open('input','r') as infile:\n",
" data=[list(line.strip()) for line in infile.readlines()]"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from scipy.ndimage import label\n",
"\n",
"directions = [\n",
" (1, -1, 0), #up\n",
" (2, 1, 0), #down\n",
" (4, 0, -1), #left\n",
" (8, 0, 1), #right\n",
"]\n",
"\n",
"\n",
"def find_clusters_matrix(grid):\n",
" grid = np.array(grid) # Convert to numpy array if not already\n",
" unique_types = np.unique(grid) # Get unique characters/types in the grid\n",
" clusters = [] # List to store clusters\n",
" \n",
" for char in unique_types: # Iterate over each unique character/type\n",
"\n",
" # Binary mask for current character\n",
" binary_map = (grid == char)\n",
" \n",
" # Identify islands (clusters) of the current character\n",
" labeled_map, num_features = label(binary_map)\n",
" \n",
" # Iterate over each cluster found for the current character\n",
" for cluster_id in range(1, num_features + 1):\n",
" cluster_mask = (labeled_map == cluster_id) # Mask for current cluster\n",
" size = cluster_mask.sum() # Size of the cluster\n",
" bordermaps = np.zeros(grid.shape,dtype=int) # Initialize map to store border information\n",
"\n",
" for x, y in zip(*np.where(cluster_mask)): # Iterate over each pixel in the cluster\n",
" for direction, dx, dy in directions: # Iterate over each direction (1-up, 2-down, 4-left, 8-right)\n",
" nx, ny = x + dx, y + dy\n",
" # Check if the pixel is on the border of the cluster \n",
" if nx < 0 or nx >= grid.shape[0] or ny < 0 or ny >= grid.shape[1] or grid[nx, ny] != char:\n",
" bordermaps[x][y] |= direction # Mark the direction as a border using bitwise OR and the \n",
" border_length = 0\n",
" border_sides = 0\n",
" for direction,dx,dy in directions: # Iterate over each direction (1-up, 2-down, 4-left, 8-right)\n",
" map = ((bordermaps & direction) != 0) # Convert the direction map to a binary array for each direction\n",
" border_length += np.sum(map) # Legacy code to calculate the total length of the border for Part 1\n",
" _, sides = label(map) # Label the connected straight segments of the border \n",
" border_sides += sides # Count the number of straight connected pieces of the border\n",
" clusters.append({\"type\": char, \"size\": size, \"border_length\": border_length, \"border_sides\":border_sides})\n",
" return clusters\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[{'type': np.str_('A'), 'size': np.int64(40), 'border_length': np.int64(36), 'border_sides': 26}, {'type': np.str_('A'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('A'), 'size': np.int64(59), 'border_length': np.int64(48), 'border_sides': 30}, {'type': np.str_('A'), 'size': np.int64(58), 'border_length': np.int64(56), 'border_sides': 32}, {'type': np.str_('A'), 'size': np.int64(4), 'border_length': np.int64(10), 'border_sides': 8}, {'type': np.str_('A'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('A'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('A'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('A'), 'size': np.int64(8), 'border_length': np.int64(12), 'border_sides': 6}, {'type': np.str_('A'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('A'), 'size': np.int64(100), 'border_length': np.int64(60), 'border_sides': 34}, {'type': np.str_('A'), 'size': np.int64(136), 'border_length': np.int64(82), 'border_sides': 50}, {'type': np.str_('A'), 'size': np.int64(10), 'border_length': np.int64(20), 'border_sides': 14}, {'type': np.str_('A'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('A'), 'size': np.int64(155), 'border_length': np.int64(146), 'border_sides': 100}, {'type': np.str_('A'), 'size': np.int64(85), 'border_length': np.int64(74), 'border_sides': 48}, {'type': np.str_('A'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('A'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('A'), 'size': np.int64(35), 'border_length': np.int64(32), 'border_sides': 20}, {'type': np.str_('B'), 'size': np.int64(68), 'border_length': np.int64(60), 'border_sides': 38}, {'type': np.str_('B'), 'size': np.int64(91), 'border_length': np.int64(76), 'border_sides': 44}, {'type': np.str_('B'), 'size': np.int64(104), 'border_length': np.int64(80), 'border_sides': 50}, {'type': np.str_('B'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(56), 'border_length': np.int64(42), 'border_sides': 26}, {'type': np.str_('B'), 'size': np.int64(4), 'border_length': np.int64(10), 'border_sides': 8}, {'type': np.str_('B'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('B'), 'size': np.int64(137), 'border_length': np.int64(88), 'border_sides': 56}, {'type': np.str_('B'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(11), 'border_length': np.int64(14), 'border_sides': 6}, {'type': np.str_('B'), 'size': np.int64(4), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(53), 'border_length': np.int64(38), 'border_sides': 12}, {'type': np.str_('B'), 'size': np.int64(93), 'border_length': np.int64(82), 'border_sides': 42}, {'type': np.str_('B'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('B'), 'size': np.int64(146), 'border_length': np.int64(86), 'border_sides': 50}, {'type': np.str_('B'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(30), 'border_length': np.int64(38), 'border_sides': 22}, {'type': np.str_('B'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(103), 'border_length': np.int64(82), 'border_sides': 54}, {'type': np.str_('B'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('B'), 'size': np.int64(86), 'border_length': np.int64(62), 'border_sides': 38}, {'type': np.str_('B'), 'size': np.int64(12), 'border_length': np.int64(18), 'border_sides': 8}, {'type': np.str_('B'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('B'), 'size': np.int64(90), 'border_length': np.int64(46), 'border_sides': 24}, {'type': np.str_('B'), 'size': np.int64(28), 'border_length': np.int64(28), 'border_sides': 20}, {'type': np.str_('C'), 'size': np.int64(9), 'border_length': np.int64(18), 'border_sides': 14}, {'type': np.str_('C'), 'size': np.int64(58), 'border_length': np.int64(46), 'border_sides': 30}, {'type': np.str_('C'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('C'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('C'), 'size': np.int64(202), 'border_length': np.int64(136), 'border_sides': 90}, {'type': np.str_('C'), 'size': np.int64(14), 'border_length': np.int64(20), 'border_sides': 12}, {'type': np.str_('C'), 'size': np.int64(5), 'border_length': np.int64(10), 'border_sides': 6}, {'type': np.str_('C'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('C'), 'size': np.int64(38), 'border_length': np.int64(50), 'border_sides': 28}, {'type': np.str_('C'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('C'), 'size': np.int64(88), 'border_length': np.int64(56), 'border_sides': 38}, {'type': np.str_('C'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('C'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('C'), 'size': np.int64(213), 'border_length': np.int64(98), 'border_sides': 66}, {'type': np.str_('C'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('C'), 'size': np.int64(115), 'border_length': np.int64(84), 'border_sides': 54}, {'type': np.str_('C'), 'size': np.int64(10), 'border_length': np.int64(16), 'border_sides': 10}, {'type': np.str_('C'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('C'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('D'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('D'), 'size': np.int64(35), 'border_length': np.int64(38), 'border_sides': 26}, {'type': np.str_('D'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('D'), 'size': np.int64(106), 'border_length': np.int64(86), 'border_sides': 50}, {'type': np.str_('D'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('D'), 'size': np.int64(5), 'border_length': np.int64(12), 'border_sides': 8}, {'type': np.str_('D'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('D'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('D'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('D'), 'size': np.int64(6), 'border_length': np.int64(14), 'border_sides': 6}, {'type': np.str_('D'), 'size': np.int64(122), 'border_length': np.int64(76), 'border_sides': 52}, {'type': np.str_('D'), 'size': np.int64(11), 'border_length': np.int64(18), 'border_sides': 12}, {'type': np.str_('D'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('D'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('D'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('D'), 'size': np.int64(23), 'border_length': np.int64(34), 'border_sides': 12}, {'type': np.str_('D'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('D'), 'size': np.int64(39), 'border_length': np.int64(38), 'border_sides': 24}, {'type': np.str_('D'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('D'), 'size': np.int64(17), 'border_length': np.int64(28), 'border_sides': 18}, {'type': np.str_('D'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('D'), 'size': np.int64(69), 'border_length': np.int64(50), 'border_sides': 26}, {'type': np.str_('D'), 'size': np.int64(7), 'border_length': np.int64(12), 'border_sides': 6}, {'type': np.str_('E'), 'size': np.int64(17), 'border_length': np.int64(26), 'border_sides': 14}, {'type': np.str_('E'), 'size': np.int64(6), 'border_length': np.int64(12), 'border_sides': 8}, {'type': np.str_('E'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('E'), 'size': np.int64(21), 'border_length': np.int64(26), 'border_sides': 16}, {'type': np.str_('E'), 'size': np.int64(4), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('E'), 'size': np.int64(101), 'border_length': np.int64(80), 'border_sides': 42}, {'type': np.str_('E'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('E'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('E'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('E'), 'size': np.int64(4), 'border_length': np.int64(10), 'border_sides': 4}, {'type': np.str_('E'), 'size': np.int64(79), 'border_length': np.int64(58), 'border_sides': 40}, {'type': np.str_('E'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('E'), 'size': np.int64(83), 'border_length': np.int64(54), 'border_sides': 36}, {'type': np.str_('E'), 'size': np.int64(111), 'border_length': np.int64(74), 'border_sides': 38}, {'type': np.str_('E'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('E'), 'size': np.int64(6), 'border_length': np.int64(14), 'border_sides': 10}, {'type': np.str_('E'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('E'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('E'), 'size': np.int64(22), 'border_length': np.int64(30), 'border_sides': 18}, {'type': np.str_('E'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('F'), 'size': np.int64(58), 'border_length': np.int64(50), 'border_sides': 32}, {'type': np.str_('F'), 'size': np.int64(98), 'border_length': np.int64(62), 'border_sides': 38}, {'type': np.str_('F'), 'size': np.int64(36), 'border_length': np.int64(38), 'border_sides': 28}, {'type': np.str_('F'), 'size': np.int64(32), 'border_length': np.int64(32), 'border_sides': 18}, {'type': np.str_('F'), 'size': np.int64(4), 'border_length': np.int64(10), 'border_sides': 8}, {'type': np.str_('F'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('F'), 'size': np.int64(5), 'border_length': np.int64(10), 'border_sides': 6}, {'type': np.str_('F'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('F'), 'size': np.int64(4), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('F'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('F'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('F'), 'size': np.int64(160), 'border_length': np.int64(98), 'border_sides': 54}, {'type': np.str_('F'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('F'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('F'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('F'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('F'), 'size': np.int64(66), 'border_length': np.int64(54), 'border_sides': 30}, {'type': np.str_('F'), 'size': np.int64(110), 'border_length': np.int64(82), 'border_sides': 56}, {'type': np.str_('F'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('F'), 'size': np.int64(37), 'border_length': np.int64(34), 'border_sides': 16}, {'type': np.str_('G'), 'size': np.int64(11), 'border_length': np.int64(18), 'border_sides': 10}, {'type': np.str_('G'), 'size': np.int64(200), 'border_length': np.int64(136), 'border_sides': 74}, {'type': np.str_('G'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('G'), 'size': np.int64(11), 'border_length': np.int64(18), 'border_sides': 12}, {'type': np.str_('G'), 'size': np.int64(141), 'border_length': np.int64(94), 'border_sides': 54}, {'type': np.str_('G'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('G'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('G'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('G'), 'size': np.int64(63), 'border_length': np.int64(56), 'border_sides': 32}, {'type': np.str_('G'), 'size': np.int64(4), 'border_length': np.int64(10), 'border_sides': 8}, {'type': np.str_('G'), 'size': np.int64(93), 'border_length': np.int64(44), 'border_sides': 12}, {'type': np.str_('G'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('G'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('G'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('G'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('G'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('G'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('H'), 'size': np.int64(166), 'border_length': np.int64(126), 'border_sides': 84}, {'type': np.str_('H'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('H'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('H'), 'size': np.int64(255), 'border_length': np.int64(150), 'border_sides': 80}, {'type': np.str_('H'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('H'), 'size': np.int64(83), 'border_length': np.int64(72), 'border_sides': 52}, {'type': np.str_('H'), 'size': np.int64(73), 'border_length': np.int64(56), 'border_sides': 34}, {'type': np.str_('H'), 'size': np.int64(55), 'border_length': np.int64(40), 'border_sides': 20}, {'type': np.str_('H'), 'size': np.int64(96), 'border_length': np.int64(70), 'border_sides': 44}, {'type': np.str_('H'), 'size': np.int64(21), 'border_length': np.int64(34), 'border_sides': 18}, {'type': np.str_('H'), 'size': np.int64(72), 'border_length': np.int64(40), 'border_sides': 10}, {'type': np.str_('H'), 'size': np.int64(109), 'border_length': np.int64(62), 'border_sides': 36}, {'type': np.str_('H'), 'size': np.int64(104), 'border_length': np.int64(78), 'border_sides': 58}, {'type': np.str_('H'), 'size': np.int64(139), 'border_length': np.int64(72), 'border_sides': 52}, {'type': np.str_('H'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('H'), 'size': np.int64(32), 'border_length': np.int64(38), 'border_sides': 22}, {'type': np.str_('H'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('H'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('H'), 'size': np.int64(8), 'border_length': np.int64(16), 'border_sides': 16}, {'type': np.str_('H'), 'size': np.int64(39), 'border_length': np.int64(44), 'border_sides': 26}, {'type': np.str_('H'), 'size': np.int64(34), 'border_length': np.int64(38), 'border_sides': 22}, {'type': np.str_('H'), 'size': np.int64(156), 'border_length': np.int64(62), 'border_sides': 24}, {'type': np.str_('H'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(191), 'border_length': np.int64(70), 'border_sides': 24}, {'type': np.str_('I'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(119), 'border_length': np.int64(82), 'border_sides': 56}, {'type': np.str_('I'), 'size': np.int64(59), 'border_length': np.int64(50), 'border_sides': 28}, {'type': np.str_('I'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(25), 'border_length': np.int64(30), 'border_sides': 20}, {'type': np.str_('I'), 'size': np.int64(6), 'border_length': np.int64(14), 'border_sides': 6}, {'type': np.str_('I'), 'size': np.int64(39), 'border_length': np.int64(50), 'border_sides': 30}, {'type': np.str_('I'), 'size': np.int64(64), 'border_length': np.int64(56), 'border_sides': 34}, {'type': np.str_('I'), 'size': np.int64(25), 'border_length': np.int64(28), 'border_sides': 18}, {'type': np.str_('I'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(20), 'border_length': np.int64(24), 'border_sides': 16}, {'type': np.str_('I'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(37), 'border_length': np.int64(40), 'border_sides': 28}, {'type': np.str_('I'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('I'), 'size': np.int64(57), 'border_length': np.int64(44), 'border_sides': 20}, {'type': np.str_('J'), 'size': np.int64(56), 'border_length': np.int64(56), 'border_sides': 38}, {'type': np.str_('J'), 'size': np.int64(91), 'border_length': np.int64(78), 'border_sides': 46}, {'type': np.str_('J'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('J'), 'size': np.int64(28), 'border_length': np.int64(34), 'border_sides': 20}, {'type': np.str_('J'), 'size': np.int64(63), 'border_length': np.int64(56), 'border_sides': 34}, {'type': np.str_('J'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('J'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('J'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('J'), 'size': np.int64(69), 'border_length': np.int64(54), 'border_sides': 34}, {'type': np.str_('J'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('J'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('J'), 'size': np.int64(13), 'border_length': np.int64(22), 'border_sides': 10}, {'type': np.str_('J'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('J'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(72), 'border_length': np.int64(64), 'border_sides': 38}, {'type': np.str_('K'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('K'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(19), 'border_length': np.int64(22), 'border_sides': 12}, {'type': np.str_('K'), 'size': np.int64(55), 'border_length': np.int64(52), 'border_sides': 36}, {'type': np.str_('K'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(5), 'border_length': np.int64(12), 'border_sides': 8}, {'type': np.str_('K'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(18), 'border_length': np.int64(18), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(64), 'border_length': np.int64(56), 'border_sides': 42}, {'type': np.str_('K'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(128), 'border_length': np.int64(78), 'border_sides': 46}, {'type': np.str_('K'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('K'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('L'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('L'), 'size': np.int64(136), 'border_length': np.int64(78), 'border_sides': 48}, {'type': np.str_('L'), 'size': np.int64(16), 'border_length': np.int64(26), 'border_sides': 16}, {'type': np.str_('L'), 'size': np.int64(10), 'border_length': np.int64(20), 'border_sides': 10}, {'type': np.str_('L'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('L'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('L'), 'size': np.int64(64), 'border_length': np.int64(56), 'border_sides': 38}, {'type': np.str_('L'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('L'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('L'), 'size': np.int64(28), 'border_length': np.int64(36), 'border_sides': 24}, {'type': np.str_('L'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('L'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('L'), 'size': np.int64(5), 'border_length': np.int64(10), 'border_sides': 6}, {'type': np.str_('L'), 'size': np.int64(47), 'border_length': np.int64(46), 'border_sides': 32}, {'type': np.str_('L'), 'size': np.int64(97), 'border_length': np.int64(68), 'border_sides': 38}, {'type': np.str_('L'), 'size': np.int64(126), 'border_length': np.int64(78), 'border_sides': 48}, {'type': np.str_('L'), 'size': np.int64(11), 'border_length': np.int64(20), 'border_sides': 12}, {'type': np.str_('L'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('L'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('L'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(49), 'border_length': np.int64(46), 'border_sides': 30}, {'type': np.str_('M'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(86), 'border_length': np.int64(60), 'border_sides': 28}, {'type': np.str_('M'), 'size': np.int64(51), 'border_length': np.int64(46), 'border_sides': 26}, {'type': np.str_('M'), 'size': np.int64(41), 'border_length': np.int64(42), 'border_sides': 28}, {'type': np.str_('M'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(6), 'border_length': np.int64(12), 'border_sides': 8}, {'type': np.str_('M'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(27), 'border_length': np.int64(44), 'border_sides': 32}, {'type': np.str_('M'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(122), 'border_length': np.int64(72), 'border_sides': 52}, {'type': np.str_('M'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(4), 'border_length': np.int64(10), 'border_sides': 6}, {'type': np.str_('M'), 'size': np.int64(191), 'border_length': np.int64(74), 'border_sides': 16}, {'type': np.str_('M'), 'size': np.int64(125), 'border_length': np.int64(58), 'border_sides': 14}, {'type': np.str_('M'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(54), 'border_length': np.int64(48), 'border_sides': 32}, {'type': np.str_('M'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('M'), 'size': np.int64(146), 'border_length': np.int64(86), 'border_sides': 52}, {'type': np.str_('M'), 'size': np.int64(13), 'border_length': np.int64(22), 'border_sides': 14}, {'type': np.str_('N'), 'size': np.int64(5), 'border_length': np.int64(12), 'border_sides': 6}, {'type': np.str_('N'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(7), 'border_length': np.int64(16), 'border_sides': 10}, {'type': np.str_('N'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(46), 'border_length': np.int64(44), 'border_sides': 32}, {'type': np.str_('N'), 'size': np.int64(10), 'border_length': np.int64(16), 'border_sides': 12}, {'type': np.str_('N'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(22), 'border_length': np.int64(28), 'border_sides': 16}, {'type': np.str_('N'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(97), 'border_length': np.int64(72), 'border_sides': 40}, {'type': np.str_('N'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(131), 'border_length': np.int64(106), 'border_sides': 76}, {'type': np.str_('N'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(5), 'border_length': np.int64(10), 'border_sides': 6}, {'type': np.str_('N'), 'size': np.int64(29), 'border_length': np.int64(36), 'border_sides': 14}, {'type': np.str_('N'), 'size': np.int64(7), 'border_length': np.int64(14), 'border_sides': 10}, {'type': np.str_('N'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(28), 'border_length': np.int64(34), 'border_sides': 18}, {'type': np.str_('N'), 'size': np.int64(105), 'border_length': np.int64(88), 'border_sides': 64}, {'type': np.str_('N'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(6), 'border_length': np.int64(14), 'border_sides': 10}, {'type': np.str_('N'), 'size': np.int64(22), 'border_length': np.int64(36), 'border_sides': 26}, {'type': np.str_('N'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('N'), 'size': np.int64(5), 'border_length': np.int64(12), 'border_sides': 6}, {'type': np.str_('N'), 'size': np.int64(35), 'border_length': np.int64(38), 'border_sides': 20}, {'type': np.str_('O'), 'size': np.int64(59), 'border_length': np.int64(46), 'border_sides': 28}, {'type': np.str_('O'), 'size': np.int64(38), 'border_length': np.int64(40), 'border_sides': 16}, {'type': np.str_('O'), 'size': np.int64(42), 'border_length': np.int64(52), 'border_sides': 34}, {'type': np.str_('O'), 'size': np.int64(7), 'border_length': np.int64(14), 'border_sides': 10}, {'type': np.str_('O'), 'size': np.int64(121), 'border_length': np.int64(56), 'border_sides': 12}, {'type': np.str_('O'), 'size': np.int64(89), 'border_length': np.int64(78), 'border_sides': 50}, {'type': np.str_('O'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('O'), 'size': np.int64(13), 'border_length': np.int64(28), 'border_sides': 20}, {'type': np.str_('O'), 'size': np.int64(74), 'border_length': np.int64(80), 'border_sides': 54}, {'type': np.str_('O'), 'size': np.int64(20), 'border_length': np.int64(32), 'border_sides': 22}, {'type': np.str_('O'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('O'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('O'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('O'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('O'), 'size': np.int64(8), 'border_length': np.int64(16), 'border_sides': 12}, {'type': np.str_('O'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('O'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('O'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('O'), 'size': np.int64(54), 'border_length': np.int64(52), 'border_sides': 34}, {'type': np.str_('O'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('O'), 'size': np.int64(82), 'border_length': np.int64(62), 'border_sides': 36}, {'type': np.str_('P'), 'size': np.int64(145), 'border_length': np.int64(98), 'border_sides': 66}, {'type': np.str_('P'), 'size': np.int64(15), 'border_length': np.int64(26), 'border_sides': 18}, {'type': np.str_('P'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(26), 'border_length': np.int64(34), 'border_sides': 20}, {'type': np.str_('P'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(78), 'border_length': np.int64(76), 'border_sides': 52}, {'type': np.str_('P'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(4), 'border_length': np.int64(10), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(23), 'border_length': np.int64(34), 'border_sides': 18}, {'type': np.str_('P'), 'size': np.int64(290), 'border_length': np.int64(176), 'border_sides': 112}, {'type': np.str_('P'), 'size': np.int64(89), 'border_length': np.int64(70), 'border_sides': 48}, {'type': np.str_('P'), 'size': np.int64(104), 'border_length': np.int64(86), 'border_sides': 50}, {'type': np.str_('P'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(5), 'border_length': np.int64(12), 'border_sides': 10}, {'type': np.str_('P'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('P'), 'size': np.int64(186), 'border_length': np.int64(126), 'border_sides': 68}, {'type': np.str_('P'), 'size': np.int64(20), 'border_length': np.int64(22), 'border_sides': 14}, {'type': np.str_('P'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('Q'), 'size': np.int64(88), 'border_length': np.int64(72), 'border_sides': 38}, {'type': np.str_('Q'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Q'), 'size': np.int64(43), 'border_length': np.int64(46), 'border_sides': 34}, {'type': np.str_('Q'), 'size': np.int64(133), 'border_length': np.int64(92), 'border_sides': 60}, {'type': np.str_('Q'), 'size': np.int64(4), 'border_length': np.int64(10), 'border_sides': 6}, {'type': np.str_('Q'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('Q'), 'size': np.int64(117), 'border_length': np.int64(82), 'border_sides': 60}, {'type': np.str_('Q'), 'size': np.int64(12), 'border_length': np.int64(20), 'border_sides': 12}, {'type': np.str_('Q'), 'size': np.int64(119), 'border_length': np.int64(70), 'border_sides': 40}, {'type': np.str_('Q'), 'size': np.int64(55), 'border_length': np.int64(36), 'border_sides': 18}, {'type': np.str_('Q'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Q'), 'size': np.int64(15), 'border_length': np.int64(16), 'border_sides': 4}, {'type': np.str_('Q'), 'size': np.int64(37), 'border_length': np.int64(30), 'border_sides': 14}, {'type': np.str_('Q'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Q'), 'size': np.int64(108), 'border_length': np.int64(62), 'border_sides': 38}, {'type': np.str_('Q'), 'size': np.int64(16), 'border_length': np.int64(26), 'border_sides': 18}, {'type': np.str_('Q'), 'size': np.int64(59), 'border_length': np.int64(46), 'border_sides': 20}, {'type': np.str_('Q'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('R'), 'size': np.int64(108), 'border_length': np.int64(76), 'border_sides': 48}, {'type': np.str_('R'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('R'), 'size': np.int64(121), 'border_length': np.int64(76), 'border_sides': 54}, {'type': np.str_('R'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('R'), 'size': np.int64(64), 'border_length': np.int64(54), 'border_sides': 30}, {'type': np.str_('R'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('R'), 'size': np.int64(144), 'border_length': np.int64(86), 'border_sides': 62}, {'type': np.str_('R'), 'size': np.int64(121), 'border_length': np.int64(100), 'border_sides': 62}, {'type': np.str_('R'), 'size': np.int64(4), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('R'), 'size': np.int64(4), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('R'), 'size': np.int64(31), 'border_length': np.int64(46), 'border_sides': 30}, {'type': np.str_('R'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('R'), 'size': np.int64(20), 'border_length': np.int64(28), 'border_sides': 16}, {'type': np.str_('R'), 'size': np.int64(5), 'border_length': np.int64(12), 'border_sides': 8}, {'type': np.str_('R'), 'size': np.int64(54), 'border_length': np.int64(44), 'border_sides': 26}, {'type': np.str_('R'), 'size': np.int64(10), 'border_length': np.int64(20), 'border_sides': 14}, {'type': np.str_('R'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('R'), 'size': np.int64(20), 'border_length': np.int64(26), 'border_sides': 16}, {'type': np.str_('R'), 'size': np.int64(7), 'border_length': np.int64(12), 'border_sides': 6}, {'type': np.str_('R'), 'size': np.int64(138), 'border_length': np.int64(84), 'border_sides': 54}, {'type': np.str_('R'), 'size': np.int64(6), 'border_length': np.int64(14), 'border_sides': 12}, {'type': np.str_('R'), 'size': np.int64(10), 'border_length': np.int64(18), 'border_sides': 16}, {'type': np.str_('R'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('R'), 'size': np.int64(33), 'border_length': np.int64(38), 'border_sides': 24}, {'type': np.str_('R'), 'size': np.int64(33), 'border_length': np.int64(28), 'border_sides': 14}, {'type': np.str_('R'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('R'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('S'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('S'), 'size': np.int64(122), 'border_length': np.int64(80), 'border_sides': 38}, {'type': np.str_('S'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('S'), 'size': np.int64(68), 'border_length': np.int64(66), 'border_sides': 40}, {'type': np.str_('S'), 'size': np.int64(15), 'border_length': np.int64(22), 'border_sides': 18}, {'type': np.str_('S'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('S'), 'size': np.int64(368), 'border_length': np.int64(158), 'border_sides': 62}, {'type': np.str_('S'), 'size': np.int64(66), 'border_length': np.int64(46), 'border_sides': 22}, {'type': np.str_('S'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('S'), 'size': np.int64(56), 'border_length': np.int64(56), 'border_sides': 42}, {'type': np.str_('S'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('S'), 'size': np.int64(30), 'border_length': np.int64(22), 'border_sides': 4}, {'type': np.str_('S'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('S'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('S'), 'size': np.int64(86), 'border_length': np.int64(56), 'border_sides': 36}, {'type': np.str_('S'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('S'), 'size': np.int64(89), 'border_length': np.int64(114), 'border_sides': 78}, {'type': np.str_('S'), 'size': np.int64(200), 'border_length': np.int64(136), 'border_sides': 96}, {'type': np.str_('S'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('S'), 'size': np.int64(47), 'border_length': np.int64(58), 'border_sides': 34}, {'type': np.str_('S'), 'size': np.int64(75), 'border_length': np.int64(62), 'border_sides': 42}, {'type': np.str_('S'), 'size': np.int64(126), 'border_length': np.int64(70), 'border_sides': 46}, {'type': np.str_('S'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('S'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(95), 'border_length': np.int64(54), 'border_sides': 10}, {'type': np.str_('T'), 'size': np.int64(9), 'border_length': np.int64(18), 'border_sides': 14}, {'type': np.str_('T'), 'size': np.int64(65), 'border_length': np.int64(60), 'border_sides': 38}, {'type': np.str_('T'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(17), 'border_length': np.int64(24), 'border_sides': 14}, {'type': np.str_('T'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(16), 'border_length': np.int64(24), 'border_sides': 18}, {'type': np.str_('T'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(139), 'border_length': np.int64(82), 'border_sides': 60}, {'type': np.str_('T'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(218), 'border_length': np.int64(150), 'border_sides': 94}, {'type': np.str_('T'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(18), 'border_length': np.int64(28), 'border_sides': 18}, {'type': np.str_('T'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(78), 'border_length': np.int64(70), 'border_sides': 52}, {'type': np.str_('T'), 'size': np.int64(97), 'border_length': np.int64(68), 'border_sides': 42}, {'type': np.str_('T'), 'size': np.int64(14), 'border_length': np.int64(24), 'border_sides': 12}, {'type': np.str_('T'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(178), 'border_length': np.int64(122), 'border_sides': 84}, {'type': np.str_('T'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('T'), 'size': np.int64(234), 'border_length': np.int64(166), 'border_sides': 94}, {'type': np.str_('T'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('U'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('U'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('U'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('U'), 'size': np.int64(41), 'border_length': np.int64(36), 'border_sides': 22}, {'type': np.str_('U'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('U'), 'size': np.int64(135), 'border_length': np.int64(124), 'border_sides': 84}, {'type': np.str_('U'), 'size': np.int64(135), 'border_length': np.int64(84), 'border_sides': 58}, {'type': np.str_('U'), 'size': np.int64(6), 'border_length': np.int64(14), 'border_sides': 12}, {'type': np.str_('U'), 'size': np.int64(10), 'border_length': np.int64(18), 'border_sides': 10}, {'type': np.str_('U'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('U'), 'size': np.int64(113), 'border_length': np.int64(82), 'border_sides': 46}, {'type': np.str_('U'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('U'), 'size': np.int64(39), 'border_length': np.int64(38), 'border_sides': 28}, {'type': np.str_('U'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('U'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('U'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('U'), 'size': np.int64(154), 'border_length': np.int64(122), 'border_sides': 78}, {'type': np.str_('U'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('U'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('U'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(69), 'border_length': np.int64(54), 'border_sides': 34}, {'type': np.str_('V'), 'size': np.int64(34), 'border_length': np.int64(38), 'border_sides': 22}, {'type': np.str_('V'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(128), 'border_length': np.int64(90), 'border_sides': 50}, {'type': np.str_('V'), 'size': np.int64(142), 'border_length': np.int64(88), 'border_sides': 52}, {'type': np.str_('V'), 'size': np.int64(24), 'border_length': np.int64(32), 'border_sides': 16}, {'type': np.str_('V'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(147), 'border_length': np.int64(104), 'border_sides': 64}, {'type': np.str_('V'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(7), 'border_length': np.int64(12), 'border_sides': 6}, {'type': np.str_('V'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(70), 'border_length': np.int64(56), 'border_sides': 38}, {'type': np.str_('V'), 'size': np.int64(5), 'border_length': np.int64(10), 'border_sides': 6}, {'type': np.str_('V'), 'size': np.int64(7), 'border_length': np.int64(16), 'border_sides': 10}, {'type': np.str_('V'), 'size': np.int64(19), 'border_length': np.int64(20), 'border_sides': 10}, {'type': np.str_('V'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(6), 'border_length': np.int64(10), 'border_sides': 4}, {'type': np.str_('V'), 'size': np.int64(77), 'border_length': np.int64(66), 'border_sides': 44}, {'type': np.str_('V'), 'size': np.int64(30), 'border_length': np.int64(28), 'border_sides': 20}, {'type': np.str_('V'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('W'), 'size': np.int64(23), 'border_length': np.int64(28), 'border_sides': 14}, {'type': np.str_('W'), 'size': np.int64(48), 'border_length': np.int64(54), 'border_sides': 32}, {'type': np.str_('W'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('W'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('W'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('W'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('W'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('W'), 'size': np.int64(119), 'border_length': np.int64(70), 'border_sides': 44}, {'type': np.str_('W'), 'size': np.int64(108), 'border_length': np.int64(96), 'border_sides': 58}, {'type': np.str_('W'), 'size': np.int64(143), 'border_length': np.int64(110), 'border_sides': 76}, {'type': np.str_('W'), 'size': np.int64(108), 'border_length': np.int64(94), 'border_sides': 62}, {'type': np.str_('W'), 'size': np.int64(78), 'border_length': np.int64(58), 'border_sides': 40}, {'type': np.str_('W'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('W'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('W'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('W'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('W'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('W'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('W'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(49), 'border_length': np.int64(58), 'border_sides': 34}, {'type': np.str_('X'), 'size': np.int64(60), 'border_length': np.int64(54), 'border_sides': 32}, {'type': np.str_('X'), 'size': np.int64(120), 'border_length': np.int64(86), 'border_sides': 58}, {'type': np.str_('X'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(83), 'border_length': np.int64(66), 'border_sides': 42}, {'type': np.str_('X'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(84), 'border_length': np.int64(56), 'border_sides': 38}, {'type': np.str_('X'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(73), 'border_length': np.int64(52), 'border_sides': 32}, {'type': np.str_('X'), 'size': np.int64(18), 'border_length': np.int64(28), 'border_sides': 16}, {'type': np.str_('X'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(75), 'border_length': np.int64(66), 'border_sides': 48}, {'type': np.str_('X'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(14), 'border_length': np.int64(26), 'border_sides': 12}, {'type': np.str_('X'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('X'), 'size': np.int64(5), 'border_length': np.int64(12), 'border_sides': 10}, {'type': np.str_('X'), 'size': np.int64(97), 'border_length': np.int64(76), 'border_sides': 38}, {'type': np.str_('Y'), 'size': np.int64(14), 'border_length': np.int64(30), 'border_sides': 16}, {'type': np.str_('Y'), 'size': np.int64(5), 'border_length': np.int64(12), 'border_sides': 6}, {'type': np.str_('Y'), 'size': np.int64(5), 'border_length': np.int64(12), 'border_sides': 8}, {'type': np.str_('Y'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(15), 'border_length': np.int64(20), 'border_sides': 10}, {'type': np.str_('Y'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 6}, {'type': np.str_('Y'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(4), 'border_length': np.int64(10), 'border_sides': 8}, {'type': np.str_('Y'), 'size': np.int64(14), 'border_length': np.int64(24), 'border_sides': 18}, {'type': np.str_('Y'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(91), 'border_length': np.int64(80), 'border_sides': 48}, {'type': np.str_('Y'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(41), 'border_length': np.int64(44), 'border_sides': 28}, {'type': np.str_('Y'), 'size': np.int64(30), 'border_length': np.int64(34), 'border_sides': 24}, {'type': np.str_('Y'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(22), 'border_length': np.int64(28), 'border_sides': 20}, {'type': np.str_('Y'), 'size': np.int64(31), 'border_length': np.int64(36), 'border_sides': 26}, {'type': np.str_('Y'), 'size': np.int64(17), 'border_length': np.int64(20), 'border_sides': 10}, {'type': np.str_('Y'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(61), 'border_length': np.int64(52), 'border_sides': 32}, {'type': np.str_('Y'), 'size': np.int64(19), 'border_length': np.int64(22), 'border_sides': 14}, {'type': np.str_('Y'), 'size': np.int64(40), 'border_length': np.int64(40), 'border_sides': 26}, {'type': np.str_('Y'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Y'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(6), 'border_length': np.int64(12), 'border_sides': 10}, {'type': np.str_('Z'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(50), 'border_length': np.int64(36), 'border_sides': 22}, {'type': np.str_('Z'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(3), 'border_length': np.int64(8), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(251), 'border_length': np.int64(118), 'border_sides': 70}, {'type': np.str_('Z'), 'size': np.int64(46), 'border_length': np.int64(38), 'border_sides': 26}, {'type': np.str_('Z'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(79), 'border_length': np.int64(54), 'border_sides': 34}, {'type': np.str_('Z'), 'size': np.int64(73), 'border_length': np.int64(62), 'border_sides': 42}, {'type': np.str_('Z'), 'size': np.int64(132), 'border_length': np.int64(76), 'border_sides': 32}, {'type': np.str_('Z'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(54), 'border_length': np.int64(48), 'border_sides': 26}, {'type': np.str_('Z'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(14), 'border_length': np.int64(22), 'border_sides': 10}, {'type': np.str_('Z'), 'size': np.int64(11), 'border_length': np.int64(16), 'border_sides': 6}, {'type': np.str_('Z'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(1), 'border_length': np.int64(4), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(2), 'border_length': np.int64(6), 'border_sides': 4}, {'type': np.str_('Z'), 'size': np.int64(8), 'border_length': np.int64(12), 'border_sides': 6}, {'type': np.str_('Z'), 'size': np.int64(10), 'border_length': np.int64(16), 'border_sides': 8}, {'type': np.str_('Z'), 'size': np.int64(111), 'border_length': np.int64(50), 'border_sides': 10}, {'type': np.str_('Z'), 'size': np.int64(9), 'border_length': np.int64(18), 'border_sides': 12}]\n"
]
}
],
"source": [
"clusters = find_clusters_matrix(data)\n",
"print(clusters)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Part 1"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"np.int64(1494342)"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sum(cluster['size']*cluster['border_length'] for cluster in clusters)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Part 2"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"np.int64(893676)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sum(cluster['size']*cluster['border_sides'] for cluster in clusters)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "advent",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}