Language: C++

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  ll N,K; cin >> N >> K;
  //(x,y)が白　と　(x,y+K)が黒は同値
  vector<ll> x(N), y(N);
  REP(i,N){
    char t;
    cin >> x[i] >> y[i] >> t;
    if(t=='W') y[i] += K;
    x[i] %= 2*K;
    y[i] %= 2*K;
  }
  ll ans = 0;
  //(+3K,+3K)平行移動
  vector<vector<int>> sum(9*K+1, vector<int>(9*K+1,0));
  //左下(i,j)として加算
  auto add_cnt = [&](ll i, ll j){
    sum[i][j]++;
    sum[i+K][j+K]++;
    sum[i][j+K]--;
    sum[i+K][j]--;
  };
  REP(i,N){
    REP(j,3) REP(k,3){
      add_cnt(x[i]+(2*j+1)*K, y[i]+(2*k+1)*K);
    }
    REP(j,2)REP(k,2){
      add_cnt(x[i]+(2*j+2)*K,y[i]+(2*k+2)*K);
    }
  }
  //累積和とる
  REP(i,5*K+1) REP(j,5*K){
    sum[i][j+1] += sum[i][j];
  }
  REP(j,5*K+1)REP(i,5*K){
    sum[i+1][j] += sum[i][j];
  }
  REP(i,5*K+1) REP(j,5*K+1){
    ans = max(ans,sum[i][j]);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:14: error: no matching function for call to 'max(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   50 |     ans = max(ans,sum[i][j]);
      |           ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:50:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   50 |     ans = max(ans,sum[i][j]);
      |           ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:50:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   50 |     ans = max(ans,sum[i][j]);
      |           ~~~^~~~~~~~~~~~~~~