<jupyter_start><jupyter_text>Day 3<jupyter_code># import data
with open("input.txt", 'r') as file:
    arr = file.read().splitlines()

arr[0:3] # print first 3 lines<jupyter_output><empty_output><jupyter_text>Part 1<jupyter_code>position = 0
count = 0

for line in arr:
    if line[position] == "#":
        count += 1
    
    # wrap around if we hit the end of the line
    position = (position + 3)%len(line)
    
print(count)<jupyter_output>220<jupyter_text>Part 2<jupyter_code>def checkSlope(right, down):
    arr_selected=arr[::down]
    position = 0
    count = 0

    for line in arr_selected:
        if line[position] == "#":
            count += 1
        # wrap around if we hit the end of the line
        position = (position + right)%len(line)
    return count
slopes=[[3,1],[1,1],[5,1],[7,1],[1,2]]

prod = 1
for slope in slopes:
    treeNum = checkSlope(slope[0],slope[1])
    print("Right: ", slope[0],"Down: ", slope[1], "Trees: ", treeNum)
    prod *=treeNum   

print("Ans:", prod)<jupyter_output>Right:  3 Down:  1 Trees:  220
Right:  1 Down:  1 Trees:  70
Right:  5 Down:  1 Trees:  63
Right:  7 Down:  1 Trees:  76
Right:  1 Down:  2 Trees:  29
Ans: 2138320800
{'fraction_non_alphanumeric': 0.14527027027027026, 'fraction_numerical': 0.052364864864864864, 'mean_word_length': 3.340659340659341, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 11, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '270097', 'license': 'MIT', 'n_tokens_mistral': 489, 'n_tokens_neox': 453, 'n_words': 122, 'path': 'day3/.ipynb_checkpoints/AoC_day3-checkpoint.ipynb', 'repo_name': 'gnaprs/AoC-2020', 'size': '1184'}