<commit_before>module Y2017.Day15 (answer1, answer2) where

import GHC.Word
import Data.Bits

answer1, answer2 :: Int
answer1 =
    let valsA = take (40 * 10 ^ 6) genA
        valsB = take (40 * 10 ^ 6) genB
    in  length $ filter (\(a, b) -> (a .&. 0xffff) == (b .&. 0xffff)) $ zip
            valsA
            valsB
answer2 =
    let valsA = take (5 * 10 ^ 6) $ filter ((==0) . (`mod`4)) genA
        valsB = take (5 * 10 ^ 6) $ filter ((==0) . (`mod`8)) genB
    in  length $ filter (\(a, b) -> (a .&. 0xffff) == (b .&. 0xffff)) $ zip
            valsA
            valsB

-- not 301

genA = iterate (genVal 16807) startA
genB = iterate (genVal 48271) startB

genVal f v = (v * f) `rem` 2147483647

startA, startB, testA, testB :: Word64
startA = 512<commit_msg>fix day 15<commit_after>module Y2017.Day15 (answer1, answer2) where

import GHC.Word
import Data.Bits

answer1, answer2 :: Int
answer1 =
    let valsA = take (40 * 10 ^ 6) genA
        valsB = take (40 * 10 ^ 6) genB
    in  length $ filter (\(a, b) -> (a .&. 0xffff) == (b .&. 0xffff)) $ zip
            valsA
            valsB
answer2 =
    let valsA = take (5 * 10 ^ 6) $ filter ((==0) . (`mod`4)) genA
        valsB = take (5 * 10 ^ 6) $ filter ((==0) . (`mod`8)) genB
    in  length $ filter (\(a, b) -> (a .&. 0xffff) == (b .&. 0xffff)) $ zip
            valsA
            valsB

genA = tail $ iterate (genVal 16807) startA
genB = tail $ iterate (genVal 48271) startB

genVal f v = (v * f) `rem` 2147483647

startA, startB, testA, testB :: Word64
startA = 512
{'fraction_non_alphanumeric': 0.15937295885042455, 'fraction_numerical': 0.08556499020248204, 'mean_word_length': 2.185031185031185, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '465536', 'n_tokens_mistral': 695, 'n_tokens_neox': 589, 'n_words': 193}