LCOV - code coverage report
Current view: top level - 22 - a.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 22 22
Test Date: 2025-10-12 18:20:59 Functions: 100.0 % 2 2
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 100.0 % 10 10

             Branch data     Line data    Source code
       1                 :             : #include <fstream>
       2                 :             : #include <iostream>
       3                 :             : using namespace std;
       4                 :             : 
       5                 :           2 : int main() {
       6                 :           2 :   ifstream in("input.txt");
       7         [ +  + ]:           2 :   if (!in) {
       8                 :           1 :     cerr << "Error: Could not open input file.\n";
       9                 :           1 :     return 1;
      10                 :             :   }
      11                 :           1 :   uint_fast64_t sum = 0;
      12                 :             :   uint_fast32_t secret;
      13                 :             : 
      14                 :        2363 :   const auto jump_2000 = [](uint_fast32_t n) {
      15                 :        2363 :     uint_fast32_t acc  = 0;
      16                 :        2363 :     uint_fast32_t mask = 0x00F33FA2u; // see README.MD how this is computed
      17         [ +  + ]:       59075 :     for (uint_fast8_t b = 0; b < 24; ++b) {
      18         [ +  + ]:       56712 :       if (mask & 1u) {
      19                 :       35445 :         acc ^= n;
      20                 :             :       }
      21                 :             : 
      22                 :       56712 :       n ^= (n << 6)  & ((1u << 24) - 1u);
      23                 :       56712 :       n ^=  (n >> 5);
      24                 :       56712 :       n ^= (n << 11) & ((1u << 24) - 1u);
      25                 :       56712 :       n &=  ((1u << 24) - 1u);
      26                 :             : 
      27                 :       56712 :       mask >>= 1u;
      28                 :             :     }
      29                 :        2363 :     return acc;
      30                 :             :   };
      31                 :             : 
      32         [ +  + ]:        2364 :   while (in >> secret) {
      33                 :        2363 :     sum += jump_2000(secret);
      34                 :             :   }
      35                 :             : 
      36                 :           1 :   cout << sum << endl;
      37         [ +  + ]:           3 : }
        

Generated by: LCOV version 2.0-1