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

#include <bits/stdc++.h>
using namespace std;
int N;
vector<vector <int> > p;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
bool isFind = false;
int safe(int i, int j) {
    return (0 <= i && i < 100000) && (0 <= j && j < 100000);
}
void f(int i, int j, int cnt, int index) {
  
    if (cnt == p[index][0]) {
        if (i == p[index][1] && j == p[index][2])
            isFind = true;
        return;
    }
    for (int k = 0; k < 4; k++) {
        if (safe(i+dx[k], j + dy[k])) {
			f(i+dx[k], j+dy[k], cnt+1, index);
		}
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin >> N;

    for (int i = 0; i < N; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        p.push_back({a,b,c});
    }

    int x, y, time;
    x = y = time = 0;
    for (int i = 0; i < p.size() i++) {
        isFind = false;
        if ((abs(a-p[i][1]) + abs(b-p[i][2])) <= abs(c-p[i][0]))
        f(x, y, time, i);
        if (isFind == false) {
            cout << "No\n";
            return 0;
        }
    }
    cout <<"Yes\n";
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:36:33: error: expected ';' before 'i'
   36 |     for (int i = 0; i < p.size() i++) {
      |                                 ^~
      |                                 ;
a.cc:38:18: error: 'a' was not declared in this scope
   38 |         if ((abs(a-p[i][1]) + abs(b-p[i][2])) <= abs(c-p[i][0]))
      |                  ^
a.cc:38:35: error: 'b' was not declared in this scope
   38 |         if ((abs(a-p[i][1]) + abs(b-p[i][2])) <= abs(c-p[i][0]))
      |                                   ^
a.cc:38:54: error: 'c' was not declared in this scope
   38 |         if ((abs(a-p[i][1]) + abs(b-p[i][2])) <= abs(c-p[i][0]))
      |                                                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int N;
vector<vector <int> > p;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
bool isFind = false;
int safe(int i, int j) {
    return (0 <= i && i < 100000) && (0 <= j && j < 100000);
}
void f(int i, int j, int cnt, int index) {
  
    if (cnt == p[index][0]) {
        if (i == p[index][1] && j == p[index][2])
            isFind = true;
        return;
    }
    for (int k = 0; k < 4; k++) {
        if (safe(i+dx[k], j + dy[k])) {
			f(i+dx[k], j+dy[k], cnt+1, index);
		}
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin >> N;

    for (int i = 0; i < N; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        p.push_back({a,b,c});
    }

    int x, y, time;
    x = y = time = 0;
    for (int i = 0; i < p.size() i++) {
        isFind = false;
        //if ((abs(a-p[i][1]) + abs(b-p[i][2])) <= abs(c-p[i][0]))
        f(x, y, time, i);
        if (isFind == false) {
            cout << "No\n";
            return 0;
        }
        x = p[i][1];
        y = p[i][2];
        time = p[i][0];
        
    }
    cout <<"Yes\n";
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:36:33: error: expected ';' before 'i'
   36 |     for (int i = 0; i < p.size() i++) {
      |                                 ^~
      |                                 ;
Language: C++

#include <cstdio>
#include <cstdlib>

int main() {
  int n;
  scanf("%d", &n);

  int X=0, Y=0, T=0;
  for (int i=0; i<N; ++i) {
    int t, x, y;
    scanf("%d %d %d", &t, &x, &y);
    int dx=std::abs(X-x), dy=std::abs(Y-y);
    int dt=t-T;
    if ((dx+dy+dt) & 1 || (dx+dy) > dt)
      return !printf("No\n");

    X = x;
    Y = y;
    T = t;
  }
  puts("Yes");
}
// Sent from my iPhone

Compiler output:
a.cc: In function 'int main()':
a.cc:9:19: error: 'N' was not declared in this scope
    9 |   for (int i=0; i<N; ++i) {
      |                   ^
Language: C++

#include"bits/stdc++.h"
using namspace std;
int main()
{
	int n,t,x,y;
	bool f=true;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d %d %d",&t,&x,&y);
		if(t%(x+y)!=0&&(t-x-y)%2!=0||t<(x+y))
			flag=0;
	}
	if(f) 
		printf("Yes");
	else
		printf("No");
	return 0;
}


Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namspace'
    2 | using namspace std;
      |       ^~~~~~~~
a.cc: In function 'int main()':
a.cc:12:25: error: 'flag' was not declared in this scope
   12 |                         flag=0;
      |                         ^~~~
Language: C++

#include"bits/stdc++.h"
using namspace std;
int main()
{
	int n,t,x,y;
	bool flag=true;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d %d %d",&t,&x,&y);
		if(t%(x+y)!=0&&(t-x-y)%2!=0||t<(x+y))
			flag=0;
	}
	if(f) 
		printf("Yes");
	else
		printf("No");
	return 0;
}
 

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namspace'
    2 | using namspace std;
      |       ^~~~~~~~
a.cc: In function 'int main()':
a.cc:14:12: error: 'f' was not declared in this scope
   14 |         if(f)
      |            ^
Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>
 
using namespace std;
 
typedef struct
{
	int t, x, y;
} data_t;
 
int main()
{
	int n;
	vector<data_t> dataz;
	data_t temp, temp2;
 
	cin >> n;
 
	/*for (int i = 0; i < n; i++) {
		
		dataz.push_back(temp);
	}*/
	cin >> temp.t >> temp.x >> temp.y;
 
	if (temp.x + temp.y > temp.t) {
		cout << "No" << endl;
		return 0;
	}
 
	for (int i = 0; i < n - 1; i++) {
		int mass;
		cin >> temp2.t >> temp2.x >> temp2.y;
		mass = abs(temp.x - temp2.x) + abs(temp.y + temp2.y);
		if ((mass - (temp2.t - temp.t)) % 2 != 0 || mass <= 0 || mass - (temp2.t - temp.t)) < 0) {
			cout << "No" << endl;
			return 0;
		}
		temp = temp2;
	}
 
	cout << "Yes" << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:101: error: expected primary-expression before '<' token
   35 |                 if ((mass - (temp2.t - temp.t)) % 2 != 0 || mass <= 0 || mass - (temp2.t - temp.t)) < 0) {
      |                                                                                                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,x=0,y=0,i,s,a,b,f=1;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %d %d",&s,&a,&b);
		if(((fabs(x-a)+fabs(y-b))>s||(fabs(x-a)+fabs(y-b)-s)%2)&&f)
		{
			printf("No");
			f=0;
		}
	}
	if(f)
	{
		printf("Yes");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:69: error: invalid operands of types '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} and 'int' to binary 'operator%'
   10 |                 if(((fabs(x-a)+fabs(y-b))>s||(fabs(x-a)+fabs(y-b)-s)%2)&&f)
      |                                              ~~~~~~~~~~~~~~~~~~~~~~~^~
      |                                                                  |   |
      |                                                                  |   int
      |                                                                  __gnu_cxx::__enable_if<true, double>::__type {aka double}
Language: C++

#include<stdio.h>
#include<iostream>

using namespace std;

int main()
{
	int n;
	int flag = 0;
	cin>>n;
	int t1,x1=0,y1=0,
	while(n--)
	{
		int t,x,y;
		cin>>t>>x>>y;
		if((t-x+x1-y+y1)>0 && (t-x+x1-y+y1)%2 == 0) continue;
		else flag = 1;
		x1 = x;
		y1 = y;	
	}	
	if(flag == 1) cout<<"No";
	else cout<<"Yes";
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: expected unqualified-id before 'while'
   12 |         while(n--)
      |         ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
bool square[1000005];
int main(){
    ll n;
    cin>>n;
    ll x=0,y = 0,t=0;
    bool flag = true;
    for(ll i=0;i<n;i++){
        ll t,xnew,ynew;
        cin>>t>>xnew>>ynew;
        t - t - tnew;
        ll num = abs(xnew-x)+abs(ynew-y);
        if(t==num){
            flag = true;
            
        }
        if(t<num){
            flag = false;
            break;
        }
        if(t>num){
            if((t-num) %2==0){
                flag = true;
            }
            else{
                flag = false;
                break;
            }
        }
        x = xnew;
        y=ynew;
        tnew = t;
        
    }
    if(flag == true){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'tnew' was not declared in this scope; did you mean 'ynew'?
   13 |         t - t - tnew;
      |                 ^~~~
      |                 ynew
Language: C++

#include <iostream>
#include <cstdlib>
using namespace std;
 //Compiler version g++ 6.3.0
 
bool check(int t,int x,int y){
	int xy = x + y;
	t -= xy;
	if(xy == 1&&t == 3){
		return true;
	}
	t = abs(t);
	if
	if(!(t % 4)){
		return true;
	}else{
		return false;
	}
}

 int main()
 {
 	int n;
 	cin >> n;
 	int t[n],x[n],y[n];
 	bool b[n] = {false};
 	for(int i = 0;i < n;i++){
 		cin >> t[i]>>x[i]>>y[i];
 	}
 	
 	b[0] = check(t[0],x[0],y[0]);
 	
 	int dt, dx, dy;
 	
 	for(int i = 1;i < n;i++){
 		dt = abs(t[i] - t[i-1]);
 		dx = abs(x[i] - x[i-1]);
 		dy = abs(y[i] - y[i-1]);
 		
 		b[i] = check(dt, dx, dy);
 	}
 	
 	for(bool i : b){
 		if(!i){
 			cout << "No" << endl;
 			return 0;
 		}
 	}
 	cout << "Yes" << endl;
 	return 0;
 }

Compiler output:
a.cc: In function 'bool check(int, int, int)':
a.cc:14:9: error: expected '(' before 'if'
   14 |         if(!(t % 4)){
      |         ^~
      |         (
a.cc:16:10: error: 'else' without a previous 'if'
   16 |         }else{
      |          ^~~~
Language: C++

#include<math.h>
#include <stdlib.h>
int main() {
	int n;
	int *t, *x, *y;
	scanf("%d", &n);
	t = (int *)malloc((n + 1) * sizeof(int));  /* メモリ領域の確保 */
	x = (int *)malloc((n + 1) * sizeof(int));
	y = (int *)malloc((n + 1) * sizeof(int));
	int tf = 1;

	int i;
	t[0] = 0;
	x[0] = 0;
	y[0] = 0;
	for (i = 1; i < n + 1; i++) {
		scanf("%d %d %d", &t[i], &x[i], &y[i]);
	}
	for (i = 0; i < n ; i++) {
		if ((fabs(x[i + 1] - x[i]) + fabs(y[i + 1] - y[i])) > (t[i + 1] - t[i])|| ((int)(fabs(x[i + 1] - x[i]) + fabs(y[i + 1] - y[i])) -(t[i + 1] - t[i]))%2==1) {
			printf("No");
			tf = 0;
			break;
		}
	}
	if (tf == 1)printf("Yes");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'scanf' was not declared in this scope
    6 |         scanf("%d", &n);
      |         ^~~~~
a.cc:21:25: error: 'printf' was not declared in this scope
   21 |                         printf("No");
      |                         ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <stdlib.h>
  +++ |+#include <cstdio>
    3 | int main() {
a.cc:26:21: error: 'printf' was not declared in this scope
   26 |         if (tf == 1)printf("Yes");
      |                     ^~~~~~
a.cc:26:21: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <cstdio>
#include <string>
#include <math.h>

#include<iostream>
#include <tuple>
#include <vector>

using namespace std;

int main() {

	int N;
	cin >> N;

	struct Record
	{
		int t;
		int x;
		int y;
	};

	vector<Record> recordContainer;

	for (int i = 0; i < N; i++){
		int t, x, y;
		cin >> t;
		cin >> x;
		cin >> y;

		recordContainer.push_back({ t, x, y });
	}

	//#TODO 相対化
	Record zero = { 0, 0, 0 };
	for(auto& absRecord : recordContainer){
		Record relativeRecord = { absRecord.t - zero.t, absRecord.x - zero.x, absRecord.y - zero.y };
		zero = absRecord;
		absRecord = relativeRecord;
	}

	//判定
	auto isEnabled = [](auto record){
		if (abs(record.x) + abs(record.y) > t) {
			return false;
		}

		for (int i = 1; i < record.t; i++) {
			int tX = i;
			int tY = record.t - i;

			if (abs(tX - record.x) % 2 == 0
				&& abs(tY - record.y) % 2 == 0) {
				return true;
			}
		}

		return false;
	};

	for (auto record : recordContainer) {
		if (!isEnabled(record)) {
			cout << "No";
			return 0;
		}
	}

	cout << "Yes";

	return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:44:53: error: 't' was not declared in this scope
   44 |                 if (abs(record.x) + abs(record.y) > t) {
      |                                                     ^
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[][] b = new int[N][3];
for(int i = 0; i < N ; i++){
    for(int j = 0; j < 3 ; j++){
      b[i][j] = sc.nextInt();
    }
}
int place = 0;
int chk = 0;
for(int i=0; i<N; i++){
  if(N <= abs(place - b[N][1] + b[N][2])){
    if(N % 2 == 0){
      if(abs(N - abs(place - b[N][1] + b[N][2])) % 2 != 0){
        chk = 1;
       }
    }else{
      if(abs(N - abs(place - b[N][1] + b[N][2])) % 2 == 0){
        chk = 1;
      }
    }
  }
   place = b[N][1] + b[N][2];
}
if(chk == 0) System.out.print("Yes");
else         System.out.print("No");
}//main
}//Main

Compiler output:
Main.java:15: error: cannot find symbol
  if(N <= abs(place - b[N][1] + b[N][2])){
          ^
  symbol:   method abs(int)
  location: class Main
Main.java:17: error: cannot find symbol
      if(abs(N - abs(place - b[N][1] + b[N][2])) % 2 != 0){
                 ^
  symbol:   method abs(int)
  location: class Main
Main.java:21: error: cannot find symbol
      if(abs(N - abs(place - b[N][1] + b[N][2])) % 2 == 0){
                 ^
  symbol:   method abs(int)
  location: class Main
3 errors
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[][] b = new int[N][3];
for(int i = 0; i < N ; i++){
    for(int j = 0; j < 3 ; j++){
      b[i][j] = sc.nextInt();
    }
}
int place = 0;
int chk = 0;
for(int i=0; i<N; i++){
  if(N <= abs(place - b[N][1] + b[N][2])){
    if(N % 2 == 0){
      if(abs(N - abs(place - b[N][1] + b[N][2])) % 2 != 0){
        chk = 1; 
    }else{
      if(abs(N - abs(place - b[N][1] + b[N][2])) % 2 == 0){
        chk = 1;
    }
  }
   place = b[N][1] + b[N][2];
}
}//main
}//Main

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

#include<algorithm>
#include<array>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

using std::cin;
using std::cout;
using std::endl;
using std::string;

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)

int main()
{
	int n;
	string ans="No";
	std::array<int, 10 ^ 5> t, x, y;
	/*std::vector<int> t;
	std::vector<int> x;
	std::vector<int> y;*/
	cin >> n;
	/*t.resize(n);
	x.resize(n);
	y.resize(n);*/
	fill(t.begin(), t.end(), 0);
	fill(x.begin(), x.end(), 0);
	fill(y.begin(), y.end(), 0);
	FOR(i, 1, n+1) {
		cin >> t[i] >> x[i] >> y[i];
	}
	int a = 1;
	int b = 0;
	while (a <= n) {
		b = (x[a] - x[a - 1])+(y[a] - y[a - 1]);
		if (b / (t[a] - t[a - 1]) == 1) {
			ans = "Yes";
		}
		else if (abs(b) == 1 and (t[a] - t[a - 1]) % 2 == 1) {
			ans = "Yes";
		}
		a++;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:28: warning: result of '10^5' is 15; did you mean '1e5'? [-Wxor-used-as-pow]
   23 |         std::array<int, 10 ^ 5> t, x, y;
      |                            ^
      |                         --
      |                         1  e
a.cc:23:25: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
   23 |         std::array<int, 10 ^ 5> t, x, y;
      |                         ^~
      |                         0xa
a.cc:31:9: error: 'fill' was not declared in this scope; did you mean 'std::fill'?
   31 |         fill(t.begin(), t.end(), 0);
      |         ^~~~
      |         std::fill
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: 'std::fill' declared here
  191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
Language: Java


import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author rn-sshawish
 */
public class AtCOder86C {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int t = 0, x = 0, y = 0;
        boolean state = true;
        for (int i = 0; i < n; i++) {
            int t1 = input.nextInt();
            int x1 = input.nextInt();
            int y1 = input.nextInt();
            int distanceDiff;

                int fiffY = Math.abs(x - x1);
//                if (fiffY != 0 && x != 0&& x1 != 0) {
//                    fiffY ++;
//                }
                int fiffX = Math.abs(y - y1);
//                if (fiffX != 0 && y != 0&& y1 != 0) {
//                    fiffX ++;
//                }
                distanceDiff = fiffX + fiffY;
            
            int timeDiff = t1 - t;
            if (distanceDiff <= timeDiff) {
                t = t1;
                x = x1;
                y = y1;
            } else {
                state = false;
                break;
            }
        }
        if (state) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}



Compiler output:
Main.java:13: error: class AtCOder86C is public, should be declared in a file named AtCOder86C.java
public class AtCOder86C {
       ^
1 error
Language: C

#include <stdio.h>
#include <math.h>

int main(void){
  int N, i;
  scanf("%d",&N);
  int t[N],x[N],y[N],tmp,count = 0;
  t[0] = x[0] = y[0] = 0;
  for(i = 1;i < N; i++){
    scanf("%d",&t[i]);
    scanf("%d",&x[i]);
    scanf("%d",&y[i]);
  }
  for(i = 0; i < N -1; i++){
    tmp = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
    if((t[i] <= tmp) && (tmp % 2 == 0))
      count += 1
  }
  if(count == N)
    printf("Yes");
  else
    printf("No");
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:15:11: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   15 |     tmp = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
      |           ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c:17:17: error: expected ';' before '}' token
   17 |       count += 1
      |                 ^
      |                 ;
   18 |   }
      |   ~
Language: C

#include <stdio.h>
#include <math.h>

int main(void){
  int N, i;
  scanf("%d",&N);
  int t[N],x[N],y[N],tmp;
  t[0] = x[0] = y[0] = 0;
  for(i = 1;i < N; i++){
    scanf("%d",&t[i]);
    scanf("%d",&x[i]);
    scanf("%d",&y[i]);
  }
  for(i = 0; i < N; i++){
    tmp = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
    if(t >= tmp && (t - tmp) % 2 == 0)
      printf("Yes");
    else
      printf("No");
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:15:11: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   15 |     tmp = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
      |           ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c:16:10: warning: comparison between pointer and integer
   16 |     if(t >= tmp && (t - tmp) % 2 == 0)
      |          ^~
main.c:16:30: error: invalid operands to binary % (have 'int *' and 'int')
   16 |     if(t >= tmp && (t - tmp) % 2 == 0)
      |                    ~~~~~~~~~ ^
      |                       |
      |                       int *
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int n;
	int i;
	int t[n],x[n],y[n];
	cin >> n;
	for(i=0;i<n;i++){
	cin >> t[i] >> x[i] >> y[i];
}
	
	int a=0;
	int b,c;
	if((t[0]<(x[0]+y[0]))) || (((t[0]-x[0]-y[0])%2) != 0){
	a=1;
}
	for(i=0;i<n-1;i++){
	b=x[i+1]-x[i];
	c=y[i+1]-y[i];
	if(x[i+1]<x[i]){
	b=-b;
}
	if(y[i+1]<y[i]){
	c=-c;
}
	if(((t[i+1]-t[i])<(b+c)) || (((t[i+1]-t[i])-(b+c))%2) != 0){
	a=1;
}
}
	if(a == 0){
	cout << "Yes" << endl;
}
	if(a == 1){
	cout << "No" << endl;
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:32: error: expected primary-expression before '||' token
   15 |         if((t[0]<(x[0]+y[0]))) || (((t[0]-x[0]-y[0])%2) != 0){
      |                                ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long N=1e5;
long long dx[]={1,-1,0,0};
long long dy[]={0,0,1,-1};
bool validpos(long long x, long long y){
	return (x>=0)&&(y>=0)&&(x<=N)&&(y<=N);
}
int main(){
	long long n;
		cin >> n;
	long long x1=0,y1=0,t1=1;
	long long x2=0,y2=0,t2;
		while(n--){
			long long flag=0;
			cin >> t2 >> x2 >> y2;
				long long p=x2, r=y2;
				if(t2 == t1+1){
					for(long long j=0; j<3; ++j){
						long long q=x1+dx[j], s=y1+dy[j];
						if(validpos(q,s))
						if(p==q && r==s)
							flag=1;
					}
					if(flag==0){
						return !prlong longf("No\n");
					}
				}
				else{
					if(x1==x2 && y1==y2)
						return !prlong longf("No\n");
				}
				x1=x2;
				y1=y2;
				t1=t2;
		}
		prlong longf("Yes\n");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:57: error: 'prlong' was not declared in this scope; did you mean 'ulong'?
   26 |                                                 return !prlong longf("No\n");
      |                                                         ^~~~~~
      |                                                         ulong
a.cc:26:63: error: expected ';' before 'longf'
   26 |                                                 return !prlong longf("No\n");
      |                                                               ^~~~~~
      |                                                               ;
a.cc:26:64: error: 'longf' was not declared in this scope; did you mean 'long'?
   26 |                                                 return !prlong longf("No\n");
      |                                                                ^~~~~
      |                                                                long
a.cc:31:57: error: 'prlong' was not declared in this scope; did you mean 'ulong'?
   31 |                                                 return !prlong longf("No\n");
      |                                                         ^~~~~~
      |                                                         ulong
a.cc:31:63: error: expected ';' before 'longf'
   31 |                                                 return !prlong longf("No\n");
      |                                                               ^~~~~~
      |                                                               ;
a.cc:31:64: error: 'longf' was not declared in this scope; did you mean 'long'?
   31 |                                                 return !prlong longf("No\n");
      |                                                                ^~~~~
      |                                                                long
a.cc:37:17: error: 'prlong' was not declared in this scope; did you mean 'ulong'?
   37 |                 prlong longf("Yes\n");
      |                 ^~~~~~
      |                 ulong
Language: C++

#include <stdio.h>
#include <stdlib.h>
int main(){
int t[100000],x[100000],y[100000];
int N;
scanf("%d",N);
for(int k=0;k<N;k++){
scanf("%d %d %d",&t[k],&x[k],&y[k]);
}
if(t[0]<=abs(x[0])+abs(y[0])&&(abs(x[0])+abs(y[0])-t[0])%2==0){
printf("No");
return 0;
}
for(int k=1;k<N;k++){
if(t[k]-t[k-1]<=abs(x[k]-x[k-1])+abs(y[k]-y[k-1])&&(abs(x[k]-x[k-1])+abs(y[k]-y[k-1])-(t[k]-t[k-1]))%2==0){
printf("No");
return 0;
}
printf("Yes");
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: Java

import java.util.Scanner;

import common.U;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        // 現在位置から(x, y)離れた(ただしx, y >=0)座標にちょうどt秒で着く <=> t = x + y + 2k (k = 0, 1,...)
        // <=> (t - (x + y)) % 2 = 0 && t >= x + y
        int currX = 0;
        int currY = 0;
        int currT = 0;
        
        for (int i = 0; i < n; i++) {
            int nextT = sc.nextInt();
            int nextX = sc.nextInt();
            int nextY = sc.nextInt();
            int spanT = nextT - currT;
            int spanX = Math.abs(nextX - currX);
            int spanY = Math.abs(nextY - currY);
//            U.println("sT: " + spanT + ", sX: " + spanX + ", sY: " + spanY);
            if ((spanT - spanX - spanY) % 2 != 0 || spanT < spanX + spanY) {
                System.out.println("No");
                return;
            }
            currT = nextT;
            currX = nextX;
            currY = nextY;
        }
        System.out.println("Yes");
    }
}

Compiler output:
Main.java:3: error: package common does not exist
import common.U;
             ^
1 error
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ldb;

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define all(v) (v).begin(), (v).end()
#define dbg(a) cerr << #a << " = " << a << endl

const int N = 100100;
int t[N], x[N], y[N];

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    x[0] = y[0] = t[0] = 0;
    for(int i = 1; i <= n; ++i) {
        cin >> t[i] >> x[i] >> y[i];
    }
    for(int i = 1; i <= n; ++i) {
        if((t[i] - t[i-1]) % 2 != (abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]) % 2)) {
            cout << "No";
            return 0;
        }
        if(t[i] - t[i-1] < abs(x[i] - x[i-1]) + abs(y[i] - y[i-1])) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ldb;

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define all(v) (v).begin(), (v).end()
#define dbg(a) cerr << #a << " = " << a << endl

const int N = 100100;
int t[N], x[N], y[N];

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    x[0] = y[0] = t[0] = 0;
    for(int i = 1; i <= n; ++i) {
        cin >> t[i] >> x[i] >> y[i];
    }
    for(int i = 1; i <= n; ++i) {
        if((t[i] - t[i-1]) % 2 != (abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]) % 2)) {
            cout << "No";
            return 0;
        }
        if(t[i] - t[i-1] < abs(x[i] - x[i-1]) + abs(y[i] - y[i-1])) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

Compiler output:
a.cc:45:2: error: stray '#' in program
   45 | }#include <bits/stdc++.h>
      |  ^
a.cc:45:3: error: 'include' does not name a type
   45 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:60:11: error: redefinition of 'const int N'
   60 | const int N = 100100;
      |           ^
a.cc:16:11: note: 'const int N' previously defined here
   16 | const int N = 100100;
      |           ^
a.cc:61:5: error: redefinition of 'int t [100100]'
   61 | int t[N], x[N], y[N];
      |     ^
a.cc:17:5: note: 'int t [100100]' previously declared here
   17 | int t[N], x[N], y[N];
      |     ^
a.cc:61:11: error: redefinition of 'int x [100100]'
   61 | int t[N], x[N], y[N];
      |           ^
a.cc:17:11: note: 'int x [100100]' previously declared here
   17 | int t[N], x[N], y[N];
      |           ^
a.cc:61:17: error: redefinition of 'int y [100100]'
   61 | int t[N], x[N], y[N];
      |                 ^
a.cc:17:17: note: 'int y [100100]' previously declared here
   17 | int t[N], x[N], y[N];
      |                 ^
a.cc:63:5: error: redefinition of 'int main()'
   63 | int main() {
      |     ^~~~
a.cc:19:5: note: 'int main()' previously defined here
   19 | int main() {
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

const int MAX_N = 100005;
const int MM = 100000;
int N;
int t[MAX_N], x[MAX_N], y[MAX_N];

int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) {
  	scanf("%d %d %d", t + i, x + i, y + i);
  }
  int T = 0;
  int X = 0, Y = 0;
  bool doable = true;
  for (int i = 0; i < N; ++i) {
  	int diff = t[i] - T;
  	int dist = abs(X - x[i]) + abs(Y - y[i]);
  	printf
  	int sump = (X - x[i] + MM) % 2 + (Y - y[i] + MM) % 2;
  	if (sump % 2 != diff % 2 || dist > diff) {
  		doable = false;
  		break;
  	}

  	T = t[i];
  	X = x[i];
  	Y = y[i];
  }
  printf(doable ? "Yes\n" : "No\n");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:15: error: expected ';' before 'int'
   19 |         printf
      |               ^
      |               ;
   20 |         int sump = (X - x[i] + MM) % 2 + (Y - y[i] + MM) % 2;
      |         ~~~    
a.cc:21:13: error: 'sump' was not declared in this scope
   21 |         if (sump % 2 != diff % 2 || dist > diff) {
      |             ^~~~
Language: C++

#include <bits/stdc++.h>
#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;
using namespace atcoder;

static const ll INF = 1e15;

template<typename T>
static inline void chmin(T & ref, const T  value) {
	if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T & ref, const T value) {
	if (ref < value) ref = value;
}

ll op(ll left, ll right) {
    return max(left, right);
}

ll e() {
    return 0;
}

int main() {
    ll n,k;
    cin >> n >> k;
    vector<vector<ll>> bs(4 * k, vector<ll>(4 * k, 0));
    vector<vector<ll>> ws(4 * k, vector<ll>(4 * k, 0));
    rep(i, n) {
        ll x, y;
        char c;
        cin >> x >> y >> c;
        x %= 2 * k;
        y %= 2 * k;
        if (c == 'B') {
            bs[y][x]++;
            bs[y + 2 * k][x]++;
            bs[y][x + 2 * k]++;
            bs[y + 2 * k][x + 2 * k]++;
        }
        else {
            ws[y][x]++;
            ws[y + 2 * k][x]++;
            ws[y][x + 2 * k]++;
            ws[y + 2 * k][x + 2 * k]++;
        }
    }
    vector<vector<ll>> bsum(4 * k + 1, vector<ll>(4 * k + 1, 0));
    vector<vector<ll>> wsum(4 * k + 1, vector<ll>(4 * k + 1, 0));

    rep(y, 4 * k) {
        rep(x, 4 * k) {
            bsum[y + 1][x + 1] = bsum[y + 1][x] + bsum[y][x + 1] - bsum[y][x] + bs[y][x];
            wsum[y + 1][x + 1] = wsum[y + 1][x] + wsum[y][x + 1] - wsum[y][x] + ws[y][x];
        }
    }
    const ll k2 = k * 2;
    ll ans = 0;
    rep(y, k) {
        rep(x, k) {
            ll w1 = wsum[y + k2][x + k2] - wsum[y + k2][x + k] - wsum[y + k][x + k2] + wsum[y+k][x+k];
            ll w2 = wsum[y + k][x + k] - wsum[y + k][x] - wsum[y][x + k] + wsum[y][x];
            ll b1 = bsum[y + k2][x + k] - bsum[y + k][x + k] - bsum[y + k2][x] + bsum[y + k][x];
            ll b2 = bsum[y + k][x + k2] - bsum[y + k][x + k] - bsum[y][x + k2] + bsum[y][x + k];
            ll s = w1 + w2 + b1 + b2;
            chmax(ans, s);
        }
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc:17:17: error: 'atcoder' is not a namespace-name
   17 | using namespace atcoder;
      |                 ^~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <unistd.h>

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    int x[N], y[N];
    for(int i=0; i<N; i++){
        char c;
        cin >> x[i] >> y[i] >> c;
        if(c == 'W'){
            x[i] += K;
        }
    }
    int pos[3 * K][3 * K];
    for(int i=0; i<3 * K; i++){
        for(int j=0; j<3 * K; j++) pos[i][j] = 0;
    }
    for(int i=0; i<N; i++){
        pos[x[i] % (2*K)][y[i] % (2*K)]++;
        if(x[i] % (2 * K) < K) pos[x[i] % (2*K) + 2 * K][y[i] % (2*K)]++;
        if(y[i] % (2 * K) < K) pos[x[i] % (2*K)][y[i] % (2*K) + 2 * K]++;
        if(x[i] % (2 * K) < K && y[i] % (2 * K) < K) pos[x[i] % (2*K) + 2 * K][y[i] % (2*K) + 2 * K]++;
    }

    int dp[3 * K][3 * K];
    for(int i=0; i<3 * K; i++){
        for(int j=0; j<3 * K; j++){
            if(i == 0){
                if(j == 0) dp[i][j] = pos[i][j];
                else dp[i][j] = dp[i][j-1] + pos[i][j];
            }
            else{
                if(j == 0) dp[i][j] = dp[i-1][j] + pos[i][j];
                else dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1] + pos[i][j];
            }
        }
    }

    int ans = 0;
    int inv = INT_MAX;
    for(int i=K-1; i<2 * K-1; i++){
        for(int j=K-1; j<2 * K-1; j++){
            int temp = 2 * dp[i][j] + dp[i + K][j + K] - dp[i][j + K] - dp[i + K][j];
            if(j != K-1) temp -= dp[K-1][j - K];
            if(i != K-1) temp -= dp[i - K][K-1];
            if(i != K-1 && j != K-1) temp += dp[i-K][j-K];
            ans = max(ans, temp);
            inv = min(inv, N - temp);
        }
    }
    ans = max(ans, N - inv) ;
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:15: error: 'INT_MAX' was not declared in this scope
   44 |     int inv = INT_MAX;
      |               ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <unistd.h>
  +++ |+#include <climits>
    4 |
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(void){
    int n, k;
    scanf("%d %d", &n, &k);
    
    vector<vector<int> > white(4*k+1, vector<int>(4*k+1, 0));
    vector<vector<int> > black(4*k+1, vector<int>(4*k+1, 0));
    
    rep(i, n){
        int x, y;
        string s;
        scanf("%d %d %s", &x, &y, &s);
        if (s == "B"){
            black[int(x)%(2*k)+1][int(y)%(2*k)+1] += 1;
            black[int(x)%(2*k)+1+2*k][int(y)%(2*k)+1] += 1;
            black[int(x)%(2*k)+1][int(y)%(2*k)+1+2*k] += 1;
            black[int(x)%(2*k)+1+2*k][int(y)%(2*k)+1+2*k] += 1;
        }
        else{
            white[int(x)%(2*k)+1][int(y)%(2*k)+1] += 1;
            white[int(x)%(2*k)+1+2*k][int(y)%(2*k)+1] += 1;
            white[int(x)%(2*k)+1][int(y)%(2*k)+1+2*k] += 1;
            white[int(x)%(2*k)+1+2*k][int(y)%(2*k)+1+2*k] += 1;
        }
    }
    
    rep(i, 4*k)rep(j, 4*k){
        white[i+1][j+1] += white[i][j+1]+white[i+1][j]-white[i][j];
        black[i+1][j+1] += black[i][j+1]+black[i+1][j]-black[i][j];
    }
    
    int ans = 0;
    rep(i, 2*k)rep(j, 2*k){
        int p, q, x, y;
        p = i+k;
        q = j+k;
        x = p+k;
        y = q+k;
        
        int sub = white[p][q]+white[i][j]-white[p][j]-white[i][q]+white[x][y]+white[p][q]-white[x][q]-white[p][y]+black[x][q]+black[p][j]-black[p][q]-black[x][j]+black[p][y]+black[i][q]-black[i][y]-black[p][q];
        
        if (ans < sub) ans = sub;
    }
    
    printf("%d\n", ans);
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'i' was not declared in this scope
   11 |     rep(i, n){
      |         ^
a.cc:11:5: error: 'rep' was not declared in this scope
   11 |     rep(i, n){
      |     ^~~
Language: C++

#include <iostream>
#include <vector>

int main(){
  	int N, K;
  	std::cin >> N >> K;
  	int Npix = 4*K*K, Naxis = 2*K;
  	std::vector<int> x, y, map, master;
  	std::vector<char> c;
  	for(int i = 0; i < Npix; i++){
      	int a = i%(Naxis);
      	int b = i/(Naxis);
      	if((a < K && b < K) || (a >= K && b >= K)) master[i] = 1;
    }
  	for(int i = 0; i < N; i++){
      	std::cin >> x[i] >> y[i] >> c[i];
      	if(c[i] == 'w') y[i] += K;
      	x[i] %= Naxis;
      	y[i] %= Naxis;
      	for(int j = 0; j < Npix; j++) map[(Naxis*(y[i]+1)+x[i]+1+j)%(Npix)] += master[j];
    }
	std::vector<int>::iterator iter = std::max_element(map.begin(), map.end());		
	stda::cout << std::distance(map.begin(), iter) << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:48: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   22 |         std::vector<int>::iterator iter = std::max_element(map.begin(), map.end());
      |                                                ^~~~~~~~~~~
      |                                                tuple_element
a.cc:23:9: error: 'stda' has not been declared
   23 |         stda::cout << std::distance(map.begin(), iter) << std::endl;
      |         ^~~~
Language: C

#include<stdio.h>
int main(){
  int n,k,i,j,x,y,m[1001][1001]={},s,v,w;
  char a;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++){
    scanf("%d%d %c",&x,&y,&a);y+=(a=='W')*k;
    s=1-(x/k%2!=y/k%2)*2;
    m[0][0]+=s>0;
    v=x%k+1;w=y%k+1;
    m[v][0]-=s;
    m[0][w]-=s;
    m[v][w]+=s*2;
  }
  for(i=0;i<=k;i++)for(j=0;j<k;j++)m[i][j+1]+=m[i][j];
  for(i=0;i<=k;i++)for(j=0;j<k;j++)m[j+1][i]+=m[j][i];
  v=0;for(i=0;i<k;i++)for(j=0;j<k;j++)v=v<m[i][j]?m[i][j]:v;
  printf("%d",v)
}


Compiler output:
main.c: In function 'main':
main.c:18:17: error: expected ';' before '}' token
   18 |   printf("%d",v)
      |                 ^
      |                 ;
   19 | }
      | ~
Language: C++

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#include <random>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,K;
  cin >> N >> K;
  vector<vector<int>> G(K*2,vector<int> (K*2,0));
  for(int i=0; i<N; i++){
    int x,y;
    cin >> x >> y;
    char c;
    cin >> c;
    if(c == 'W') x += K;
    G[x%(2*K)][y%(2*K)]++;
  }
  vector<vector<int>> S(2*K+1,vector<int> (2*K+1,0));
  for(int i=0; i<2*K; i++){
    for(int j=0; j<2*K; j++){
      S[i+1][j+1] = S[i+1][j] + S[i][j+1] - S[i][j] + G[i][j];
    }
  }
  auto f = [&](int lx,int ly,int ux,int uy){
    chmin(lx,2*K);
    chmin(ly,2*K);
    chmin(ux,2*K);
    chmin(uy,2*K);
    chmax(lx,0);
    chmax(ly,0);
    chmax(ux,0);
    chmax(uy,0);
    int sum = S[ux][uy] - S[ux][ly] - S[lx][uy] + S[lx][ly];
    // if(sum < 0){
    //   cout << lx << " " << ly << " " << ux << " " << uy << "\n";
    //   cout << sum << "\n";
    // }
    return sum;
  };
  // for(int i=0; i<=2*K; i++){
  //   for(int j=0; j<=2*K; j++){
  //     cout << S[i][j] << " \n"[j==2*K];
  //   }
  // }
  int ans = 0;
  for(int i=0; i<2*K; i++){
    for(int j=0; j<2*K; j++){
      int sum = 0;
      sum += f(i,j,i+K,j+K);
      sum += f(i-K,j-K,i,j);
      sum += f(i+K,j-K,i+2*K,j);
      sum += f(i-K,j+K,i,j+2*K);
      sum += f(i+K,j+K,i+2*K,j+2*K);
      chmax(ans,sum);
      sum = 0;
      sum += 
    }
  }
  cout << ans << "\n";
  return 0;
}


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

#include <cstdio>
using namespace std;

int board[2010][2010];

int main() {
    int N, K; scanf("%d%d", &N, &K);

    int sum = 0, white = 0;
    for(int i=0; i<N; i++) {
        int x, y; char c; scanf(" %d%d %c", &x, &y, &c);
        x %= 2*K, y %= 2*K;
        if(c == 'B') board[x+1][y+1]++, sum++;
        if(c == 'W') board[x+1][y+1]--, sum--, white++;
    }

    for(int i=1; i<=2*K; i++) {
        for(int j=1; j<=2*K; j++) {
            board[i][j] += board[i][j-1];
        }
    }

    for(int j=1; j<=2*K; j++) {
        for(int i=1; i<=2*K; i++) {
            board[i][j] += board[i-1][j];
        }
    }

    int ma = -(1 << 25);
    for(int i=0; i<=K; i++) {
        for(int j=0; j<=K; j++) {
            int a = board[i][j];
            int b = board[i+K][j+K] - board[i+K][j] - board[i][j+K] + board[i][j];
            int c = board[2*K][j] - board[i+K][j];
            int d = board[i][2*K] - board[i][j+K];
            int e = board[2*K][2*K] - board[2*K][j+K] - board[i+K][2*K] + board[i+K][j+K];
            int tmp = a + b + c + d + e;
            ma = max(ma, max(tmp, sum - tmp));
        }
    }
    ma += white;
    printf("%d\n", ma);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:26: error: 'max' was not declared in this scope; did you mean 'ma'?
   38 |             ma = max(ma, max(tmp, sum - tmp));
      |                          ^~~
      |                          ma
a.cc:38:18: error: 'max' was not declared in this scope; did you mean 'ma'?
   38 |             ma = max(ma, max(tmp, sum - tmp));
      |                  ^~~
      |                  ma
Language: C++

import sys
readline = sys.stdin.readline

N, K = map(int, input().split())
a = [[0]*(4*K+1) for _ in range(4*K+1)]
k2 = K*2

for x, y, c in (readline().split() for _ in range(N)):
    x, y = int(x), int(y)
    if c == 'B':
        x += K

    y = y % (2*K) + 1
    x = x % (2*K) + 1
    a[y][x] += 1
    a[y+k2][x] += 1
    a[y][x+k2] += 1
    a[y+k2][x+k2] += 1


for y in range(4*K+1):
    for x in range(4*K):
        a[y][x+1] += a[y][x]
for x in range(4*K+1):
    for y in range(4*K):
        a[y+1][x] += a[y][x]

ans = 0

for sy, ty in zip(range(3*K+1), range(K, 3*K+1)):
    for sx, tx in zip(range(3*K+1), range(K, 3*K+1)):
        count = (
            + a[ty][tx] - a[ty][sx] - a[sy][tx] + a[sy][sx]
            + a[ty+K][tx+K] - a[ty+K][tx] - a[ty][tx+K] + a[ty][tx]
        )
        ans = max(ans, count)

print(ans)


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

n,k = map(int,input().split())
imos = [[0]*k for i in range(2*k)]
mod = 2*k
for i in range(n):
    x,y,c = input().split()
    x,y = map(int,[x,y])
    if c == 'W':
        x -= k
    x,y = x%mod,y%mod
    if y > k-1:
        x -= k
        y -= k
        x = x%mod
    if y == k-1:
        if x == 2*k - 1:
            imos[k][0] += 1
        elif x >= k-1:
            imos[x-k+1][0] += 1
            imos[x+1][0] -= 1
        else:
            imos[0][0] += 1
            imos[x+1][0] -= 1
            imos[x+1+k][0] += 1
    else:
        if x == 2*k - 1:
            imos[k][0] += 1
            imos[0][y+1] += 1
            imos[k][y+1] -= 2
        elif x >= k - 1:
            imos[x+1][0] -= 1
            imos[x+1-k][0] += 1
            imos[x+1][y+1] += 2
            imos[x+1-k][y+1] -= 2
            imos[0][y+1] += 1
        else:
            imos[x+1][0] -= 1
            imos[x+1][y+1] += 2
            imos[x+1+k][0] += 1
            imos[x+1+k][y+1] -= 2
            imos[0][0] += 1
            imos[0][y+1] -= 1
for i in range(1,2*k):
    for j in range(k):
        imos[i][j] += imos[i-1][j]
ans = 0
for i in range(2*k):
    for j in range(1,k):
        imos[i][j] += imos[i][j-1]
        ans = max(ans,imos[i][j])
print(ans)


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,k = map(int,input().split())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

int N, K;
vector<ll> x, y;
vector<char> c;
vector<vector<int>> imos;

void setrect(int i, int j){
    if(i<0 || j < 0 || x>=3*k-1 || y>=3*k-1 ) return;

    imos[ max(0, i+1-K) ][ max(0, j+1-K) ]++;
    imos[ max(0, i+1-K) ][ min(2*K, j+1) ]--;
    imos[ min(2*K, i+1) ][ max(0, j+1-K) ]--;
    imos[ min(2*K, i+1) ][ min(2*K, j+1) ]++;
}

void setimos(int a){
    int i = y[a], j = x[a];
    setrect(i, j);
    setrect(i+2*K, j);
    setrect(i+K, j-K);
    setrect(i-K, j-K);
    setrect(i+K, j+K);
    setrect(i-K, j+K);
    setrect(i+K, j+2*K);
    setrect(i, j+2*K);
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    cin >> N >> K;
    x.resize(N);
    y.resize(N);
    c.resize(N);
    imos.resize(4*K, vector<int>(4*K, 0));
    rep(i, N) cin >> x[i] >> y[i] >> c[i];

    rep(i, N) if(c[i] == 'W') y[i] += K;
    rep(i, N) { x[i] %= 2*K; y[i] %= 2*K; }

    rep(i, N) setimos(i);

    rep(i, 2*K) repr(j, 1, 2*K) imos[i][j] += imos[i][j-1];
    rep(j, 2*K) repr(i, 1, 2*K) imos[i][j] += imos[i-1][j];
    int ans = 0;
    rep(i, 2*K) rep(j, 2*K) chmax(ans, imos[i][j]);
    cout << ans << endl;

}

Compiler output:
a.cc: In function 'void setrect(int, int)':
a.cc:60:29: error: 'k' was not declared in this scope
   60 |     if(i<0 || j < 0 || x>=3*k-1 || y>=3*k-1 ) return;
      |                             ^