Language: C++

#include <iostream>
#define llllint long long

using namespace std;

llint n, k;
llint x[100005], y[100005];
char c[100005];
llint dif[4005][3005];
llint sum[4005][3005];
llint ans[2005][1005];

int main(void)
{
	cin >> n >> k;
	for(llint i = 0; i < n; i++) cin >> x[i] >> y[i] >> c[i];
	
	for(llint i = 0; i < n; i++){
		llint X = x[i] % (2*k) + 1, Y = y[i] % k + 1;
		if(c[i] == 'B'){
			dif[X][Y]++;
			dif[X+k][Y]--;
			dif[X][Y+k]--;
			dif[X+k][Y+k]++;
		}
		else{
			dif[X+k][Y]++;
			dif[X+2*k][Y]--;
			dif[X+k][Y+k]--;
			dif[X+2*k][Y+k]++;
		}
	}
	
	for(llint x = 1; x <= 4*k; x++){
		for(llint y = 1; y <= 3*k; y++){
			sum[x][y] = sum[x-1][y] + sum[x][y-1] - sum[x-1][y-1] + dif[x][y];
		}
	}
	
	for(llint x = 1; x <= 4*k; x++){
		for(llint y = 1; y <= 3*k; y++){
			llint X = x-1, Y = y-1;
			if((X/k + Y/k) % 2) ans[X%k+k][Y%k] += sum[x][y];
			else ans[X%k][Y%k] += sum[x][y];
		}
	}
	
	llint Ans = 0;
	for(llint x = 0; x < 2*k; x++){
		for(llint y = 0; y < k; y++){
			Ans = max(Ans, ans[x][y]);
		}
	}
	cout << Ans << endl;
	return 0;
}

Compiler output:
a.cc:6:1: error: 'llint' does not name a type
    6 | llint n, k;
      | ^~~~~
a.cc:7:1: error: 'llint' does not name a type
    7 | llint x[100005], y[100005];
      | ^~~~~
a.cc:9:1: error: 'llint' does not name a type
    9 | llint dif[4005][3005];
      | ^~~~~
a.cc:10:1: error: 'llint' does not name a type
   10 | llint sum[4005][3005];
      | ^~~~~
a.cc:11:1: error: 'llint' does not name a type
   11 | llint ans[2005][1005];
      | ^~~~~
a.cc: In function 'int main()':
a.cc:15:16: error: 'n' was not declared in this scope
   15 |         cin >> n >> k;
      |                ^
a.cc:15:21: error: 'k' was not declared in this scope
   15 |         cin >> n >> k;
      |                     ^
a.cc:16:13: error: 'llint' was not declared in this scope
   16 |         for(llint i = 0; i < n; i++) cin >> x[i] >> y[i] >> c[i];
      |             ^~~~~
a.cc:16:26: error: 'i' was not declared in this scope
   16 |         for(llint i = 0; i < n; i++) cin >> x[i] >> y[i] >> c[i];
      |                          ^
a.cc:16:45: error: 'x' was not declared in this scope
   16 |         for(llint i = 0; i < n; i++) cin >> x[i] >> y[i] >> c[i];
      |                                             ^
a.cc:16:53: error: 'y' was not declared in this scope
   16 |         for(llint i = 0; i < n; i++) cin >> x[i] >> y[i] >> c[i];
      |                                                     ^
a.cc:18:13: error: 'llint' was not declared in this scope
   18 |         for(llint i = 0; i < n; i++){
      |             ^~~~~
a.cc:18:26: error: 'i' was not declared in this scope
   18 |         for(llint i = 0; i < n; i++){
      |                          ^
a.cc:19:22: error: expected ';' before 'X'
   19 |                 llint X = x[i] % (2*k) + 1, Y = y[i] % k + 1;
      |                      ^~
      |                      ;
a.cc:21:25: error: 'dif' was not declared in this scope; did you mean 'div'?
   21 |                         dif[X][Y]++;
      |                         ^~~
      |                         div
a.cc:21:29: error: 'X' was not declared in this scope
   21 |                         dif[X][Y]++;
      |                             ^
a.cc:21:32: error: 'Y' was not declared in this scope
   21 |                         dif[X][Y]++;
      |                                ^
a.cc:27:25: error: 'dif' was not declared in this scope; did you mean 'div'?
   27 |                         dif[X+k][Y]++;
      |                         ^~~
      |                         div
a.cc:27:29: error: 'X' was not declared in this scope
   27 |                         dif[X+k][Y]++;
      |                             ^
a.cc:27:34: error: 'Y' was not declared in this scope
   27 |                         dif[X+k][Y]++;
      |                                  ^
a.cc:34:13: error: 'llint' was not declared in this scope
   34 |         for(llint x = 1; x <= 4*k; x++){
      |             ^~~~~
a.cc:34:26: error: 'x' was not declared in this scope
   34 |         for(llint x = 1; x <= 4*k; x++){
      |                          ^
a.cc:35:26: error: expected ';' before 'y'
   35 |                 for(llint y = 1; y <= 3*k; y++){
      |                          ^~
      |                          ;
a.cc:35:34: error: 'y' was not declared in this scope
   35 |                 for(llint y = 1; y <= 3*k; y++){
      |                                  ^
a.cc:36:25: error: 'sum' was not declared in this scope
   36 |                         sum[x][y] = sum[x-1][y] + sum[x][y-1] - sum[x-1][y-1] + dif[x][y];
      |                         ^~~
a.cc:36:81: error: 'dif' was not declared in this scope; did you mean 'div'?
   36 |                         sum[x][y] = sum[x-1][y] + sum[x][y-1] - sum[x-1][y-1] + dif[x][y];
      |                                                                                 ^~~
      |                                                                                 div
a.cc:40:13: error: 'llint' was not declared in this scope
   40 |         for(llint x = 1; x <= 4*k; x++){
      |             ^~~~~
a.cc:40:26: error: 'x' was not declared in this scope
   40 |         for(llint x = 1; x <= 4*k; x++){
      |                          ^
a.cc:41:26: error: expected ';' before 'y'
   41 |                 for(llint y = 1; y <= 3*k; y++){
      |                          ^~
      |                          ;
a.cc:41:34: error: 'y' was not declared in this scope
   41 |                 for(llint y = 1; y <= 3*k; y++){
      |                                  ^
a.cc:42:30: error: expected ';' before 'X'
   42 |                         llint X = x-1, Y = y-1;
      |                              ^~
      |                              ;
a.cc:43:29: error: 'X' was not declared in this scope
   43 |                         if((X/k + Y/k) % 2) ans[X%k+k][Y%k] += sum[x][y];
      |                             ^
a.cc:43:35: error: 'Y' was not declared in this scope
   43 |                         if((X/k + Y/k) % 2) ans[X%k+k][Y%k] += sum[x][y];
      |                                   ^
a.cc:43:45: error: 'ans' was not declared in this scope; did you mean 'abs'?
   43 |                         if((X/k + Y/k) % 2) ans[X%k+k][Y%k] += sum[x][y];
      |                                             ^~~
      |                                             abs
a.cc:43:64: error: 'sum' was not declared in this scope
   43 |                         if((X/k + Y/k) % 2) ans[X%k+k][Y%k] += sum[x][y];
      |                                                                ^~~
a.cc:44:30: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |                         else ans[X%k][Y%k] += sum[x][y];
      |                              ^~~
      |                              abs
a.cc:44:47: error: 'sum' was not declared in this scope
   44 |                         else ans[X%k][Y%k] += sum[x][y];
      |                                               ^~~
a.cc:48:9: error: 'llint' was not declared in this scope
   48 |         llint Ans = 0;
      |         ^~~~~
a.cc:49:18: error: expected ';' before 'x'
   49 |         for(llint x = 0; x < 2*k; x++){
      |                  ^~
      |                  ;
a.cc:49:26: error: 'x' was not declared in this scope
   49 |         for(llint x = 0; x < 2*k; x++){
      |                          ^
a.cc:50:26: error: expected ';' before 'y'
   50 |                 for(llint y = 0; y < k; y++){
      |                          ^~
      |                          ;
a.cc:50:34: error: 'y' was not declared in this scope
   50 |                 for(llint y = 0; y < k; y++){
      |                                  ^
a.cc:51:25: error: 'Ans' was not declared in this scope
   51 |                         Ans = max(Ans, ans[x][y]);
      |                         ^~~
a.cc:51:40: error: 'ans' was not declared in this scope; did you mean 'abs'?
   51 |                         Ans = max(Ans, ans[x][y]);
      |                                        ^~~
      |                                        abs
a.cc:54:17: error: 'Ans' was not declared in this scope
   54 |         cout << Ans << endl;
      |                 ^~~