Problem p02802 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP

typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
template <typename T>
void read(::std::istream &is, ::std::vector<T> &vector,
          const typename ::std::vector<T>::size_type size) {
  vector.reserve(size);
  ::std::copy_n(::std::istream_iterator<T>(is), size,
                ::std::back_inserter(vector));
}
template <typename T>
void read(::std::vector<T> &vector,
          const typename ::std::vector<T>::size_type size) {
  ::tools::read(::std::cin, vector, size);
}

template <typename T, ::std::size_t N>
void read(::std::istream &is, ::std::array<T, N> &array) {
  ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
}
template <typename T, ::std::size_t N> void read(::std::array<T, N> &array) {
  ::tools::read(::std::cin, array);
}
} // namespace tools

#endif

// main.cpp

int main() {
  i64 N, M;
  std::cin >> N >> M;

  std::vector<i64> passed(N, false);
  std::vector<i64> penalties(N, 0);
  for (i64 i = 0; i < M; ++i) {
    i64 p;
    std::string S;
    std::cin >> p >> S;
    --p;

    if (!passed[p]) {
      if (S == "AC") {
        passed[p] = true;
      } else {
        ++penalties[p];
      }
    }
  }
  for (i64 i = 0; i < M; ++i) {
    if (!passed[i]) {
      penalties[i] = 0;
    }
  }

  std::cout << std::count(passed.begin(), passed.end(), true) << ' '
            << std::accumulate(penalties.begin(), penalties.end(),
                               static_cast<i64>(0))
            << std::endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP

typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
template <typename T>
void read(::std::istream &is, ::std::vector<T> &vector,
          const typename ::std::vector<T>::size_type size) {
  vector.reserve(size);
  ::std::copy_n(::std::istream_iterator<T>(is), size,
                ::std::back_inserter(vector));
}
template <typename T>
void read(::std::vector<T> &vector,
          const typename ::std::vector<T>::size_type size) {
  ::tools::read(::std::cin, vector, size);
}

template <typename T, ::std::size_t N>
void read(::std::istream &is, ::std::array<T, N> &array) {
  ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
}
template <typename T, ::std::size_t N> void read(::std::array<T, N> &array) {
  ::tools::read(::std::cin, array);
}
} // namespace tools

#endif

// main.cpp

int main() {
  i64 N, M;
  std::cin >> N >> M;

  std::vector<i64> passed(N, false);
  std::vector<i64> penalties(N, 0);
  for (i64 i = 0; i < M; ++i) {
    i64 p;
    std::string S;
    std::cin >> p >> S;
    --p;

    if (!passed[p]) {
      if (S == "AC") {
        passed[p] = true;
      } else {
        ++penalties[p];
      }
    }
  }
  for (i64 i = 0; i < N; ++i) {
    if (!passed[i]) {
      penalties[i] = 0;
    }
  }

  std::cout << std::count(passed.begin(), passed.end(), true) << ' '
            << std::accumulate(penalties.begin(), penalties.end(),
                               static_cast<i64>(0))
            << std::endl;
  return 0;
}