criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

int b[4010][4010];
int bacc[4010][4010];
int bsum(int x1, int y1, int x2, int y2){
  return bacc[y2][x2] - bacc[y2][x1] - bacc[y1][x2] + bacc[y1][x1];
}


void Main(){

  int N,K;
  cin>>N>>K;

  int L=2*K;

  rep(i,N){
    int x,y; char c;
    cin>>x>>y>>c;
    if(c=='B'){
      ++b[x%L][y%L];
      ++b[(x+K)%L][(y+K)%L];
    }
    else{
      ++b[(x+K)%L][y%L];
      ++b[x%L][(y+K)%L];
    }
  }

  rep(i,L){
    rep(j,L){
      bacc[i][j]
    }
  }

}

  //-----------------------------------
  int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
  }
  //-----------------------------------


Compiler output:
a.cc: In function 'void Main()':
a.cc:47:17: error: expected ';' before '}' token
   47 |       bacc[i][j]
      |                 ^
      |                 ;
   48 |     }
      |     ~
Language: C

#include <stdio.h>

inline void gc(int *x) {
    *x = 0;
    while (true) {
        int c = getchar_unlocked();
        if ('0' <= c && c <= '9') {
            *x = *x * 10 + c - '0';
        } else {
            break;
        }
    }
}

#define KMAX (1000)
int s[KMAX + 1][2 * KMAX + 1];
int main(void) {
    char c;
    int n, k, x, y;
    scanf("%d %d\n", &n, &k);
    for (int i = 0; i < n; i++) {
        gc(&x);
        gc(&y);
        c = getchar_unlocked();
        getchar_unlocked();
        y %= 2 * k;
        if (c == 'W') {
            if (y >= k) {
                y -= k;
            } else {
                x += k;
            }
        } else {
            if (y >= k) {
                y -= k;
                x += k;
            }
        }
        x %= 2 * k;
        s[y + 1][x + 1]++;
    }
    for (int y = 0; y < k; y++) {
        for (int x = 0; x < 2 * k; x++) {
            s[y + 1][x + 1] += s[y][x + 1] + s[y + 1][x] - s[y][x];
        }
    }
    int max = 0;
    int v = s[0][0] - s[0][2 * k];
    for (int y = 0; y < k; y++) {
        int u = v - s[y][0] + s[y][2 * k];
        for (int x = 0; x < k; x++) {
            int t = u - s[0][x] - s[k][x] + s[0][x + k] + s[k][x + k] +
                    2 * s[y][x] - 2 * s[y][x + k];
            t = t < n / 2 ? n - t : t;
            max = t > max ? t : max;
        }
    }
    printf("%d", max);
    return 0;
}


Compiler output:
main.c: In function 'gc':
main.c:5:12: error: 'true' undeclared (first use in this function)
    5 |     while (true) {
      |            ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:5:12: note: each undeclared identifier is reported only once for each function it appears in
    5 |     while (true) {
      |            ^~~~
Language: C

#include <stdio.h>

inline void gc(int *x) {
    *x = 0;
    for (;;) {
        int c = getchar_unlocked();
        if ('0' <= c && c <= '9') {
            *x = *x * 10 + c - '0';
        } else {
            break;
        }
    }
}

int main(void) {
    constexpr int KMAX = 1000;
    static int s[KMAX + 1][2 * KMAX + 1];
    char c;
    int n, k, x, y;
    scanf("%d %d\n", &n, &k);
    for (int i = 0; i < n; i++) {
        gc(&x);
        gc(&y);
        c = getchar_unlocked();
        getchar_unlocked();
        y %= 2 * k;
        if (c == 'W') {
            if (y >= k) {
                y -= k;
            } else {
                x += k;
            }
        } else {
            if (y >= k) {
                y -= k;
                x += k;
            }
        }
        x %= 2 * k;
        s[y + 1][x + 1]++;
    }
    for (int y = 0; y < k; y++) {
        for (int x = 0; x < 2 * k; x++) {
            s[y + 1][x + 1] += s[y][x + 1] + s[y + 1][x] - s[y][x];
        }
    }
    int max = 0;
    int v = s[0][0] - s[0][2 * k];
    for (int y = 0; y < k; y++) {
        int u = v - s[y][0] + s[y][2 * k];
        for (int x = 0; x < k; x++) {
            int t = u - s[0][x] - s[k][x] + s[0][x + k] + s[k][x + k] +
                    2 * s[y][x] - 2 * s[y][x + k];
            t = t < n / 2 ? n - t : t;
            max = t > max ? t : max;
        }
    }
    printf("%d", max);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:5: error: 'constexpr' undeclared (first use in this function)
   16 |     constexpr int KMAX = 1000;
      |     ^~~~~~~~~
main.c:16:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:14: error: expected ';' before 'int'
   16 |     constexpr int KMAX = 1000;
      |              ^~~~
      |              ;
main.c:17:18: error: 'KMAX' undeclared (first use in this function)
   17 |     static int s[KMAX + 1][2 * KMAX + 1];
      |                  ^~~~
Language: C

#include <stdio.h>

inline void gc(int *x) {
    *x = 0;
    for (;;) {
        int c = getchar_unlocked();
        if ('0' <= c && c <= '9') {
            *x = *x * 10 + c - '0';
        } else {
            break;
        }
    }
}

int main(void) {
    using namespace std;
    constexpr int KMAX = 1000;
    static int s[KMAX + 1][2 * KMAX + 1];
    char c;
    int n, k, x, y;
    scanf("%d %d\n", &n, &k);
    for (int i = 0; i < n; i++) {
        gc(&x);
        gc(&y);
        c = getchar_unlocked();
        getchar_unlocked();
        y %= 2 * k;
        if (c == 'W') {
            if (y >= k) {
                y -= k;
            } else {
                x += k;
            }
        } else {
            if (y >= k) {
                y -= k;
                x += k;
            }
        }
        x %= 2 * k;
        s[y + 1][x + 1]++;
    }
    for (int y = 0; y < k; y++) {
        for (int x = 0; x < 2 * k; x++) {
            s[y + 1][x + 1] += s[y][x + 1] + s[y + 1][x] - s[y][x];
        }
    }
    int max = 0;
    int v = s[0][0] - s[0][2 * k];
    for (int y = 0; y < k; y++) {
        int u = v - s[y][0] + s[y][2 * k];
        for (int x = 0; x < k; x++) {
            int t = u - s[0][x] - s[k][x] + s[0][x + k] + s[k][x + k] +
                    2 * s[y][x] - 2 * s[y][x + k];
            t = t < n / 2 ? n - t : t;
            max = t > max ? t : max;
        }
    }
    printf("%d", max);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:5: error: unknown type name 'using'
   16 |     using namespace std;
      |     ^~~~~
main.c:16:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
   16 |     using namespace std;
      |                     ^~~
main.c:17:5: error: 'constexpr' undeclared (first use in this function)
   17 |     constexpr int KMAX = 1000;
      |     ^~~~~~~~~
main.c:17:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:14: error: expected ';' before 'int'
   17 |     constexpr int KMAX = 1000;
      |              ^~~~
      |              ;
main.c:18:18: error: 'KMAX' undeclared (first use in this function)
   18 |     static int s[KMAX + 1][2 * KMAX + 1];
      |                  ^~~~
Language: C++

#include <iostream>
using namespace std;

// while[x][y] = マス(x, y)を右上とした長方形に
//               含まれている(白マス-黒マス)の総数
int16_t white[1000][1000];
int main() {
    int N, K;
    cin >> N >> K;

    // 黒マスを指定する条件の数
    int bnum = 0;
    // まずは2K * 2Kの範囲に絞る
    for (int i = 0; i < N; ++i) {
        int x, y, z;
        char sc;
        cin >> x >> y >> sc;
        x %= K * 2;
        y %= K * 2;
        z = (sc == 'W');
        // K * Kの範囲に絞る
        // 座標をKで割った値の偶奇で色が変わる
        z += x / K + y / K;
        z %= 2;
        x %= K;
        y %= K;
        white[x][y] += (z ? 1 : -1);
        if (z == 0)
            ++bnum;
    }

    // 2次元imosの要領で展開
    for (int x = 0; x < K; ++x) {
        for (int y = 1; y < K; ++y) {
            white[x][y] += white[x][y - 1];
        }
    }

    for (int x = 1; x < K; ++x) {
        for (int y = 0; y < K; ++y) {
            white[x][y] += white[x - 1][y];
        }
    }

    int ans = 0;
    for (int x = 0; x < K; ++x) {
        for (int y = 0; y < K; ++y) {
            // (x, y)を右上の頂点とした長方形を白く塗るパターン
            int w = white[K - 1][K - 1] - white[x][K - 1] - white[K - 1][y] +
                    white[x][y] * 2 + bnum;

            ans = max({ans, w, N - w});
        }
    }

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:22: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   52 |             ans = max({ans, w, N - w});
      |                   ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:   candidate expects 2 arguments, 1 provided
/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, 1 provided
Language: C++

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template< class T >
class RecSum {
private:
	vector<vector<T>> data;
	int H = 0, W = 0;
public:
	RecSum(vector<vector<T>> const &vec) : H(vec.size()), W(vec[0].size()), data(H + 1, vector<T>(W + 1, 0)) {
		for (int row = 0; row <= H; row++) {
			for (int col = 0; col <= W; col++) {
				data[row + 1][col + 1] += data[row + 1][col] + data[row][col + 1] - data[row][col] + vec[row][col];
			}
		}
	}

	RecSum(int H, int W) : H(H), W(W), data(H + 1, vector<T>(W + 1, 0)) {}
	void add(int x, int y, T z) { data[x + 1][y + 1] += z; }
	void init() {
		for (int row = 0; row < H; row++) {
			for (int col = 0; col < W; col++) {
				data[row + 1][col + 1] += data[row + 1][col] + data[row][col + 1] - data[row][col];
			}
		}
	}

	// [sx, gx) x [sy, gy)
	T operator()(int sx, int sy, int gx, int gy) {
		if (sx > gx) swap(sx, gx); swap(sy, gy);
		return data[gx][gy] - data[sx][gy] - data[gx][sy] + data[sx][sy];
	}
};

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, K;
	cin >> N >> K;

	RecSum<int> grid(4 * K, 4 * K);
	int x, y; char w;
	for (int i = 0; i < N; i++) {
		cin >> x >> y >> w;
		if (w == 'W') {
			x %= 2 * K;
			y %= 2 * K;
		}
		else {
			x += K;
			x %= 2 * K;
			y %= 2 * K;
		}
		grid.add(x, y, 1);
		grid.add(x, y, 1);
		grid.add(x + 2 * K, y, 1);
		grid.add(x, y + 2 * K, 1);
		grid.add(x + 2 * K, y + 2 * K, 1);
	}

	grid.init();

	int ans = 0;
	for (int row = 0; row < 2 * K; row++) {
		for (int col = 0; col < 2 * K; col++) {
			ans = max(ans, grid.query(row, col, row + K, col + K) + grid.query(row + K, col + K, row + 2 * K, col + 2 * K));
		}
	}
	cout << ans << "\n";

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:86:45: error: 'class RecSum<int>' has no member named 'query'
   86 |                         ans = max(ans, grid.query(row, col, row + K, col + K) + grid.query(row + K, col + K, row + 2 * K, col + 2 * K));
      |                                             ^~~~~
a.cc:86:86: error: 'class RecSum<int>' has no member named 'query'
   86 |                         ans = max(ans, grid.query(row, col, row + K, col + K) + grid.query(row + K, col + K, row + 2 * K, col + 2 * K));
      |                                                                                      ^~~~~
Language: C++

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template< class T >
class RecSum {
private:
	vector<vector<T>> data;
	int H = 0, W = 0;
public:
	RecSum(vector<vector<T>> const &vec) : H(vec.size()), W(vec[0].size()) data(H + 1, vector<T>(W + 1, 0)) {
		for (int row = 0; row <= H; row++) {
			for (int col = 0; col <= W; col++) {
				data[row + 1][col + 1] += data[row + 1][col] + data[row][col + 1] - data[row][col] + vec[row][col];
			}
		}
	}

	RecSum(int H, int W) : H(H), W(W), data(H + 1, vector<T>(W + 1, 0)) {}
	void add(int x, int y, T z) { data[x + 1][y + 1] += z; }
	void init() {
		for (int row = 0; row < H; row++) {
			for (int col = 0; col < W; col++) {
				data[row + 1][col + 1] += data[row + 1][col] + data[row][col + 1] - data[row][col];
			}
		}
	}

	// [sx, gx) x [sy, gy)
	T operator()(int sx, int sy, int gx, int gy) {
		return data[gx][gy] - data[sx][gy] - data[gx][sy] + data[sx][sy];
	}
};

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, K;
	cin >> N >> K;

	RecSum<int> grid(2 * K, 2 * K);
	int x, y; char w;
	for (int i = 0; i < N; i++) {
		cin >> x >> y >> w;
		if (w == 'W') {
			x %= 2 * K;
			y %= 2 * K;
		}
		else {
			x += K;
			x %= 2 * K;
			y %= 2 * K;
		}
		grid.add(x, y, 1);
	}

	grid.init();

	int ans = 0;
	for (int row = 0; row < 2 * K; row++) {
		for (int col = 0; col < 2 * K; col++) {
			ans = max(ans, grid(row, col, row + K, col + K) + grid(row + K, col + K, row + 2 * K, col + 2 * K));
		}
	}
	cout << ans << "\n";

	return 0;
}


Compiler output:
a.cc: In constructor 'RecSum<T>::RecSum(const std::vector<std::vector<_Tp> >&)':
a.cc:28:80: error: expected '{' before 'data'
   28 |         RecSum(vector<vector<T>> const &vec) : H(vec.size()), W(vec[0].size()) data(H + 1, vector<T>(W + 1, 0)) {
      |                                                                                ^~~~
Language: C++

#include <bits/stdc++.h>
#define l_ength size
#define ws meow
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int ss[2048][2048];
int ws[2048][2048];

int fss( int bx, int by, int ax, int ay ){
	return ss[bx][by]-ss[ax][by]-ss[bx][ay]+ss[ax][ay];
}
int fws( int bx, int by, int ax, int ay ){
	return ws[bx][by]-ws[ax][by]-ws[bx][ay]+ws[ax][ay];
}

int main(){
	int n, k; cin >> n >> k;
	int sanz = 0, wanz = 0;
	for( int i = 0; i < n; ++i ){
		int x, y; cin >> x >> y;
		char c; cin >> c;
		if( c == 'B' ){
			++ss[x%(2*k)+1][y%(2*k)+1];
			++sanz;
		} else {
			++ww[x%(2*k)+1][y%(2*k)+1];
			++wanz;
		}
	}
	for( int j = 0; j <= 2*k; ++j ){
		for( int i = 0; i < 2*k; ++i ){
			ss[i+1][j] = ss[i][j] + ss[i+1][j];
			ws[i+1][j] = ws[i][j] + ww[i+1][j];
		}
	}
	for( int j = 0; j <= 2*k; ++j ){
		for( int i = 0; i < 2*k; ++i ){
			ss[j][i+1] = ss[j][i] + ss[j][i+1];
			ws[j][i+1] = ws[j][i] + ws[j][i+1];
		}
	}
	int ans = 0;
	for( int i = 0; i < k; ++i ){
		for( int j = 0; j < k; ++j ){
			int sum = 0;
			int x1 = i, y1 = j, x2 = i+k, y2 = j+k;
			sum += fss(x2, y2, x1, y1) + fss(x1, y1, 0, 0) + fss(x2, 0, 2*k, y1) + fss(x1, 2*k, 0, y2) + fss(2*k, 2*k, x2, y2);
			sum += (wanz) - ( fws(x2, y2, x1, y1) + fws(x1, y1, 0, 0) + fws(x2, 0, 2*k, y1) + fws(x1, 2*k, 0, y2) + fws(2*k, 2*k, x2, y2) );
			ans = max(ans, sum);
		}
	}
	for( int i = 0; i < k; ++i ){
		for( int j = 0; j < k; ++j ){
			int sum = 0;
			int x1 = i, y1 = j, x2 = i+k, y2 = j+k;
			sum += fws(x2, y2, x1, y1) + fws(x1, y1, 0, 0) + fws(x2, 0, 2*k, y1) + fws(x1, 2*k, 0, y2) + fws(2*k, 2*k, x2, y2);
			sum += (sanz) - ( fss(x2, y2, x1, y1) + fss(x1, y1, 0, 0) + fss(x2, 0, 2*k, y1) + fss(x1, 2*k, 0, y2) + fss(2*k, 2*k, x2, y2) );
			ans = max(ans, sum);
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:27: error: 'ww' was not declared in this scope; did you mean 'ws'?
   29 |                         ++ww[x%(2*k)+1][y%(2*k)+1];
      |                           ^~
      |                           ws
a.cc:36:49: error: 'ww' was not declared in this scope; did you mean 'ws'?
   36 |                         ws[i+1][j] = ws[i][j] + ww[i+1][j];
      |                                                 ^~
      |                                                 ws
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define INF 1000000000000000
#define fi first
#define se second
#define all(v) v.begin(),v.end()
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
struct edge{int to,cost;};
typedef pair<int,int> P;
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
int kaijo(int n){
	int ans=1;
	for(int i=2;i<=n;i++){
		ans*=i;
		ans%=MOD;
	}
	return ans;
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int comb(int a,int b){
	return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
}
int n,k,r[2222][2222],ans;
signed main(){
	cin>>n>>k;
	rep(i,n){
		int a,b;
		char c;
		cin>>a>>b>>c;
		if(c=='B')a+=k;
		a%=(2*k),b%=(2*k);
		if(a>=k&&b>=k)a-=k,b-=k;
		if(b>=k)b-=k,a+=k;
		a++,b++;
		r[a][b]++;
	}
	rep(i,2*k){
		rep(j,2*k){
			r[i+1][j+1]+=r[i][j+1]+r[i+1][j]-r[i][j];
		}
	}
	rep(i,k+1){
			int x=0;
			x=r[i+k][k]-r[i][k]-r[i+k][0]+r[i][0];
			
			ans=max(ans,x);
			ans=max(ans,n-x);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc:77:9: error: 'cout' does not name a type
   77 |         cout<<ans<<endl;
      |         ^~~~
a.cc:78:9: error: expected unqualified-id before 'return'
   78 |         return 0;
      |         ^~~~~~
a.cc:79:1: error: expected declaration before '}' token
   79 | }
      | ^
Language: C++

ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18

N,K=rl()

W = [[0 for _ in range(2*K+3)] for _ in range(2*K+3)]
for i in range(N):
    x,y,c=input().split()
    x = int(x)%(2*K)
    y = (int(y) if c=='W' else int(y)+K)%(2*K)
    if (x<K)^(y<K):
        x %= K
        y %= K
        W[0][y+1] += 1
        W[x+1][y+1] -= 2
        W[0][K+1] -= 1
        W[x+1][K+1] += 1
        W[x+1][0] += 1
        W[K+1][0] -= 1
        W[K+1][y+1] += 1
    else:
        x %= K
        y %= K
        W[0][0] += 1
        W[x+1][0] -= 1
        W[0][y+1] -= 1
        W[x+1][y+1] += 2
        W[K+1][y+1] -= 1
        W[x+1][K+1] -= 1
        W[K+1][K+1] += 1

for x in range(0,K+2):
    for y in range(1,K+2):
        W[x][y] += W[x][y-1]
for y in range(0,K+2):
    for x in range(1,K+2):
        W[x][y] += W[x-1][y]

ans = 0
for x in range(K+1):
    for y in range(K+1):
        ans = max(ans,W[x][y])

print(ans)


Compiler output:
a.cc:4:22: warning: multi-character character constant [-Wmultichar]
    4 | YN = lambda b: print('YES') if b else print('NO')
      |                      ^~~~~
a.cc:4:45: warning: multi-character character constant [-Wmultichar]
    4 | YN = lambda b: print('YES') if b else print('NO')
      |                                             ^~~~
a.cc:1:1: error: 'ri' does not name a type
    1 | ri = lambda: int(input())
      | ^~
Language: C++

#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
vector<vector<int> > ans;
vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//do {
//    print(v);
//  } while (std::next_permutation(v.begin(), v.end()));

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
	int N,K;
	cin>>N>>K;

	int KK[2000][2000]={0};
	int ans[2000][2000]={0};
	int P[4]={1,-1,1,-1};
	int Q[4]={1,1,-1,-1};
	REP(i,N){
		char c;
		int x,y;
		cin>>x>>y>>c;
		if(c=='W'){
			c='B';
			y+=K;
		}
		x=x%(2*K);
		y=y%(2*K);
		
		if(x>=0 && y>=0 && x<2*K && y<2*K){
			//ans[x][y]++;
			REP(j,4){
				if(x+K*P[j]>=0 && x+K*P[j]<2*K && y+K*Q[j]>=0 && y+K*Q[j]<2*K)
					ans[x+K*P[j]][y+K*Q[j]]++;
			}
		}
		if(x+K>=0 && y+K>=0 && x+K<2*K && y+K<2*K)
			//ans[x+K][y+K]++;
			REP(j,4){
				if(x+K+K*P[j]>=0 && x+K+K*P[j]<2*K && y+K+K*Q[j]>=0 && y+K+K*Q[j]<2*K){
					ans[x+K+K*P[j]][y+K+K*Q[j]]++;
				}
			}
		if(x+K>=0 && y>=0 && x+K<2*K && y<2*K)
			//ans[x+K][y]--;
			REP(j,4){
				if(x+K+K*P[j]>=0 && x+K+K*P[j]<2*K && y+K*Q[j]>=0 && y+K*Q[j]<2*K){
						ans[x+K+K*P[j]][y+K*Q[j]]--;
				}
			}
			
		if(x>=0 && y+K>=0 && x<2*K && y+K<2*K)
			//ans[x][y+K]--;
			REP(j,4){
				if(j!=2 && x+K*P[j]>=0 && x+K*P[j]<2*K && y+K+K*Q[j]>=0 && y+K+K*Q[j]<2*K){
					ans[x+K*P[j]][y+K+K*Q[j]]--;
				}
			}
	}
	REP(i,2*K){
		REP(j,2*K)//cout<<ans[i][j];
		//cout<<endl;
	}
	
	int anss=0;
	REP(i,K*2){
		FOR(j,1,2*K){
			ans[i][j]+=ans[i][j-1];
		}
	}
	REP(i,2*K){
		FOR(j,1,2*K){
			ans[j][i]+=ans[j-1][i];
		}
	}
	REP(i,2*K){
		REP(j,2*K)anss=max(anss,ans[i][j]);
	}
	
	cout<<anss<<endl;
	return 0;
}




















Compiler output:
a.cc: In function 'int main()':
a.cc:87:9: error: expected primary-expression before '}' token
   87 |         }
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,x,y;
  char c;
  cin>>n>>m;
  int a[3*m];
  memset(a,0,sizeof(a));
  for(int i=0;i<n;i++){
    cin>>x>>y>>c;
    bool f=true;
    if(c=='W') f=false;
    if(y/m%2==1) f=!f;
    if(y/m%2==1) f=!f;
    x%=m;
    if(f){
      a[x]++,a[x+2*m]++;
    }else{
      a[x+m]++;
    }
  }
  int b[3*m+1];
  memset(b,0,sizeof(b));
  for(int i=1;i<=3*m;i++){
    b[i]=b[i-1]+a[i-1];
  }
  int ma=0;
  for(int i=1;i<=2*m;i++){
    ma=max(ma,b[i+m-1]-b[i-1];
  }
  cout<<ma;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:30: error: expected ')' before ';' token
   29 |     ma=max(ma,b[i+m-1]-b[i-1];
      |           ~                  ^
      |                              )
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,x,y;
  char c;
  cin>>n>>m;
  int a[m+m+1][m+m+1],b[m+m+1][m+m+1];
  memset(a,0,sizeof(a));
  memset(b,0,sizeof(b));
  for(int i=0;i<n;i++){
    cin>>x>>y>>c;
    if(c=='W') x+=m;
    x-=x/m*m;
    y-=y/m*m;
    a[x+1][y+1]++;
  }
  for(int i=1;i<=m+m;i++){
    for(int j=1;j<=m+m;j++){
      b[i][j]=b[i][j-1]+a[i][j];
    }
  }
  int ma=0,cnt;
  for(int i=1;i<=m;i++){
  cnt=0;
    for(int j=1;j<=m;j++){
      cnt+=b[j][i+m-1]-b[j][i-1
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:32: error: expected ']' before '}' token
   26 |       cnt+=b[j][i+m-1]-b[j][i-1
      |                                ^
      |                                ]
   27 | }
      | ~                               
a.cc:26:32: error: expected ';' before '}' token
   26 |       cnt+=b[j][i+m-1]-b[j][i-1
      |                                ^
      |                                ;
   27 | }
      | ~                               
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:23:24: note: to match this '{'
   23 |   for(int i=1;i<=m;i++){
      |                        ^
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <array>
#include <algorithm>
using namespace std;

struct Point {
  int x;
  int y;
  char color;
};

int main() {
  int N, K;
  cin >> N >> K;

  struct Point points[N];
  for(int i = 0; i < N; i++) {
    int x, y;
    char color;
    cin >> x >> y >> color;

    if (color == 'B')
      x = x+K;

    Point p = {x, y, color};
    points[i] = p;
  }

  int ans = 0;
  for(int i = 0; i < K*K; i++) {
    int answer[2];
    memset(&answer[0], 0, sizeof answer);
    for(int n = 0; n < N; n++) {
      Point p = points[n];
      int x = p.x + (i%K);
      int y = p.y + (i/K);
      int aaa = ((x / K) & 1) ^ ((y / K) & 1);
      answer[aaa]++;
    }
    ans = max(ans, answer[0]);
    ans = max(ans, answer[1]);
  }

  cout << ans;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'memset' was not declared in this scope
   32 |     memset(&answer[0], 0, sizeof answer);
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define FOR(i, a, b) for(decltype(b) i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
81 58
)");
#define cin input
#endif

#define int ll

int main()
{
    int n, k;
	cin >> n >> k;

    static int s[2][2048][2048] = {};

    REP (i, n)
    {
        int x, y;
        char c;
        cin >> x >> y >> c;
        ++s[c == 'W' ? 1 : 0][y % (k * 2) + 1][x % (k * 2) + 1];
    }

    REP (c, 2)
        REP (i, k * 2)
            REP (j, k * 2)
                s[c][i + 1][j + 1] += s[c][i + 1][j];

    REP (c, 2)
        REP (i, k * 2)
            REP (j, k * 2)
                s[c][i + 1][j + 1] += s[c][i][j + 1];

    int mx = 0;

    REP (i, k)
        REP (j, k)
        {
            int cur =
                2 * s[0][i][j] +
                -2 * s[0][i][j + k] +
                1 * s[0][i][k * 2] +
                -2 * s[0][i + k][j] +
                2 * s[0][i + k][j + k] +
                -1 * s[0][i + k][k * 2] +
                1 * s[0][k * 2][j] +
                -1 * s[0][k * 2][j + k] +
                1 * s[0][k * 2][k * 2] +
                -2 * s[1][i][j] +
                2 * s[1][i][j + k] +
                -1 * s[1][i][k * 2] +
                2 * s[1][i + k][j] +
                -2 * s[1][i + k][j + k] +
                1 * s[1][i + k][k * 2] +
                -1 * s[1][k * 2][j] +
                1 * s[1][k * 2][j + k];
            if (cur > mx)
                mx = cur;
        }

	cout << mx << endl;

	return 0;
}

/*
1  -1   1 -1

-1  2  -2  1

1  -2   2 -1
-1  1  -1  1

    1  -1   

1  -2   2 -1

1   2  -2  1
   -1   1
*/

Compiler output:
a.cc:31:13: error: '::main' must return 'int'
   31 | #define int ll
      |             ^~
a.cc:33:1: note: in expansion of macro 'int'
   33 | int main()
      | ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define MAX_N 100000

class Checker
{
  public:
    ll x;
    ll y;
    char c;
};

ll a[1001][2001];

int main(){
  ll n, k;
  cin >> n >> k;
  
  Checker xyc[MAX_N];
  REP(i, n){
    cin >> xyc[i].x >> xyc[i].y >> xyc[i].c;
    int flag = 0;
    if((xyc[i].x / k) % 2 == 1){
      flag += 1;
    }
    xyc[i].x %= k;
    if((xyc[i].y / k) % 2 == 1){
      flag += 1;
    }
    xyc[i].y %= k;
    if((flag % 2 == 0 && xyc[i].c == 'B') || (flag % 2 == 1 && xyc[i].c == 'W')){
      xyc[i].y += k;
    }
  }

  REP(i,n){
    a[xyc[i].x + 1][xyc[i].y + 1] += 1;
  }

  REP(i,k+1){
    FOR(j,1,k*2+1){
      a[i][j] += a[i][j-1];
    }
  }
  REP(i,k*2+1){
    FOR(j,1,k+1){
      a[j][i] += a[j-1][i];
    }
  }

  ll ans = 0;
  ll temp;
  REP(i,k){
    REP(j,k){
      temp = a[k][k*2] - (a[i][k*2]+a[k][k+j]) + 2*a[i][k+j] + a[k][j] - 2*a[i][j];
      ans = max({ans, temp, n-temp});
    }
  }

  cout << ans << endl;

  return 0;
}
[nu

Compiler output:
a.cc:74:1: error: expected unqualified-id before '[' token
   74 | [nu
      | ^
Language: C++

#include <iostream>

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

  std::vector<int[K]> v;
  for (int i=0; i<K; ++i) {
    v.push_back(int[K]);
  }
  for (int i=0; i<N; ++i) {
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: 'vector' is not a member of 'std'
    8 |   std::vector<int[K]> v;
      |        ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | 
a.cc:8:15: error: expected primary-expression before 'int'
    8 |   std::vector<int[K]> v;
      |               ^~~
a.cc:10:5: error: 'v' was not declared in this scope
   10 |     v.push_back(int[K]);
      |     ^
a.cc:10:17: error: expected primary-expression before 'int'
   10 |     v.push_back(int[K]);
      |                 ^~~
Language: C++

#include<bits/stdc++.h>

int x[100005];
int y[100005];
int B[2005][2005];
int W[2005][2005];

template<int VW, int VH> struct add2D {
	int v[VH][VW];
	void set(int x,int y,int c){v[y][x]=c;}
	void build(){
	int i,j;
	for(i=0;i<VH;i++){
		for(j=0;j<VW;j++){
			if(i>0){v[i][j]+=v[i-1][j];}
			if(j>0){v[i][j]+=v[i][j-1];}
			if(i>0&&j>0){v[i][j]-=v[i-1][j-1];}
		}
	}
	}
	int get(int sx,int sy,int tx,int ty){
	int ret=v[ty][tx];
	if(sy>0){ret-=v[sy-1][tx];}
	if(sx>0){ret-=v[ty][sx-1];}
	if(sy>0&&sx>0){ret+=v[sy-1][sx-1];}
	return ret;
	}
};

add2D<4005,4005>BR,WR;

int main() {

	int N,K;

	cin>>N>>K;

	int i,j;

	for(i=0;i<N;i++){
		char c;
		cin>>x[i]>>y[i]>>c;

		if(c=='W'){W[y[i]%(2*K)][x[i]%(2*K)]++;}
		else{B[y[i]%(2*K)][x[i]%(2*K)]++;}
	}
	for(i=0;i<4*K;i++){
		for(j=0;j<4*K;j++){
		BR.set(j,i,B[i%(2*K)][j%(2*K)]);
		WR.set(j,i,W[i%(2*K)][j%(2*K)]);
		}
	}
	BR.build();
	WR.build();

	int ans=0;

	for(i=0;i<2*K;i++){
		for(j=0;j<2*K;j++){
			int b=BR.get(j,i,j+K-1,i+K-1)+BR.get(j+K,i+K,j+(2*K)-1,i+(2*K)-1);
			int w=WR.get(j+K,i,j+(2*K)-1,i+K-1)+WR.get(j,i+K,j+K-1,i+(2*K)-1);
			if(ans<w+b){ans=w+b;}
		}
	}
	cout<<ans<<endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   36 |         cin>>N>>K;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:65:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   65 |         cout<<ans<<endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:65:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   65 |         cout<<ans<<endl;
      |                    ^~~~
      |                    std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LLI long long int
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
#define Pos(i) cout<<(i?"Possible":"Impossible")<<endl
#define co(i) cout<<i<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
うんちぶりぶり
int main(){
    int n,k; cin>>n>>k;
    int board[1001][1001][2]={};
    FOR(i,0,n){
        int x,y; cin>>x>>y;
        char c; cin>>c;
        int color=(c=='B'?0:1);
        x%=2*k;
        y%=2*k;
        if(x>=k){
            x-=k;
            color^=1;
        }
        if(y>=k){
            y-=k;
            color^=1;
        }
        board[x+1][y+1][color]++;
    }
    FOR(i,0,k+1){
        FOR(j,1,k+1){
            board[i][j][0]+=board[i][j-1][0];
            board[i][j][1]+=board[i][j-1][1];
        }
    }
    FOR(i,0,k+1){
        FOR(j,1,k+1){
            board[j][i][0]+=board[j-1][i][0];
            board[j][i][1]+=board[j-1][i][1];
        }
    }
    int ans=-INF;
    FOR(i,1,k+1){
        FOR(j,1,k+1){
            int t=board[k][k]-2*board[i][k]-2*board[k][j]+4*board[i][j];
            ans=max({ans,t,-t});
        }
        cout<<endl;
    }
}


Compiler output:
a.cc:21:1: error: '\U00003046\U00003093\U00003061\U00003076\U0000308a\U00003076\U0000308a' does not name a type
   21 | うんちぶりぶり
      | ^~~~~~~~~~~~~~
Language: C

#include <stdio.h>
 
int check_BW(int x,int y,int K,int i,int j){
    
    if((x>=j && x<j+K) || (x<j-K)){
        if((y>=i && y<i+K) || (y<i-K)){
            return 1;
        }else{
            return 0;
        }
    }else{
        if((y>=i && y<i+K) || (y<i-K)){
            return 0;
        }else{
            return 1;
        }
    }
}
 
int main(void){
    int N,K;
    scanf("%d %d",&N,&K);
    int i,j,k;
    int x[N],y[N];
    char c[N];
    for(i=0; i<N; i++){
        scanf("%d %d %c",&j,&k,&c[i]);
        x[i] = j % (2 * K);
        y[i] = k % (2 * K);
        if(c[i] == 'W'){
            x[i] += K;
        }
    }
    int check = 0, max = 0;
    for(i=0; i<K*2; i++){
        for(j=0; j<2*K; j++){
            for(k=0; k<N; k++){
                check += check_BW(x[k],y[k],K,c[k],i,j);
            }
            if(max<check){
                max = check;
            }
            check = 0;
        }
    }
    printf("%d",max);
}

Compiler output:
main.c: In function 'main':
main.c:38:26: error: too many arguments to function 'check_BW'
   38 |                 check += check_BW(x[k],y[k],K,c[k],i,j);
      |                          ^~~~~~~~
main.c:3:5: note: declared here
    3 | int check_BW(int x,int y,int K,int i,int j){
      |     ^~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int max(int a,int b){
  if(a<b){
    return b;
  }else{
    return a;
  }
}

int main(){
  int n,k;
  int count=0;
  int ans=0;
  int x_color,y_color;
  cin>>n>>k;
  int x[n],y[n],c[n];
  char color;
  for(int i=0;i<n;i++){
    cin>>x[i]>>y[i]>>color;
    if(color=="W"){
      c[i]=0;
    }else{
      c[i]=1;
    }
  }
  for(int ini_color=0;ini_color<2;ini_color++){
    for(int x_offset=0;x_offset<3;x_offset++){
      for(int y_offset=0;y_offset<3;y_offset++){
        for(int i=0;i<n;i++){
          if(1<=(x[i]-x_offset)%6<=3){
            x_color=ini_color^1;
          }else{
            x_color=ini_color;
          }
          if(1<=(y[i]-y_offset)%6<=3){
            y_color=ini_color^1;
          }else{
            y_color=ini_color;
          }
          if((x_color+y_color)%2==c[i]){
            count+=1;
          }
        }
        ans=max(ans,count);
      }
    }
  }
  cout<<ans<<endl;
}
          
      

Compiler output:
a.cc: In function 'int main()':
a.cc:22:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |     if(color=="W"){
      |        ~~~~~^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int K=3005;
int x[K][K];
int n,k;
int getsize(int x1,int y1,int x2,int y2){
    return x[x2][y2]-x[x2][y1]-x[x1][y2]+x[x1][y1];
}
int main()
{
    cin>>n>>k;
    int a,b;
    char c;
    for(int i=1;i<=n;i++){
        cin>>a>>b>>c;
        a%=2*k,b%=2*k;
        if(c=='W')
            b+=k;
        x[a%(2*k)+1][b%(2*k)+1]++;
    }
    for(int i=1;i<=2*k;i++)
        for(int j=1;j<=2*k;j++)
            x[i][j]=x[i][j]+(x[i-1][j]+x[i][j-1]-x[i-1][j-1]);
    int ans=0,sum;
    for(int i=1;i<=k;i++)
        for(int j=1;j<=k;j++){
            sum=getsize(0,0,i,j);
            sum+=getsize(i,j,k+i,k+j);
            sum+=getsize(k+i,k+j,2*k,2*k);
            sum+=getsize(k+i,0,2*k,j);
            sum+=getsize(0,k+j,i,2*k);
            sum=max(n-sum,sum);
            ans=max(ans,sum);
        }
    cout<<ans
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:14: error: expected ';' before '}' token
   35 |     cout<<ans
      |              ^
      |              ;
   36 | }
      | ~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int order[2001][2001] = {};

int sum_square(int px, int py, int K) {
	int cnt = 0;
	int l = max(0, px - 1);
	int r = min(px + K - 1, 2 * K - 1);
	int b = max(0, py - 1);
	int t = min(py + K - 1, 2 * K - 1);
	if (t < 0 || r < 0 || b > 2 * K - 1 || l > 2 * K - 1) return 0;
	cnt += order[r][t];
	if (px > 0) cnt -= order[l][t];
	if (py > 0) cnt -= order[r][b];
	if (px > 0 && py > 0) cnt += order[l][b];
	return cnt;
}

int main(int argc, char *argv[]) {
	int N, K;
	cin >> N >> K;

	for (int i = 0; i < N; i++) {
		int x, y;
		string c;
		cin >> x >> y;
		cin >> c;
		if (c[0] == 'W')
			x += K;
		order[x % (2 * K)][y % (2 * K)] += 1;
	}


	for (int y = 0; y < 2 * K + 1; y++) {
		for (int x = 0; x < 2 * K; x++) {
			order[x + 1][y] += order[x][y];
		}
	}

	for (int y = 0; y < 2 * K; y++) {
		for (int x = 0; x < 2 * K + 1; x++) {
			order[x][y + 1] += order[x][y];
		}
	}

	int max = 0;
	for (int px = 0; px < 2 * K; px++) {
		for (int py = 0; py < 2 * K; py++) {
			int cnt = 0;
			cnt += sum_square(px, py, K);
			cnt += sum_square(px + K, py + K, K);
			cnt += sum_square(px - K, py + K, K);
			cnt += sum_square(px + K, py - K, K);
			cnt += sum_square(px - K, py - K, K);
			cnt = max(N - cnt, cnt);
			if (cnt > max) max = cnt;
		}
	}

	cout << max << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:58:34: error: 'max' cannot be used as a function
   58 |                         cnt = max(N - cnt, cnt);
      |                               ~~~^~~~~~~~~~~~~~
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int k2 = 2*k;
		int[][] mat = new int[2*k][k];
		
		for (int i=0;i<n;i++) {
			int x = sc.nextInt()%k2;
			int y = sc.nextInt()%k2;
			if (y>=k) {
				y -= k;
				x = (x+k)%k2;
			}
			String s = sc.next();
			if (s.equals("W")) {
				for (int c=0;c<k2;c++) {
					for (int r=0;r<k;r++) {
						if ((((((c-x+k)/k%2)^((r-y+k)/k%2)))&1)==1)
							mat[c][r]++;
					}
				}
			} else {
				for (int c=0;c<k2;c++) {
					for (int r=0;r<k;r++) {
						if ((((((c-x+k)/k%2)^((r-y+k)/k%2)))&1)==0)
							mat[c][r]++;
					}
				}
			}
		}

		int ans = 0;
		for (int c=0;c<k2;c++) {
			for (int r=0;r<k;r++) {
				ans = Math.max(ans, mat[c][r]);
			}
		}
		
		System.out.println(ans);
	}


Compiler output:
Main.java:43: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

#include <iostream>
#include <vector>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <assert.h>
#include <stdio.h>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define MOD 1000000007
//#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<vector<ll> > mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;
const int dx[9] = {-1, 0, 0, 1, -1, -1, 1, 1, 0};
const int dy[9] = {0, -1, 1, 0, -1, 1, -1, 1, 0};
 
int N, K;
int bb[4010][4010];
int ww[4010][4010];
 
int bacc[4010][4010];
int wacc[4010][4010];
int bsum(int x1, int y1, int x2, int y2){
  return bacc[y2][x2] - bacc[y2][x1] - bacc[y1][x2] + bacc[y1][x1];
}
int wsum(int x1, int y1, int x2, int y2){
  return wacc[y2][x2] - wacc[y2][x1] - wacc[y1][x2] + wacc[y1][x1];
}
 
signed main()
{
  cin >> N >> K;
  int K2 = K * 2;
  REP(i,N) {
    int x, y;
    char c;
    cin >> x >> y >> c;
    x %= K2;
    y %= K2;
    if (c == 'B') {
      bb[y][x]++;
      bb[y+K2][x]++;
      bb[y][x+K2]++;
      bb[y+K2][x+K2]++;
    } else {
      cc[y][x]++;
      cc[y+K2][x]++;
      cc[y][x+K2]++;
      cc[y+K2][x+K2]++;
    }
  }

  REP(y,K2*2) REP(x,K2*2) {
    bacc[y+1][x+1] += bb[y][x] + bacc[y+1][x] + bacc[y][x+1] - bacc[y][x];
    wacc[y+1][x+1] += ww[y][x] + wacc[y+1][x] + wacc[y][x+1] - wacc[y][x];
  }

  int ans = 0;
  REP(y1,K2) REP(x1,K2) {
    int x2 = x1 + K, y2 = y1 + K;
    int sum = bsum(x1, y1, x2, y2) + bsum(x2, y2, x2+K, y2+K);
    sum += wsum(x2, y1, x2+K, y2) + wsum(x1, y2, x2, y2+K);
  
    ans = max(ans, sum);
  }

  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:7: error: 'cc' was not declared in this scope; did you mean 'c'?
   58 |       cc[y][x]++;
      |       ^~
      |       c
Language: C

#include<stdio.h>
#include<stdlib.h>
 
int main(){
 
  int N, K, i, j, k, a, b, num, max;
  char color;
  int x[100000], y[100000];
  char c[100000];
  scanf("%d %d", &N, &K);
  for(i=0; i<N; i++){
    scanf(" %d %d %c", &a, &b, &color);
    x[i]=a; y[i]=b; c[i]=color;
  }

  num=0; max=0;
  for(i=0; i<N; i++){
    num=1;

    for(j=1-K; j<K; j++){
      for(k=1-K; k<K; k++){
        a=x[i]+j; b=y[i]+k;
        if(a<0)a=0; if(b<0)b=0;
        for(m=0;m<N;m++){
          if(m==i)continue;
          if(((abs(a,x[m])/K)%2)^((abs(b,y[m])/K)%2)){
            if(c[m]!=c[i])num++;
          }else{
            if(c[m]==c[i])num++;
          }
        }
      }
    }

    if(num>max)max=num;
  }

  printf("%d\n", max);
 
}

int abs(int a, int b){
  int c = a>b?a-b:b-a;
  return(c);
}

Compiler output:
main.c: In function 'main':
main.c:24:13: error: 'm' undeclared (first use in this function)
   24 |         for(m=0;m<N;m++){
      |             ^
main.c:24:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:16: error: too many arguments to function 'abs'
   26 |           if(((abs(a,x[m])/K)%2)^((abs(b,y[m])/K)%2)){
      |                ^~~
In file included from main.c:2:
/usr/include/stdlib.h:980:12: note: declared here
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
main.c:26:36: error: too many arguments to function 'abs'
   26 |           if(((abs(a,x[m])/K)%2)^((abs(b,y[m])/K)%2)){
      |                                    ^~~
/usr/include/stdlib.h:980:12: note: declared here
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
main.c: At top level:
main.c:42:5: error: conflicting types for 'abs'; have 'int(int,  int)'
   42 | int abs(int a, int b){
      |     ^~~
/usr/include/stdlib.h:980:12: note: previous declaration of 'abs' with type 'int(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int K=3005;
int x[K][K];
int n,k;
int getsize(int x1,int y1,int x2,int y2){
    return x[x2][y2]-x[x2][y1]-x[x1][y2]+x[x1][y1];
}
int main()
{
    scanf("%d%d",&n,&k);
    int a,b;
    char c;
    for(int i=1;i<=n;i++){
        scanf("%d%d %c",&a,&b,&c);
        a%=2*k,b%=2*k;
        if(c=='W')
            b+=k;
        x[a%(2*k)+1][b%(2*k)+1]++;
    }
    for(int i=1;i<=2*k;i++)
        for(int j=1;j<=2*k;j++)
            x[i][j]=x[i][j]+(x[i-1][j]+x[i][j-1]-x[i-1][j-1]);
    int ans=0,sum;
    for(int i=1;i<=k;i++)
        for(int j=1;j<=k;j++){
            sum=getsize(0,0,i,j);
            sum+=getsize(i,j,k+i,k+j);
            sum+=getsize(k+i,k+j,2*k,2*k);
            sum+=getsize(k+i,0,2*k,j);
            sum+=getsize(0,k+j,i,2*k);
            ans=max(ans,sum);
        }
    printf("%d\n",ans);
}
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int K=3005;
int x[K][K];
int n,k;
int getsize(int x1,int y1,int x2,int y2){
    return x[x2][y2]-x[x2][y1]-x[x1][y2]+x[x1][y1];
}
int main()
{
    scanf("%d%d",&n,&k);
    int a,b;
    char c;
    for(int i=1;i<=n;i++){
        scanf("%d%d %c",&a,&b,&c);
        a%=2*k,b%=2*k;
        if(c=='W')
            b+=k;
        x[a%(2*k)+1][b%(2*k)+1]++;
    }
    for(int i=1;i<=2*k;i++)
        for(int j=1;j<=2*k;j++)
            x[i][j]=x[i][j]+(x[i-1][j]+x[i][j-1]-x[i-1][j-1]);
    int ans=0,sum;
    for(int i=1;i<=2*k;i++)
        for(int j=1;j<=2*k;j++){
            sum=getsize(0,0,i,j);
            sum+=getsize(i,j,k+i,k+j);
            sum+=getsize(k+i,k+j,2*k,2*k);
            sum+=getsize(k+i,0,2*k,j);
            sum+=getsize(0,k+j,i,2*k);
            ans=max(ans,sum);
        }
    printf("%d\n",ans);
}
提出情報
提出日時

Compiler output:
a.cc:42:11: error: redefinition of 'const int K'
   42 | const int K=3005;
      |           ^
a.cc:5:11: note: 'const int K' previously defined here
    5 | const int K=3005;
      |           ^
a.cc:43:5: error: redefinition of 'int x [3005][3005]'
   43 | int x[K][K];
      |     ^
a.cc:6:5: note: 'int x [3005][3005]' previously declared here
    6 | int x[K][K];
      |     ^
a.cc:44:5: error: redefinition of 'int n'
   44 | int n,k;
      |     ^
a.cc:7:5: note: 'int n' previously declared here
    7 | int n,k;
      |     ^
a.cc:44:7: error: redefinition of 'int k'
   44 | int n,k;
      |       ^
a.cc:7:7: note: 'int k' previously declared here
    7 | int n,k;
      |       ^
a.cc:45:5: error: redefinition of 'int getsize(int, int, int, int)'
   45 | int getsize(int x1,int y1,int x2,int y2){
      |     ^~~~~~~
a.cc:8:5: note: 'int getsize(int, int, int, int)' previously defined here
    8 | int getsize(int x1,int y1,int x2,int y2){
      |     ^~~~~~~
a.cc:48:5: error: redefinition of 'int main()'
   48 | int main()
      |     ^~~~
a.cc:11:5: note: 'int main()' previously defined here
   11 | int main()
      |     ^~~~
a.cc:75:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
   75 | 提出情報
      | ^~~~~~~~