<commit_before># A Pythagorean triplet is a set of three natural numbers, a < b < c, for which

# a^2 + b^2 = c^2
# For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.

# There exists exactly one Pythagorean triplet for which a + b + c = 1000.
# Find the product abc.

def pythagorean_triplet?(a, b, c)
  a ** 2 + b ** 2 == c ** 2
end

pythagorean_triplets = []

a = 1
until a == 1000
  b = a
  until b == 1000
    c = 1000 - (a + b)
    pythagorean_triplets << [a, b, c] if pythagorean_triplet?(a, b, c)
    b += 1
  end
  a += 1
end

p pythagorean_triplets[0].reduce(:*)

# => 31875000
# the triplet itself is [200, 375, 425]<commit_msg>Add timer<commit_after># A Pythagorean triplet is a set of three natural numbers, a < b < c, for which

# a^2 + b^2 = c^2
# For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.

# There exists exactly one Pythagorean triplet for which a + b + c = 1000.
# Find the product abc.

start_time = Time.now

def pythagorean_triplet?(a, b, c)
  a ** 2 + b ** 2 == c ** 2
end

pythagorean_triplets = []

a = 1
until a == 1000
  b = a
  until b == 1000
    c = 1000 - (a + b)
    pythagorean_triplets << [a, b, c] if pythagorean_triplet?(a, b, c)
    b += 1
  end
  a += 1
end

p pythagorean_triplets[0].reduce(:*)
p "calculated in #{(Time.now - start_time) * 1000} ms"

# => 31875000


# the triplet itself is [200, 375, 425]
{'fraction_non_alphanumeric': 0.14349775784753363, 'fraction_numerical': 0.08370702541106129, 'mean_word_length': 2.8924418604651163, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, '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': '1358124', 'n_tokens_mistral': 662, 'n_tokens_neox': 547, 'n_words': 195}