<jupyter_start><jupyter_text>Let's try the sample first:<jupyter_code>import numpy as np
sample_fabric = np.zeros((8, 8))

for claim in sample:
    claim_id, edge_left, top_edge, width, height = claim
    sample_fabric[top_edge:top_edge+height, edge_left:edge_left+width] += 1

sample_fabric[sample_fabric >= 2].size<jupyter_output><empty_output><jupyter_text>Now let's try the real input.<jupyter_code>fabric = np.zeros((1000, 1000))

for claim in claims:
    claim_id, edge_left, top_edge, width, height = claim
    fabric[top_edge:top_edge+height, edge_left:edge_left+width] += 1

fabric[fabric >= 2].size<jupyter_output><empty_output><jupyter_text>part 2<jupyter_code>sample_fabric = np.zeros((8, 8))

for claim_id, edge_left, top_edge, width, height in sample:
    claim_id = int(claim_id.split('#')[1])
    sample_fabric[top_edge:top_edge+height, edge_left:edge_left+width] += claim_id
    vals = sample_fabric[top_edge:top_edge+height, edge_left:edge_left+width]
    vals[vals != claim_id] = np.nan
    sample_fabric[top_edge:top_edge+height, edge_left:edge_left+width] = vals

for claim_id, edge_left, top_edge, width, height in sample:
    claim_id = int(claim_id.split('#')[1])
    if sample_fabric[sample_fabric == claim_id].size == width * height:
        print(claim_id)
sample_fabric<jupyter_output><empty_output><jupyter_text>Now for real.<jupyter_code>fabric = np.zeros((1000, 1000))

for claim_id, edge_left, top_edge, width, height in claims:
    claim_id = int(claim_id.split('#')[1])
    fabric[top_edge:top_edge+height, edge_left:edge_left+width] += claim_id
    vals = fabric[top_edge:top_edge+height, edge_left:edge_left+width]
    vals[vals != claim_id] = np.nan
    fabric[top_edge:top_edge+height, edge_left:edge_left+width] = vals

for claim_id, edge_left, top_edge, width, height in claims:
    claim_id = int(claim_id.split('#')[1])
    if fabric[fabric == claim_id].size == width * height:
        print(claim_id)<jupyter_output>686
{'fraction_non_alphanumeric': 0.1289500509683996, 'fraction_numerical': 0.0163098878695209, 'mean_word_length': 6.164233576642336, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '568618', 'license': 'MIT', 'n_tokens_mistral': 769, 'n_tokens_neox': 722, 'n_words': 132, 'path': 'Problem 03.ipynb', 'repo_name': 'flothesof/advent_of_code2018', 'size': '1962'}