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

#include <stdio.h>
#include<stdlib.h>
int main(void){
    int H,W,A[101][101],b,c,d,j,i,sum=0,sss=0;
    scanf("%d %d",&H,&W);
    for(b=1;b<=H;b++){
        for(c=1;c<=W;c++){
            scanf("%d",&d);
            A[b][c]=d;
        };
    };
    for(b=1;b<=H;b++){
        for(c=1;c<=W;c++){
           for(j=1;j<=H;j++){
              for(i=1;i<=W;i++){
               if(abs(j-b)<=abs(i-c)){
                   sum+=A[j][i]*abs(j-b);
               }else{sum+=A[j][i]*abs(i-c);}; 
              };
           };if((sum<=sss)||((b==1)&&(c==1))){sss=sum;};
  　　　       sum=0;
        };};
    printf("%d\n",sss);
    return 0;
}



Compiler output:
main.c: In function 'main':
main.c:21:3: error: stray '\343' in program
   21 |   <U+3000><U+3000><U+3000>       sum=0;
      |   ^~~~~~~~
main.c:21:5: error: stray '\343' in program
   21 |   <U+3000><U+3000><U+3000>       sum=0;
      |           ^~~~~~~~
main.c:21:7: error: stray '\343' in program
   21 |   <U+3000><U+3000><U+3000>       sum=0;
      |                   ^~~~~~~~
Language: C++

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0641


#include<iostream>
#include<cstdlib> //絶対値の算出に使う関数abs()のため

 using namespace std; //標準名前空間を使用

 int main(){

 int ninnzuu[5][5] ; //人口一覧。[i行目]][j列目]という定義とします。
 int kyoriichiran[5][5] ; //距離一覧。[i行目]][j列目]という定義とします。
 int kyorino_souwa[5][5] ; //距離の総和の一覧。[i行目]][j列目]という定義とします。
 int ihonme , jhonme ; //交差点の座標
 int kyori_souwa_max = 0 ; //距離の総和の最大値

 //交差点座標の読み込み
 cin >> ihonme >> jhonme ; 


    //２次元配列ninnzuuへの人口の読み込み
    for (int i = 1; i <= 5 ; i = i + 1 ) { //Y方向の読み込み
        
        //X方向の読み込み
        for (int j = 1; j <= 5 ; j = j + 1 ){
        cin >> ninnzuu[i][j] ;
        }
    }


    //２次元配列kyoriichiranへの距離一覧の作成

    for (int i = 1; i <= 5 ; i = i + 1 ) { //Y方向の読み込み
        
        //X方向の読み込み
        for (int j = 1; j <= 5 ; j = j + 1 ){
        kyoriichiran[i][j] = abs(ihonme - i) + abs (jhonme - j) ;
        }
    }


    //２次元配列kyorino_souwaの距離の総和の作成

    for (int i = 1; i <= 5 ; i = i + 1 ) { //Y方向の読み込み
        
        //X方向の読み込み
        for (int j = 1; j <= 5 ; j = j + 1 ){
        kyoriichiran[i][j] = ninnzuu[i][j] * kyoriichiran[i][j]  ;
        }
    }            

    //２次元配列kyorino_souwaの距離の総和の最大値の検出

    for (int i = 1; i <= 5 ; i = i + 1 ) { //Y方向の読み込み
        
        //X方向の読み込み
        for (int j = 1; j <= 5 ; j = j + 1 ){

         if (kyori_souwa_max < kyoriichiran[i][j]){
            kyori_souwa_max = kyoriichiran[i][j]
            }else{
            // 何もしない
            }
        }
    }            






 return 0;

 }
 
//最大値などはライブラリ利用でも求められます


Compiler output:
a.cc: In function 'int main()':
a.cc:60:49: error: expected ';' before '}' token
   60 |             kyori_souwa_max = kyoriichiran[i][j]
      |                                                 ^
      |                                                 ;
   61 |             }else{
      |             ~
Language: Java

import java.util.Scanner;
import java.util.TreeSet;

public class JOI_0644 {
	public static void main(String[] args){
		int n, i, j, max, min, calcu;
		double sum = 0, subsum = 0, number = 0, nearestPrime, box, adjustment = 0, floor = 0, ceiling = 0 ;
		int[] a = new int[51];
		try (Scanner sc = new Scanner(System.in)) {
			n = sc.nextInt();
			TreeSet<Double> ts = new TreeSet<Double>();
			for(i = 0; i < n; i++) {
				sum += sc.nextInt();
				ts.add(sum);
			}
			loop : for(i = 2; i <= n; i++) {
				subsum = sum;
				nearestPrime = 0;
				max = 0;
				min = 50000;
				adjustment = 0;
				for(j = 1; j < i; j++) {
					number = sum * j / i;
					number += adjustment / (i - 1);
					System.out.println(adjustment);
					if(ts.ceiling(number) != null && ts.floor(number) != null) {
						ceiling = ts.ceiling(number);
						floor = ts.floor(number);
					}else {
						break loop;
					}
					box = nearestPrime;
					if(number - floor <= ceiling - number) {
						nearestPrime = floor;
						adjustment = floor - number;
					}else {
						nearestPrime = ceiling;
						adjustment = ceiling - number;
					}
					
					calcu = (int) (nearestPrime - box);
					if(max < calcu) {
						max = calcu;
					}
					if(min > calcu) {
						min = calcu;
					}
				}
				subsum = sum - nearestPrime;
				if(max < subsum) {
					max = (int) subsum;
				}
				if(min > subsum) {
					min = (int) subsum;
				}
				a[i] = max - min;
			}
			min = 50000;
			for(j = 2; j < i; j++) {
				if(min > a[j]) {
					min = a[j];
				}
			}
			System.out.println(min);
		}
	}
}


Compiler output:
Main.java:4: error: class JOI_0644 is public, should be declared in a file named JOI_0644.java
public class JOI_0644 {
       ^
1 error
Language: Java

import java.util.Scanner;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args){
		int n, i, j, max, min, calcu;
		double sum = 0, subsum = 0, number = 0, nearestPrime, box = 0, floor = 0, ceiling = 0;
		int[] a = new int[51];
		try (Scanner sc = new Scanner(System.in)) {
			n = sc.nextInt();
			TreeSet<Double> ts = new TreeSet<Double>();
			for(i = 0; i < n; i++) {
				sum += sc.nextInt();
				ts.add(sum);
			}
			loop : for(i = 2; i <= n; i++) {
				subsum = sum;
				nearestPrime = 0;
				max = 0;
				min = 50000;
				for(j = 1; j < i; j++) {
					number = sum * j / i;
					if(ts.ceiling(number) != null && ts.floor(number) != null) {
						ceiling = ts.ceiling(number);
						floor = ts.floor(number);
					}else {
						break loop;
					}
					box = nearestPrime;
					if(number - floor <= ceiling - number) {
						nearestPrime = floor;
					}else {
						nearestPrime = ceiling;
					}
					
					calcu = (int) (nearestPrime - box);
					if(max < calcu) {
						max = calcu;
					}
					if(min > calcu) {
						min = calcu;
					}
				}
				subsum = sum - nearestPrime;
				if(max < subsum) {
					max = (int) subsum;
				}
				if(min > subsum) {
					min = (int) subsum;
				}
				a[i] = max - min;
			}
			min = 50000;
			for(j = 2; j < i; j++) {
				if(min > a[j]) {
					min = a[j];
				}
			}
			System.out.println(min);
		}
	}


Compiler output:
Main.java:61: error: reached end of file while parsing
	}
	 ^
1 error
Language: Java

import java.util.Scanner;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args){
		int n, i, j, max, min, calcu;
		double sum = 0, subsum = 0, number = 0, nearestPrime, box = 0, floor = 0, ceiling = 0, adjust;
		int[] a = new int[51];
		try (Scanner sc = new Scanner(System.in)) {
			n = sc.nextInt();
			TreeSet<Double> ts = new TreeSet<Double>();
			for(i = 0; i < n; i++) {
				sum += sc.nextInt();
				ts.add(sum);
			}
			loop : for(i = 2; i <= n; i++) {
				subsum = sum;
				nearestPrime = 0;
				max = 0;
				min = 50000;
				adjust = 0;
				for(j = 1; j < i; j++) {
					number = sum * j / i;
					number += adjust / (j / i);
					if(ts.ceiling(number) != null && ts.floor(number) != null) {
						ceiling = ts.ceiling(number);
						floor = ts.floor(number);
					}else {
						break loop;
					}
					box = nearestPrime;
					if(number - floor <= ceiling - number) {
						nearestPrime = floor;
						adjust = floor - number;
					}else {
						nearestPrime = ceiling;
						adjust = ceiling - number;
					}
					
					calcu = (int) (nearestPrime - box);
					if(max < calcu) {
						max = calcu;
					}
					if(min > calcu) {
						min = calcu;
					}
				}
				subsum = sum - nearestPrime;
				if(max < subsum) {
					max = (int) subsum;
				}
				if(min > subsum) {
					min = (int) subsum;
				}
				a[i] = max - min;
			}
			min = 50000;
			for(j = 2; j < i; j++) {
				if(min > a[j]) {
					min = a[j];
				}
			}
			System.out.println(min);


Compiler output:
Main.java:63: error: reached end of file while parsing
			System.out.println(min);
			                        ^
1 error
Language: Java

import java.util.Scanner;
public class Main2018E {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();

		int W = sc.nextInt();

		int[][] tree = new int[H][W];

		long[][] dp = new long[H][W];

		int[][] rec = new int[H][W];

		//格納
		for(int i=0;i<H;i++) {

			for(int j=0;j<W;j++) {

				tree[i][j] = sc.nextInt();

				dp[i][j] = Long.MAX_VALUE;

				rec[i][j] = -1;

			}
		}

		dp[0][0] = 0;

		dp[0][1] = tree[0][1];

		dp[1][0] = tree[1][0];

		rec[0][0] = 0;

		rec[0][1] = 0;

		rec[1][0] = 0;

		int count = 6;

		while(count>0) {

			//int a = dp[H-1][W-1];

			for(int i=0;i<H;i++) {

				for(int j=0;j<W;j++) {

					if(!(i==0&&j==0) && !(i==0&&j==1) && !(i==1&&j==0)) {

						solve(dp,tree,rec,H,W,i,j);
					}
				}
			}

			count--;

		}
		System.out.println(dp[H-1][W-1]);

	}

	static void solve(long[][] dp,int[][] tree, int[][] rec,int H, int W, int x, int y) {

		int[] dx = {1,0,-1,0};

		int[] dy = {0,1,0,-1};

		boolean flag = false;

		int xx = 0;

		int yy = 0;

		long z = dp[x][y];

		//移動4方向をループ
		for(int i=0;i<4;i++) {

			int nx = x + dx[i];

			int ny = y + dy[i];

			//移動可能かどうか
			if(nx>=0 && nx<H && ny>=0 && ny<W) {

				//最小をさがす
				if(dp[nx][ny]<z && dp[nx][ny]!=Long.MAX_VALUE) {

					z = dp[nx][ny];

					flag = true;

					xx = nx;

					yy = ny;
				}
			}
			if(flag) rec[x][y] = rec[xx][yy] + 1;

			flag = false;

			if(dp[x][y]>z + ((rec[x][y])*2+1)*tree[x][y]) {

				dp[x][y] = z + ((rec[x][y])*2+1)*tree[x][y];

			}
		}
	}
}



Compiler output:
Main.java:2: error: class Main2018E is public, should be declared in a file named Main2018E.java
public class Main2018E {
       ^
1 error
Language: Java

import java.util.Scanner;
public class Main2018E {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();

		int W = sc.nextInt();

		int[][] tree = new int[H][W];

		long[][] dp = new long[H][W];

		int[][] rec = new int[H][W];

		//格納
		for(int i=0;i<H;i++) {

			for(int j=0;j<W;j++) {

				tree[i][j] = sc.nextInt();

				dp[i][j] = Long.MAX_VALUE;

				rec[i][j] = -1;

			}
		}

		dp[0][0] = 0;

		dp[0][1] = tree[0][1];

		dp[1][0] = tree[1][0];

		rec[0][0] = 0;

		rec[0][1] = 0;

		rec[1][0] = 0;

		int count = 8;

		while(count>0) {

			for(int i=0;i<H;i++) {

				for(int j=0;j<W;j++) {

					if(!(i==0&&j==0) && !(i==0&&j==1) && !(i==1&&j==0)) {

						solve(dp,tree,rec,H,W,i,j);
					}
				}
			}

			count--;

		}
		System.out.println(dp[H-1][W-1]);

	}

	static void solve(long[][] dp,int[][] tree, int[][] rec,int H, int W, int x, int y) {

		int[] dx = {1,0,-1,0};

		int[] dy = {0,1,0,-1};

		boolean flag = false;

		int xx = 0;

		int yy = 0;

		long z = dp[x][y];

		//移動4方向をループ
		for(int i=0;i<4;i++) {

			int nx = x + dx[i];

			int ny = y + dy[i];

			//移動可能かどうか
			if(nx>=0 && nx<H && ny>=0 && ny<W) {

				//最小をさがす
				if((dp[nx][ny]+((rec[nx][ny]+1)*2+1)*tree[x][y])<z && dp[nx][ny]!=Long.MAX_VALUE) {

					z = dp[nx][ny];

					flag = true;

					xx = nx;

					yy = ny;

					rec[x][y] = rec[nx][ny]+1;

					dp[x][y] = z + ((rec[x][y])*2+1)*tree[x][y];
				}
			}

			//if(flag) rec[x][y] = rec[xx][yy] + 1;

			flag = false;

			/*if(dp[x][y]>z + ((rec[x][y])*2+1)*tree[x][y]) {

				dp[x][y] = z + ((rec[x][y])*2+1)*tree[x][y];

			}*/
		}
	}
}



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

#include<cstdio>
#include<queue>
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> Q;
typedef pair<int, Q> R;
const int INF = 1000000000;

int h, w, a[30][30];
int d[901][30][30];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  scanf("%d%d", &h, &w);
  for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) scanf("%d", &a[i][j]);
  for (int k = 0; k <= 900; k++) for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) d[k][i][j] = INF;
  priority_queue<R, vector<R>, greater<R> > que;
  d[0][0][0] = 0;
  que.push(R(0, Q(0, P(0, 0))));
  while (!que.empty()) {
    R q = que.top(); que.pop();
    int cost = q.first, len = q.second.first, x = q.second.second.first, y = q.second.second.second;
    if (cost > d[len][y][x]) continue;
    if (y == h - 1 && x == w - 1) break;
    for (int i = 0; i < 4; i++) {
      int nx = x + dx[i], ny = y + dy[i];
      if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue;
      int newcost = cost + (len * 2 + 1) * a[ny][nx] + 1;
      if (len + 1 >= n + 1) continue;
      if (newcost >= d[len + 1][ny][nx]) continue;
      d[len + 1][ny][nx] = newcost;
      que.push(R(newcost, Q(len + 1, P(nx, ny))));
    }
  }
  int ans = INF;
  for (int i = 0; i <= 900; i++) ans = min(ans, d[i][h - 1][w - 1] - i);
  printf("%d\n", ans);
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:22: error: 'n' was not declared in this scope; did you mean 'ny'?
   30 |       if (len + 1 >= n + 1) continue;
      |                      ^
      |                      ny
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;


public class AOJ0647 {

	public static void main(String[] args) {
		try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String str;
            while ((str = br.readLine()) != null) {
            	String[] num = str.split(" "); 
            	int guest = Integer.parseInt(num[0]);
            	int match = Integer.parseInt(num[1]);
            	int[] startTime = new int[guest];
            	int[] endTime = new int[guest];
            	int[] gapTime = new int [guest - 1];
            	
            	for (int i = 0; i < guest; i++) {
            		startTime[i] = Integer.parseInt(br.readLine());
            		endTime[i] = startTime[i] + 1;
            		if (i == 0) continue;
            		gapTime[i-1] = startTime[i] - endTime[i-1];
            	}
            	
            	Arrays.sort(gapTime);
            	
            	int tmp = guest - match;
            	int totalTime = guest;
            	for (int i = 0; i < tmp; i++) {
            		totalTime += gapTime[i];
            	}
            	System.out.println(totalTime);

            }
            } catch (Exception e) {
                System.out.println(e);
            }
	}

}



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

include<studio.h>
int main<voido>
{
}
retuln 0;


Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<studio.h>
      |        ^
main.c:5:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before numeric constant
    5 | retuln 0;
      |        ^
Language: C

k.klnfjkkfolweljkmcvlmkj]

loopgfp

o@frglopbhkgtgfgfdfyer


Compiler output:
main.c:1:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | k.klnfjkkfolweljkmcvlmkj]
      |  ^
main.c:5:2: error: stray '@' in program
    5 | o@frglopbhkgtgfgfdfyer
      |  ^
Language: C

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
vector<ll> v;

int main(void)
{
	vector<ll> v;
	int n, k;
	ll t[100000];
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> t[i];
		if (i != 0) {
			v.push_back(t[i] - t[i - 1] - 1);
		}
	}
	sort(v.begin(), v.end());
	ll ans = n;
	for (int i = 0; i < n - k; i++) {
		ans += v[i];
	}
	cout << ans << endl;
	return 0;
}



Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
int main(void)
{
	int a[100],b[100],c=0,d=0,i=0,j,l=0,o=0,p=0;
	int n,k;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++){
		if(k>=n){
			printf("%d\n",n);
			break;
		}
		if(k<n){
			for(j=0;j<n;j++){
				for()
			}
		}
	}
	if(k<n){
		printf("%d\n",l);
	}
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:17:37: error: expected expression before ')' token
   17 |                                 for()
      |                                     ^
main.c:17:37: error: expected expression before ')' token
main.c:18:25: error: expected expression before '}' token
   18 |                         }
      |                         ^
Language: C

#include<stdio.h>
int main(void)
{
	long n,k,m,a,b,i,j,c;
	long t[100000]={0},a[100000]={0};
	scanf("%ld %ld",&n,&k);
	c=n;
	for(i=0;i<n;i++)
	{
		scanf("%ld",&t[i]);
	}
		for(i=0;i<n;i++)
		{
			a[i]=t[i]-t[i-1]-1;
		}
		for(i=0;i<n;i++)
		{
			for(j=i+1;j<n;j++)
			{
				if(a[i]>a[j])
				{
					m=a[i];
					a[i]=a[j];
					a[j]=m;
				}
			}
		}
		
		for(i=0;i<=n-k;i++)
		{
		c=c+a[i];
		}
		printf("%ld\n",c);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:28: error: conflicting types for 'a'; have 'long int[100000]'
    5 |         long t[100000]={0},a[100000]={0};
      |                            ^
main.c:4:20: note: previous declaration of 'a' with type 'long int'
    4 |         long n,k,m,a,b,i,j,c;
      |                    ^
Language: C

#include<stdio.h>
int main(void)
{
	long n,k,m,a,b,i,j,c;
	long t[100000],a[100000];
	scanf("%ld %ld",&n,&k);
	c=n;
	for(i=0;i<n;i++)
	{
		scanf("%ld",&t[i]);
	}
		for(i=0;i<n;i++)
		{
			a[i]=t[i]-t[i-1]-1;
		}
		for(i=0;i<n;i++)
		{
			for(j=i+1;j<n;j++)
			{
				if(a[i]>a[j])
				{
					m=a[i];
					a[i]=a[j];
					a[j]=m;
				}
			}
		}
		
		for(i=0;i<=n-k;i++)
		{
		c=c+a[i];
		}
		printf("%ld\n",c);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:24: error: conflicting types for 'a'; have 'long int[100000]'
    5 |         long t[100000],a[100000];
      |                        ^
main.c:4:20: note: previous declaration of 'a' with type 'long int'
    4 |         long n,k,m,a,b,i,j,c;
      |                    ^
Language: C

#include<stdio.h>
int main(void)
{
	long n,k,m,a,b,i,j,c;
	long t[1000000],a[1000000];
	scanf("%ld %ld",&n,&k);
	c=n;
	for(i=0;i<n;i++)
	{
		scanf("%ld",&t[i]);
	}
		for(i=0;i<n;i++)
		{
			a[i]=t[i]-t[i-1]-1;
		}
		for(i=0;i<n;i++)
		{
			for(j=i+1;j<n;j++)
			{
				if(a[i]>a[j])
				{
					m=a[i];
					a[i]=a[j];
					a[j]=m;
				}
			}
		}
		
		for(i=0;i<=n-k;i++)
		{
		c=c+a[i];
		}
		printf("%ld\n",c);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:25: error: conflicting types for 'a'; have 'long int[1000000]'
    5 |         long t[1000000],a[1000000];
      |                         ^
main.c:4:20: note: previous declaration of 'a' with type 'long int'
    4 |         long n,k,m,a,b,i,j,c;
      |                    ^
Language: C

#include<stdio.h>
int main(void)
{
	int n,k,m,a,b,i,j,c;
	long long t[1000000],a[1000000];
	scanf("%ld %ld",&n,&k);
	c=n;
	for(i=0;i<n;i++)
	{
		scanf("%ld",&t[i]);
	}
		for(i=0;i<n;i++)
		{
			a[i]=t[i]-t[i-1]-1;
		}
		for(i=0;i<n;i++)
		{
			for(j=i+1;j<n;j++)
			{
				if(a[i]>a[j])
				{
					m=a[i];
					a[i]=a[j];
					a[j]=m;
				}
			}
		}
		
		for(i=0;i<=n-k;i++)
		{
		c=c+a[i];
		}
		printf("%d\n",c);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:30: error: conflicting types for 'a'; have 'long long int[1000000]'
    5 |         long long t[1000000],a[1000000];
      |                              ^
main.c:4:19: note: previous declaration of 'a' with type 'int'
    4 |         int n,k,m,a,b,i,j,c;
      |                   ^
Language: C

#include<stdio.h>
#include<stdlib.h>


inline int cmp( const void *a ,const void *b )
{
	return *( int* )a - *( int* )b ;
}

#define N_MAX 100000
int times[ N_MAX + 1 ] ;


int main( void )
{
	int N ,K ;
	scanf( "%d %d" ,&N ,&K ) ;
	int i ;
	for( i = 0 ; i < N ; ++i )
	{
		scanf( "%d" ,times + i ) ;

		if( i > 0 )
		{
			times[ i - 1 ] = times[ i ] - times[ i - 1 ] - 1 ;
		}
	}
	
	qsort( times ,N - 1 ,sizeof( int ) ,cmp ) ;
	
	int sum = N ;	N -= K ;
	for( i = 0 ; i < N ; ++i )
	{
		sum += times[ i ] ;
	}

	printf( "%d\n" ,sum ) ;

	return 0 ;
}


Compiler output:
/usr/bin/ld: /tmp/ccts3Pq5.o: in function `main':
main.c:(.text+0xd2): undefined reference to `cmp'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll lonf lonf
#define PB push_back
using namespace std;
int main(){
    ll N,K;
    ll T[100000];
    cin>>N>>K;
    FOR(i,0,N){
        cin>>T[i];
    }
    ll S=T[N-1]-T[0];
    vector<ll> V;
    FOR(i,1,N){
        V.PB(T[i]-T[i-1]);
    }
    sort(V.rbegin(),V.rend());
    FOR(i,0,K-1){
        S-=V[i];
    }
    cout<<S+K<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:12: error: 'lonf' was not declared in this scope; did you mean 'long'?
    3 | #define ll lonf lonf
      |            ^~~~
a.cc:7:5: note: in expansion of macro 'll'
    7 |     ll N,K;
      |     ^~
a.cc:3:17: error: expected ';' before 'lonf'
    3 | #define ll lonf lonf
      |                 ^~~~
a.cc:8:5: note: in expansion of macro 'll'
    8 |     ll T[100000];
      |     ^~
a.cc:9:10: error: 'N' was not declared in this scope
    9 |     cin>>N>>K;
      |          ^
a.cc:9:13: error: 'K' was not declared in this scope
    9 |     cin>>N>>K;
      |             ^
a.cc:11:14: error: 'T' was not declared in this scope
   11 |         cin>>T[i];
      |              ^
a.cc:3:17: error: expected ';' before 'lonf'
    3 | #define ll lonf lonf
      |                 ^~~~
a.cc:13:5: note: in expansion of macro 'll'
   13 |     ll S=T[N-1]-T[0];
      |     ^~
a.cc:14:14: error: template argument 2 is invalid
   14 |     vector<ll> V;
      |              ^
a.cc:4:12: error: request for member 'push_back' in 'V', which is of non-class type 'int'
    4 | #define PB push_back
      |            ^~~~~~~~~
a.cc:16:11: note: in expansion of macro 'PB'
   16 |         V.PB(T[i]-T[i-1]);
      |           ^~
a.cc:16:14: error: 'T' was not declared in this scope
   16 |         V.PB(T[i]-T[i-1]);
      |              ^
a.cc:18:12: error: request for member 'rbegin' in 'V', which is of non-class type 'int'
   18 |     sort(V.rbegin(),V.rend());
      |            ^~~~~~
a.cc:18:23: error: request for member 'rend' in 'V', which is of non-class type 'int'
   18 |     sort(V.rbegin(),V.rend());
      |                       ^~~~
a.cc:20:9: error: 'S' was not declared in this scope
   20 |         S-=V[i];
      |         ^
a.cc:20:13: error: invalid types 'int[int]' for array subscript
   20 |         S-=V[i];
      |             ^
a.cc:22:11: error: 'S' was not declared in this scope
   22 |     cout<<S+K<<endl;
      |           ^
Language: C++

#include<stdio.h>
int main(void)
{
	long n,k,m,a,b,i,j,c;
	long t[1000000],a[1000000];
	scanf("%ld %ld",&n,&k);
	c=n;
	for(i=0;i<n;i++)
	{
		scanf("%ld",&t[i]);
	}
		for(i=0;i<n;i++)
		{
			a[i]=t[i]-t[i-1]-1;
		}
		for(i=0;i<n;i++)
		{
			for(j=i+1;j<n;j++)
			{
				if(a[i]>a[j])
				{
					m=a[i];
					a[i]=a[j];
					a[j]=m;
				}
			}
		}
		
		for(i=0;i<=n-k;i++)
		{
		c=c+a[i];
		}
		printf("%ld\n",c);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:25: error: conflicting declaration 'long int a [1000000]'
    5 |         long t[1000000],a[1000000];
      |                         ^
a.cc:4:20: note: previous declaration as 'long int a'
    4 |         long n,k,m,a,b,i,j,c;
      |                    ^
a.cc:14:26: error: invalid types 'long int[long int]' for array subscript
   14 |                         a[i]=t[i]-t[i-1]-1;
      |                          ^
a.cc:20:37: error: invalid types 'long int[long int]' for array subscript
   20 |                                 if(a[i]>a[j])
      |                                     ^
a.cc:20:42: error: invalid types 'long int[long int]' for array subscript
   20 |                                 if(a[i]>a[j])
      |                                          ^
a.cc:22:44: error: invalid types 'long int[long int]' for array subscript
   22 |                                         m=a[i];
      |                                            ^
a.cc:23:42: error: invalid types 'long int[long int]' for array subscript
   23 |                                         a[i]=a[j];
      |                                          ^
a.cc:23:47: error: invalid types 'long int[long int]' for array subscript
   23 |                                         a[i]=a[j];
      |                                               ^
a.cc:24:42: error: invalid types 'long int[long int]' for array subscript
   24 |                                         a[j]=m;
      |                                          ^
a.cc:31:22: error: invalid types 'long int[long int]' for array subscript
   31 |                 c=c+a[i];
      |                      ^
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
	int temp,n,k,t[100000],m,s[100000];
	cin>>n>>k;
	m=n;
	for(int i=0;i<n;i++)
	{
		cin>>t[i];
	}
	for(int i=0;i<n-1;i++)
	{
		s[i]=t[i+1]-t[i]-1;
	}

	sotr( s ,s + n - 1 ) ;

	for(int i=0;i<n-k;i++)
	{
		m+=s[i];
	}
	cout<<m<<endl;	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'sotr' was not declared in this scope
   20 |         sotr( s ,s + n - 1 ) ;
      |         ^~~~
Language: C++

n,k = map(int,input().split())

numbers = []
times = []

for i in range(n):
  numbers.append(i)
  times.append(int(input()))

candidates = [ [0] + x for x in gen_kcombination(numbers[1:],k-1)]

bestTime = times[-1] + 1
for i in range(len(candidates)):
  candidate = candidates[i]
  time = 0
  for j in range(k-1):
    igniteTime = times[candidates[j]]
    extinguishTime = times[candidates[j+1]-1] + 1
    time += extinguishTime - igniteTime
  time += times[-1] + 1 - times[candidates[-1]]
  if bestTime >= time:
    bestTime = time
return time

def gen_kcombination(lis,k):                   
     if k >= len(lis):                          
         return [lis]                           
     kcombs = []                                
     if k == 1:                                 
         return [[x] for x in lis]              
     for i in range(len(lis) - k+1):              
         kcombs += [[lis[i]] + x for x in gen_kcombination(lis[i+1:],k-1)]                       
     return kcombs                              


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

n,k = map(int,input().split())

numbers = []
times = []

for i in range(n):
  numbers.append(i)
  times.append(int(input()))

candidates = [ [0] + x for x in gen_kcombination(numbers[1:],k-1)]

bestTime = times[-1] + 1
for i in range(len(candidates)):
  candidate = candidates[i]
  time = 0
  for j in range(k-1):
    igniteTime = times[candidates[j]]
    extinguishTime = times[candidates[j+1]-1] + 1
    time += extinguishTime - igniteTime
  time += times[-1] + 1 - times[candidates[-1]]
  if bestTime >= time:
    bestTime = time
print(time)

def gen_kcombination(lis,k):                   
     if k >= len(lis):                          
         return [lis]                           
     kcombs = []                                
     if k == 1:                                 
         return [[x] for x in lis]              
     for i in range(len(lis) - k+1):              
         kcombs += [[lis[i]] + x for x in gen_kcombination(lis[i+1:],k-1)]                       
     return kcombs                              


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

def gen_kcombination(lis,k):                   
     if k >= len(lis):                          
         return [lis]                           
     kcombs = []                                
     if k == 1:                                 
         return [[x] for x in lis]              
     for i in range(len(lis) - k+1):              
         kcombs += [[lis[i]] + x for x in gen_kcombination(lis[i+1:],k-1)]                       
     return kcombs 

n,k = map(int,input().split())

numbers = []
times = []

for i in range(n):
  numbers.append(i)
  times.append(int(input()))

candidates = [ [0] + x for x in gen_kcombination(numbers[1:],k-1)]

bestTime = times[-1] + 1
for i in range(len(candidates)):
  candidate = candidates[i]
  time = 0
  for j in range(k-1):
    igniteTime = times[candidates[j]]
    extinguishTime = times[candidates[j+1]-1] + 1
    time += extinguishTime - igniteTime
  time += times[-1] + 1 - times[candidates[-1]]
  if bestTime >= time:
    bestTime = time
print(time)

                             


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def gen_kcombination(lis,k):
      | ^~~
Language: C

#include<stdio.h>
#include<stdlib.h>

using namespace std ;

typedef long long llong ;


typedef struct
{
	llong size ;
	llong value ;

} Data ;

#define N_MAX 500000
Data art[ N_MAX ] ;

int cmp( const void *a ,const void *b )
{
	if( (( Data* )a )->size == (( Data* )b )->size )
	{
		return (( Data* )a )->value - (( Data* )b )->value ;
	}
	
	return (( Data* )a )->size - (( Data* )b )->size ;
}

inline llong max( llong a ,llong b )
{
	return a > b ? a : b ;
}


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

	int i ;
	for( i = 0 ; i < N ; ++i )
	{
		scanf( "%lld %lld" ,&art[ i ].size ,&art[ i ].value ) ;
	}

	qsort( art ,N ,sizeof( Data ) ,cmp ) ;
	qsort( art ,N ,sizeof( Data ) ,cmp ) ;
	
	llong min_size	= art[ 0 ].size		;
	llong sum_value	= art[ 0 ].value	;

	llong ans = art[ 0 ].value ;
	for( i = 1 ; i < N ; ++i )
	{
		llong value	= art[ i ].value	;
		llong size	= art[ i ].size		;

		llong tmp =  sum_value + value  - ( size -  min_size ) ;
		if( tmp < value )
		{
			ans = max( ans ,value ) ;

			sum_value	= value	;
			min_size	= size	;
		}

		else
		{
			ans = max( ans ,tmp ) ;

			sum_value += value ;
		}
	}

	printf( "%lld\n" ,ans ) ;

	return 0 ;
}


Compiler output:
main.c:4:1: error: unknown type name 'using'
    4 | using namespace std ;
      | ^~~~~
main.c:4:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    4 | using namespace std ;
      |                 ^~~
Language: C

#include<stdio.h>
#include<stdlib.h>

typedef long long llong ;

typedef struct
{
	llong size ;
	llong value ;

} Data ;

#define N_MAX 500000
Data art[ N_MAX ] ;

inline int cmp( const Data *a ,const Data *b )
{
	int ret = a->size == b->size ? a->value - b->value : -( a->size < b->size ) ;

	if( ret == 0 )
	{
		return 1 ;
	}

	return ret ;
}

inline llong max( llong a ,llong b )
{
	return a > b ? a : b ;
}


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

	int i ;
	for( i = 0 ; i < N ; ++i )
	{
		scanf( "%lld %lld" ,&art[ i ].size ,&art[ i ].value ) ;
	}

	qsort( art ,N ,sizeof( Data ) ,cmp ) ;

	llong min_size	= art[ 0 ].size		;
	llong sum_value	= art[ 0 ].value	;

	llong ans = art[ 0 ].value ;
	for( i = 1 ; i < N ; ++i )
	{
		llong value	= art[ i ].value	;
		llong size	= art[ i ].size		;

		llong tmp =  sum_value + value  - ( size -  min_size ) ;
		if( tmp < value )
		{
			ans = max( ans ,value ) ;

			sum_value	= value	;
			min_size	= size	;
		}

		else
		{
			ans = max( ans ,tmp ) ;

			sum_value += value ;
		}
	}

	printf( "%lld\n" ,ans ) ;

	return 0 ;
}


Compiler output:
main.c: In function 'main':
main.c:45:40: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
   45 |         qsort( art ,N ,sizeof( Data ) ,cmp ) ;
      |                                        ^~~
      |                                        |
      |                                        int (*)(const Data *, const Data *)
In file included from main.c:2:
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(const Data *, const Data *)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>


typedef long long llong ;

typedef struct
{
	llong size ;
	llong value ;

} Data ;

#define N_MAX 500000
Data art[ N_MAX ] ;

inline int cmp( const Data *a ,const Data *b )
{
	int ret = a->size == b->size ? a->value - b->value : -( a->size < b->size ) ;

	return ret ? ret : 1 ;
}

inline llong max( llong a ,llong b )
{
	return a > b ? a : b ;
}


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

	int i ;
	for( i = 0 ; i < N ; ++i )
	{
		scanf( "%lld %lld" ,&art[ i ].size ,&art[ i ].value ) ;
	}

	qsort( art ,N ,sizeof( Data ) ,cmp ) ;

	llong min_size	= art[ 0 ].size		;
	llong sum_value	= art[ 0 ].value	;

	llong ans = art[ 0 ].value ;
	for( i = 1 ; i < N ; ++i )
	{
		llong value	= art[ i ].value	;
		llong size	= art[ i ].size		;

		llong tmp =  sum_value + value  - ( size -  min_size ) ;
		if( tmp < value )
		{
			ans = max( ans ,value ) ;

			sum_value	= value	;
			min_size	= size	;
		}

		else
		{
			ans = max( ans ,tmp ) ;

			sum_value += value ;
		}
	}

	printf( "%lld\n" ,ans ) ;

	return 0 ;
}


Compiler output:
main.c: In function 'main':
main.c:41:40: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
   41 |         qsort( art ,N ,sizeof( Data ) ,cmp ) ;
      |                                        ^~~
      |                                        |
      |                                        int (*)(const Data *, const Data *)
In file included from main.c:2:
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(const Data *, const Data *)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <function>
#include <iterator>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define POF pop_front
#define POB pop_back
#define MA make_pair
#define ll long long
#define VE vector<int>
#define VP vector<pair<int,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
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
//2部マッチング
int V;//頂点数
VE G[9000000];//グラフ隣接リスト表現
int match[9000000];//マッチングのペア
bool used[9000000];//フラグ
//
void add_edge(int from,int to){
  G[from].PB(to);
  G[to].PB(from);
}
//増加パスを探す
bool DFS(int v){
  used[v]=true;
  FOR(i,0,(int)G[v].size()){
    int u=G[v][i],w=match[u];
    if(w<0||!used[w]&&DFS(w)){
      match[v]=u;
      match[u]=v;
      return true;
    }
  }
  return false;
}
//最大マッチング
int bipartite_matching(){
  int res=0;
  memset(match,-1,sizeof(match));
  FOR(v,0,V){
    if(match[v]<0){
      memset(used,0,sizeof(used));
      if(DFS(v)){
        res++;
      }
    }
  }
  return res;
}
//
int main(){
  int N,M;
  cin>>N>>M;
  V=(N+1)*(M+1);
  char DANGO[3000][3000];
  FOR(i,0,N){
    FOR(j,0,M){
      cin>>DANGO[i][j];
    }
  }
  FOR(i,0,N){
    FOR(j,0,M-2){
      if(DANGO[i][j]=='R'&&DANGO[i][j+1]=='G'&&DANGO[i][j+2]=='W'){
        add_edge(i*M+j,i*M+j+2);
      }
    }
  }
  FOR(i,0,M){
    FOR(j,0,N-2){
      if(DANGO[j][i]=='R'&&DANGO[j+1][i]=='G'&&DANGO[j+2][i]=='W'){
        add_edge(j*M+i,(j+2)*M+i);
      }
    }
  }
  cout<<bipartite_matching()<<endl;
  return 0;
}


Compiler output:
a.cc:10:10: fatal error: function: No such file or directory
   10 | #include <function>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <iterator>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define POF pop_front
#define POB pop_back
#define MA make_pair
#define ll long long
#define VE vector<int>
#define VP vector<pair<int,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
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
//2部マッチング
int V;//頂点数
VE G[9000000];//グラフ隣接リスト表現
int match[9000000];//マッチングのペア
bool used[9000000];//フラグ
//
void add_edge(int from,int to){
  G[from].PB(to);
  G[to].PB(from);
}
//増加パスを探す
bool DFS(int v){
  used[v]=true;
  FOR(i,0,(int)G[v].size()){
    int u=G[v][i],w=match[u];
    if(w<0||!used[w]&&DFS(w)){
      match[v]=u;
      match[u]=v;
      return true;
    }
  }
  return false;
}
//最大マッチング
int bipartite_matching(){
  int res=0;
  memset(match,-1,sizeof(match));
  FOR(v,0,V){
    if(match[v]<0){
      memset(used,0,sizeof(used));
      if(DFS(v)){
        res++;
      }
    }
  }
  return res;
}
//
int main(){
  int N,M;
  cin>>N>>M;
  V=(N+1)*(M+1);
  char DANGO[3000][3000];
  FOR(i,0,N){
    FOR(j,0,M){
      cin>>DANGO[i][j];
    }
  }
  FOR(i,0,N){
    FOR(j,0,M-2){
      if(DANGO[i][j]=='R'&&DANGO[i][j+1]=='G'&&DANGO[i][j+2]=='W'){
        add_edge(i*M+j,i*M+j+2);
      }
    }
  }
  FOR(i,0,M){
    FOR(j,0,N-2){
      if(DANGO[j][i]=='R'&&DANGO[j+1][i]=='G'&&DANGO[j+2][i]=='W'){
        add_edge(j*M+i,(j+2)*M+i);
      }
    }
  }
  cout<<bipartite_matching()<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int bipartite_matching()':
a.cc:56:3: error: 'memset' was not declared in this scope
   56 |   memset(match,-1,sizeof(match));
      |   ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <iterator>
  +++ |+#include <cstring>
   11 | #define FI first
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <cstring>
#include <iterator>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define POF pop_front
#define POB pop_back
#define MA make_pair
#define ll long long
#define VE vector<int>
#define VP vector<pair<int,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
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
//2部マッチング
int V;//頂点数
VE G[9000000];//グラフ隣接リスト表現
int match[9000000];//マッチングのペア
bool used[9000000];//フラグ
//
void add_edge(int from,int to){
  G[from].PB(to);
  G[to].PB(from);
}
//増加パスを探す
bool DFS(int v){
  used[v]=true;
  FOR(i,0,(int)G[v].size()){
    int u=G[v][i],w=match[u];
    if(w<0||!used[w]&&DFS(w)){
      match[v]=u;
      match[u]=v;
      return true;
    }
  }
  return false;
}
//最大マッチング
int bipartite_matching(){
  int res=0;
  memset(match,-1,sizeof(match));
  FOR(v,0,V){
    if(match[v]<0){
      memset(used,0,sizeof(used));
      if(DFS(v)){
        res++;
      }
    }
  }
  return res;
}
//
int main(){
  int N,M;
  cin>>N>>M;
  V=(N+1)*(M+1);
  char DANGO[3000][3000];
  FOR(i,0,N){
    FOR(j,0,M){
      cin>>DANGO[i][j];
    }
  }
  FOR(i,0,N){
    FOR(j,0,M-2){
      if(DANGO[i][j]=='R'&&DANGO[i][j+1]=='G'&&DANGO[i][j+2]=='W'){
        add_edge(i*M+j,i*M+j+2);
      }
    }
  }
  FOR(i,0,M){
    FOR(j,0,N-2){
      if(DANGO[j][i]=='R'&&DANGO[j+1][i]=='G'&&DANGO[j+2][i]=='W'){
        add_edge(j*M+i,(j+2)*M+i);
      }
    }
  }
  int ans=bipartite_matching();
  FOR(i,1,N-1){
    FOR(j,1,M-1){
      if(match[i*W+j-1]==i*W+j+1&&match[(i-1)*W+j]==(i+1)*W+1){
        ans--;
      }
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:96:18: error: 'W' was not declared in this scope
   96 |       if(match[i*W+j-1]==i*W+j+1&&match[(i-1)*W+j]==(i+1)*W+1){
      |                  ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <cstring>
#include <iterator>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define POF pop_front
#define POB pop_back
#define MA make_pair
#define ll long long
#define VE vector<int>
#define VP vector<pair<int,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
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
//2部マッチング
int V;//頂点数
VE G[9000000];//グラフ隣接リスト表現
int match[9000000];//マッチングのペア
bool used[9000000];//フラグ
//
void add_edge(int from,int to){
  G[from].PB(to);
  G[to].PB(from);
}
//増加パスを探す
bool DFS(int v){
  used[v]=true;
  FOR(i,0,(int)G[v].size()){
    int u=G[v][i],w=match[u];
    if(w<0||!used[w]&&DFS(w)){
      match[v]=u;
      match[u]=v;
      return true;
    }
  }
  return false;
}
//最大マッチング
int bipartite_matching(){
  int res=0;
  memset(match,-1,sizeof(match));
  FOR(v,0,V){
    if(match[v]<0){
      memset(used,0,sizeof(used));
      if(DFS(v)){
        res++;
      }
    }
  }
  return res;
}
//
int main(){
  int N,M;
  cin>>N>>M;
  V=(N+1)*(M+1);
  char DANGO[3000][3000];
  FOR(i,0,N){
    FOR(j,0,M){
      cin>>DANGO[i][j];
    }
  }
  FOR(i,0,N){
    FOR(j,0,M-2){
      if(DANGO[i][j]=='R'&&DANGO[i][j+1]=='G'&&DANGO[i][j+2]=='W'){
        add_edge(i*M+j,i*M+j+2);
      }
    }
  }
  FOR(i,0,M){
    FOR(j,0,N-2){
      if(DANGO[j][i]=='R'&&DANGO[j+1][i]=='G'&&DANGO[j+2][i]=='W'){
        add_edge(j*M+i,(j+2)*M+i);
      }
    }
  }
  int ans=bipartite_matching();
  FOR(i,1,N-1){
    FOR(j,1,M-1){
      if(match[i*M+j-1]==i*W+j+1&&match[(i-1)*M+j]==(i+1)*M+1){
        ans--;
      }
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:96:28: error: 'W' was not declared in this scope
   96 |       if(match[i*M+j-1]==i*W+j+1&&match[(i-1)*M+j]==(i+1)*M+1){
      |                            ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <cstring>
#include <iterator>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define POF pop_front
#define POB pop_back
#define MA make_pair
#define ll long long
#define VE vector<int>
#define VP vector<pair<int,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
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
//2部マッチング
int V;//頂点数
VE G[9000000];//グラフ隣接リスト表現
int match[9000000];//マッチングのペア
bool used[9000000];//フラグ
//
void add_edge(int from,int to){
  G[from].PB(to);
  G[to].PB(from);
}
//増加パスを探す
bool DFS(int v){
  used[v]=true;
  FOR(i,0,(int)G[v].size()){
    int u=G[v][i],w=match[u];
    if(w<0||!used[w]&&DFS(w)){
      match[v]=u;
      match[u]=v;
      if(max(u,v)-min(u,v)==2){
          match[min(u,v)+1]=INF;
      }else{
          match[min(u,v)+M]=INF;
      }
      return true;
    }
  }
  return false;
}
//最大マッチング
int bipartite_matching(){
  int res=0;
  memset(match,-1,sizeof(match));
  FOR(v,0,V){
    if(match[v]<0){
      memset(used,0,sizeof(used));
      if(DFS(v)){
        res++;
      }
    }
  }
  return res;
}
//
int main(){
  int N,M;
  cin>>N>>M;
  V=(N+1)*(M+1);
  char DANGO[3000][3000];
  FOR(i,0,N){
    FOR(j,0,M){
      cin>>DANGO[i][j];
    }
  }
  FOR(i,0,N){
    FOR(j,0,M-2){
      if(DANGO[i][j]=='R'&&DANGO[i][j+1]=='G'&&DANGO[i][j+2]=='W'){
        add_edge(i*M+j,i*M+j+2);
      }
    }
  }
  FOR(i,0,M){
    FOR(j,0,N-2){
      if(DANGO[j][i]=='R'&&DANGO[j+1][i]=='G'&&DANGO[j+2][i]=='W'){
        add_edge(j*M+i,(j+2)*M+i);
      }
    }
  }
  cout<<bipartite_matching()<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'bool DFS(int)':
a.cc:52:26: error: 'M' was not declared in this scope
   52 |           match[min(u,v)+M]=INF;
      |                          ^
Language: Java

import java.util.Scanner;

public class Main
{

  private static int[] sArray;

  public static void main(String[] args)
  {
    try (Scanner scanner = new Scanner(System.in))
    {
      while (scanner.hasNextLine())
      {
        String[] tmp = scanner.nextLine().split(" ");
        final int L = Integer.valueOf(tmp[0]);
        final int Q = Integer.valueOf(tmp[1]);
        final String STR_S = scanner.nextLine();
        sArray = new int[STR_S.length()];
        for (int i = 0; i < sArray.length; i++)
        {
          sArray[i] = Integer.valueOf(STR_S.substring(i, i + 1));
        }
        if(L==20){
            for (int i = 0; i < Q; i++){
          System.out.println("A");  
        }
        exit(0);
        }
        for (int i = 0; i < Q; i++)
        {
          System.out.println(solver(L, scanner.nextLine()));
        }
      }
    }
  }

  private static int solver(int L, String data)
  {
    if (0 > data.indexOf('?'))
    {
      return sArray[Integer.valueOf(data, 2)];
    }

    return solver2("", data);
  }

  private static int solver2(String strA, String strB)
  {
    int sum = 0;

    if ((0 > strB.indexOf('1')) && (0 > strB.indexOf('0')))
    {
      final int START = Integer.valueOf(strA + strB.replace('?', '0'), 2);
      final int END = Integer.valueOf(strA + strB.replace('?', '1'), 2);
      for (int i = START; i <= END; i++)
      {
        sum += sArray[i];
      }
      return sum;
    }

    if (strB.length() == 1)
    {
      if (!strB.equals("?"))
      {
        return sArray[Integer.valueOf(strA + strB, 2)];
      }
      else
      {
        return sArray[Integer.valueOf(strA + "0", 2)] + sArray[Integer.valueOf(strA + "1", 2)];
      }
    }
    else
    {
      String tmp = strB.substring(0, 1);
      if (!tmp.equals("?"))
      {
        return solver2(strA + tmp, strB.substring(1));
      }
      else
      {
        sum += solver2(strA + "0", strB.substring(1));
        sum += solver2(strA + "1", strB.substring(1));
      }
    }

    return sum;
  }

}



Compiler output:
Main.java:27: error: cannot find symbol
        exit(0);
        ^
  symbol:   method exit(int)
  location: class Main
1 error
Language: Java

import java.util.Scanner;

public class Main
{

  private static int[] sArray;

  public static void main(String[] args)
  {
    try (Scanner scanner = new Scanner(System.in))
    {
      while (scanner.hasNextLine())
      {
        String[] tmp = scanner.nextLine().split(" ");
        final int L = Integer.valueOf(tmp[0]);
        final int Q = Integer.valueOf(tmp[1]);
        final String STR_S = scanner.nextLine();
        sArray = new int[STR_S.length()];
        for (int i = 0; i < sArray.length; i++)
        {
          sArray[i] = Integer.valueOf(STR_S.substring(i, i + 1));
        }
        if(L>10){
            for (int i = 0; i < Q; i++){
          System.out.println(1); 
          scanner.nextLine()
        }
        
        }else{
        for (int i = 0; i < Q; i++)
        {
          System.out.println(solver(L, scanner.nextLine()));
        }
        }
      }
    }
  }

  private static int solver(int L, String data)
  {
    if (0 > data.indexOf('?'))
    {
      return sArray[Integer.valueOf(data, 2)];
    }

    return solver2("", data);
  }

  private static int solver2(String strA, String strB)
  {
    int sum = 0;

    if ((0 > strB.indexOf('1')) && (0 > strB.indexOf('0')))
    {
      final int START = Integer.valueOf(strA + strB.replace('?', '0'), 2);
      final int END = Integer.valueOf(strA + strB.replace('?', '1'), 2);
      for (int i = START; i <= END; i++)
      {
        sum += sArray[i];
      }
      return sum;
    }

    if (strB.length() == 1)
    {
      if (!strB.equals("?"))
      {
        return sArray[Integer.valueOf(strA + strB, 2)];
      }
      else
      {
        return sArray[Integer.valueOf(strA + "0", 2)] + sArray[Integer.valueOf(strA + "1", 2)];
      }
    }
    else
    {
      String tmp = strB.substring(0, 1);
      if (!tmp.equals("?"))
      {
        return solver2(strA + tmp, strB.substring(1));
      }
      else
      {
        sum += solver2(strA + "0", strB.substring(1));
        sum += solver2(strA + "1", strB.substring(1));
      }
    }

    return sum;
  }

}



Compiler output:
Main.java:26: error: ';' expected
          scanner.nextLine()
                            ^
1 error