<commit_before>#!/usr/bin/python3

# Initially used brute-force approach to solve core problems
# Resulting solution was O(n^n)
# Ran brute-force for circle sizes 1-100 to identify pattern
# This solution implements the pattern in O(n)

max_size = input("? ")

solution_a = -1
solution_b = 0
b_additive = 1
for circle_size in range(1, max_size + 1):
    solution_a += 2
    if solution_a > circle_size:
        solution_a = 1
    solution_b += b_additive
    if solution_b == circle_size / 2 and circle_size % 2 == 0:
        b_additive = 2
    elif solution_b == circle_size and circle_size < max_size:
        solution_b = 0
        b_additive = 1

print "A:", solution_a
print "B:", solution_b<commit_msg>O(log(n)) Solution for Day #19<commit_after>#!/usr/bin/python3

# O(log(n)) solutions for Part 1 of Day #19

max_size = input("? ")

starting_circle = 1
while starting_circle * 2 < max_size:
    starting_circle *= 2

print "Part 1:", 1 + (2 * (max_size - starting_circle))

starting_circle = 1
while starting_circle * 3 <= max_size:
    starting_circle *= 3

print "Part 2:", starting_circle if starting_circle == max_size else max_size - starting_circle
{'fraction_non_alphanumeric': 0.10327022375215146, 'fraction_numerical': 0.029259896729776247, 'mean_word_length': 3.708502024291498, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, '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}}
{'dir': 'git-commits-cleaned', 'id': '1405978', 'n_tokens_mistral': 418, 'n_tokens_neox': 382, 'n_words': 125}