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

             Branch data     Line data    Source code
       1                 :             : #include <iostream>
       2                 :             : #include <fstream>
       3                 :             : #include <regex>
       4                 :             : #include <string>
       5                 :             : #include <iterator>
       6                 :             : #include <cstdint>
       7                 :             : using namespace std;
       8                 :             : 
       9                 :           2 : int main() {
      10                 :           2 :   ifstream file("input.txt");
      11         [ +  + ]:           2 :   if (!file) {
      12                 :           1 :     cerr << "Error: Could not open input file.\n";
      13                 :           1 :     return 1;
      14                 :             :   }
      15                 :           1 :   string content((istreambuf_iterator<char>(file)), {});
      16                 :           1 :   const regex r(R"(mul\((\d{1,3}),(\d{1,3})\))");
      17                 :           1 :   uint64_t sum = 0;
      18         [ +  + ]:         738 :   for (sregex_iterator it(content.begin(), content.end(), r), end; it != end; ++it) {
      19                 :         737 :     sum += stoi((*it)[1]) * stoi((*it)[2]);
      20                 :           1 :   }
      21                 :           1 :   cout << sum;
      22         [ +  + ]:           3 : }
        

Generated by: LCOV version 2.0-1