Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}


int N,K;
int table[2005][2005];

int main(void){
  SPEEDUP
  cout << setprecision(15);
  cin >> N >> K;
  const int L = 2*K;
  rep(i,N){
    int x,y;cin >> x >> y;
    char c; cin >> c;
    x%=L;
    y%=L;
    int black = 1;
    if(c=='W')black^=1;
    if(x>=K)black^=1;
    if(y>=K)black^=1;
    x%=K;
    y%=K;
    table[0][0]+=black;
    if(!black)black=-1;
    table[0][y+1]-=black;
    table[x+1][0]-=black;
    table[x+1][y+1]+=2*black;
    }
  }
  rep(x,K)repp(y,1,K)table[x][y] += table[x][y-1];
  rep(y,K)repp(x,1,K)table[x][y] += table[x-1][y];
  int ans = 0;
  rep(x,K)rep(y,K) ans= max(ans,max(table[x][y],N-table[x][y]));
  cout << ans << endl;
  return 0;
}



Compiler output:
a.cc:3:18: error: expected unqualified-id before 'for'
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                  ^~~
a.cc:59:3: note: in expansion of macro 'rep'
   59 |   rep(x,K)repp(y,1,K)table[x][y] += table[x][y-1];
      |   ^~~
a.cc:59:7: error: 'x' does not name a type
   59 |   rep(x,K)repp(y,1,K)table[x][y] += table[x][y-1];
      |       ^
a.cc:3:42: note: in definition of macro 'rep'
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                                          ^
a.cc:3:52: error: expected unqualified-id before '++' token
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                                                    ^~
a.cc:59:3: note: in expansion of macro 'rep'
   59 |   rep(x,K)repp(y,1,K)table[x][y] += table[x][y-1];
      |   ^~~
a.cc:59:16: error: 'y' does not name a type
   59 |   rep(x,K)repp(y,1,K)table[x][y] += table[x][y-1];
      |                ^
a.cc:4:47: note: in definition of macro 'repp'
    4 | #define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
      |                                               ^
a.cc:4:57: error: expected unqualified-id before '++' token
    4 | #define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
      |                                                         ^~
a.cc:59:11: note: in expansion of macro 'repp'
   59 |   rep(x,K)repp(y,1,K)table[x][y] += table[x][y-1];
      |           ^~~~
a.cc:3:18: error: expected unqualified-id before 'for'
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                  ^~~
a.cc:60:3: note: in expansion of macro 'rep'
   60 |   rep(y,K)repp(x,1,K)table[x][y] += table[x-1][y];
      |   ^~~
a.cc:60:7: error: 'y' does not name a type
   60 |   rep(y,K)repp(x,1,K)table[x][y] += table[x-1][y];
      |       ^
a.cc:3:42: note: in definition of macro 'rep'
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                                          ^
a.cc:3:52: error: expected unqualified-id before '++' token
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                                                    ^~
a.cc:60:3: note: in expansion of macro 'rep'
   60 |   rep(y,K)repp(x,1,K)table[x][y] += table[x-1][y];
      |   ^~~
a.cc:60:16: error: 'x' does not name a type
   60 |   rep(y,K)repp(x,1,K)table[x][y] += table[x-1][y];
      |                ^
a.cc:4:47: note: in definition of macro 'repp'
    4 | #define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
      |                                               ^
a.cc:4:57: error: expected unqualified-id before '++' token
    4 | #define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
      |                                                         ^~
a.cc:60:11: note: in expansion of macro 'repp'
   60 |   rep(y,K)repp(x,1,K)table[x][y] += table[x-1][y];
      |           ^~~~
a.cc:3:18: error: expected unqualified-id before 'for'
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                  ^~~
a.cc:62:3: note: in expansion of macro 'rep'
   62 |   rep(x,K)rep(y,K) ans= max(ans,max(table[x][y],N-table[x][y]));
      |   ^~~
a.cc:62:7: error: 'x' does not name a type
   62 |   rep(x,K)rep(y,K) ans= max(ans,max(table[x][y],N-table[x][y]));
      |       ^
a.cc:3:42: note: in definition of macro 'rep'
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                                          ^
a.cc:3:52: error: expected unqualified-id before '++' token
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                                                    ^~
a.cc:62:3: note: in expansion of macro 'rep'
   62 |   rep(x,K)rep(y,K) ans= max(ans,max(table[x][y],N-table[x][y]));
      |   ^~~
a.cc:62:15: error: 'y' does not name a type
   62 |   rep(x,K)rep(y,K) ans= max(ans,max(table[x][y],N-table[x][y]));
      |               ^
a.cc:3:42: note: in definition of macro 'rep'
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                                          ^
a.cc:3:52: error: expected unqualified-id before '++' token
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                                                    ^~
a.cc:62:11: note: in expansion of macro 'rep'
   62 |   rep(x,K)rep(y,K) ans= max(ans,max(table[x][y],N-table[x][y]));
      |           ^~~
a.cc:63:3: error: 'cout' does not name a type
   63 |   cout << ans << endl;
      |   ^~~~
a.cc:64:3: error: expected unqualified-id before 'return'
   64 |   return 0;
      |   ^~~~~~
a.cc:65:1: error: expected declaration before '}' token
   65 | }
      | ^