<jupyter_start><jupyter_text>Part 1<jupyter_code>def check_correct(new_number_position, preamble_len,d):
    for i in range(new_number_position-preamble_len,new_number_position):
        for j in range(new_number_position-preamble_len+1,new_number_position):
            if d[i]+d[j]==d[new_number_position]:
                return True
    return False
dd={}
with open('input_day9.txt','r') as file:
    i=0
    for line in file:
        dd[i]=int(line.strip())
        i+=1     
def search_incorrect(preamble_len,d):
    for i in range(preamble_len,len(d)):
        if check_correct(i,preamble_len,d)==False:
            return (d[i],i)
search_incorrect(25,dd)<jupyter_output><empty_output><jupyter_text>Part 2<jupyter_code>for i in range(0,len(dd)):
    for j in range(i,len(dd)):
        nums=[dd[z] for z in range(i,j+1)]
        if sum(nums)==105950735:
            print(nums)
nums=[4117189, 4154061, 4424828, 4208390, 5060031, 4391939, 8942999, 5977809, 8491671, 5334788, 8808360, 5708469, 7418529, 5800654, 9709726, 6431377, 6969915]
max(nums)+min(nums)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13278388278388278, 'fraction_numerical': 0.12637362637362637, 'mean_word_length': 4.2548076923076925, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '153741', 'license': 'MIT', 'n_tokens_mistral': 532, 'n_tokens_neox': 438, 'n_words': 75, 'path': '2020/paula/day9/advent_code_day9.ipynb', 'repo_name': 'bbglab/adventofcode', 'size': '1092'}