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

import java.util.HashMap;
import java.util.Scanner;
import java.util.StringJoiner;

public class C {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        StringJoiner sj = new StringJoiner("\n");
        for (int i = 0; i < 2; i ++) {
            sj.add(scanner.nextLine());
        }

        System.out.println(solve(sj.toString()));
    }

    private static int solve(String stdinString) {
        String[] splits = stdinString.split("\n");
        int N = Integer.parseInt(splits[0]);
        int[] nums = new int[N];

        splits = splits[1].split(" ");
        for (int i = 0; i < N; i ++) {
            nums[i] = Integer.parseInt(splits[i]);
        }

        int max = Integer.MIN_VALUE;
        HashMap<Integer, Integer> xCounts = new HashMap<>();
        for (int i = 0; i < N; i ++) {
            xCounts.put(nums[i] - 1, xCounts.getOrDefault(nums[i] - 1, 0) + 1);
            max = Math.max(max, xCounts.get(nums[i] - 1));

            xCounts.put(nums[i], xCounts.getOrDefault(nums[i], 0) + 1);
            max = Math.max(max, xCounts.get(nums[i]));

            xCounts.put(nums[i] + 1, xCounts.getOrDefault(nums[i] + 1, 0) + 1);
            max = Math.max(max, xCounts.get(nums[i] + 1));
        }

        return max;
    }

    private static String ex1 = "7\n3 1 4 1 5 9 2";
    private static String ex2 = "10\n0 1 2 3 4 5 6 7 8 9";
    private static String ex3 = "1\n99999";

    private static void tests() {
        System.out.println(solve(ex1));
        System.out.println(solve(ex2));
        System.out.println(solve(ex3));
    }
}

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

int main(){
    int n;
    cin>>n;
    int p[100001]={0};
    int ans=0;
    for (int i=1; i<=n; i++) {
        cin>>p[i];
    }
    for (int i=1; i<=n; i++) {
        if(p[i]==i){
            swap(p[i], p[i+1]);
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin>>n;
      |     ^~~
a.cc:11:13: error: 'swap' was not declared in this scope
   11 |             swap(p[i], p[i+1]);
      |             ^~~~
a.cc:15:5: error: 'cout' was not declared in this scope
   15 |     cout<<ans<<endl;
      |     ^~~~
a.cc:15:16: error: 'endl' was not declared in this scope
   15 |     cout<<ans<<endl;
      |                ^~~~
Language: Java

import java.util.*;
import java.lang.*;
public class Solution{
  public static void main(String[]args){
    Scanner sn=new Scanner(System.in);
     int n=sn.nextInt();
    int[] arr=new int[n];
            for(int i=0;i<n;i++)
            {
              arr[i]=sn.nextInt();}
    int ans[]=new int[100003];
         for(int i=0;i<n;i++)
         {
           ans[arr[i]]++;
           ans[arr[i]+1]++;
           ans[arr[i]+2]++;}
    int max=0;
    for(int i=0;i<ans.length;i++)
      max=Math.max(ans[i],max);
    System.out.println(max);}}

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

#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto &x : a)
        std::cin >> x;

    sort(a.begin(), a.end());
    auto cmax = 0;
    for(auto i = 0; i < n; i++) {
        auto c = 1;
        for(auto j = i + 1; j < n && a[j] <= a[i] + 2; j++) {
            c++;
        }
        cmax = max(cmax, c);
    }
    cout << cmax << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |     sort(a.begin(), a.end());
      |     ^~~~
      |     short
Language: C

#include <stdio.h>
#include <stdlib.h>
 
int main() {
  int a[100002];
  int b;
  int i, j, N;
  int *p;
 
  for (i = 0; i < 100002; i++) {
    a[i] = 0;
  }
 
  scanf("%d", &N);
  p = (int*)malloc(sizeof(int) * N);
 
  for (int i = 0; i < N; i++) {
    scanf("%d", (p + i));
  }
 
  for (i = 0; i < N; i++) {
    b = *(p + i);
    a[b]++;
    a[b - 1]++;
    a[b + 1]++;
  }
 
  int max = 0;
  for (int i = 0; i < 100002; i++) {
    if (max < a[i]) {
      max = a[i];
    }
 
  printf("%d\n", max);
 
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:37:1: error: expected declaration or statement at end of input
   37 | }
      | ^
Language: C++

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

int main() {
  int a[100002];
  int b;
  int i, j, N;
  int *p;

  for (i = 0; i < 100002; i++) {
    a[i] = 0;
  }

  scanf("%d", &N);
  p = (int*)malloc(sizeof(int) * N);

  for (int i = 0; i < N; i++) {
    scanf("%d", (p + i));
  }

  for (i = 0; i < N; i++) {
    b = *(p + i);
    a[b]++;
    a[b - 1]++;
    a[b + 1]++;
  }

  int max = 0;
  for (int i = 0; i < 100002; i++) {
    if (max < a[i]) {
      max = a[i];
    }

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

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C


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

#define MAX_LENGTH		(10000)

int secure_scanf_decimal();

int secure_scanf_decimal()
{
	char s[ 64 ];
	long a;
	char* endp;

	fgets( s, 64, stdin );
	a = strtol( s, &endptr, 10 );
	if ( ( *endptr != 0x00 ) || ( a < INT_MIN ) || ( a > INT_MAX ) )
		return -1;
	return ( int )a;
}

}
int main( int argc, char** argv )
{
	
	int a;
	int* List;
	int n;

	n = secure_scanf_decimal();
	if ( n > MAX_LENGTH )
		return -1;
	a = 0;
	List = malloc( sizeof( int ) * ( n + 2 ) );		// n + 2 is anti-zero
	memset( List, 0, sizeof( int ) * ( n + 2 ) );
	
	for ( int i = 0; i < n; i++ )
	{
		secure_scanf_decimal( "%d", &a );
		List[ a - 1 ] += 1;
		List[ a     ] += 1;
		List[ a + 1 ] += 1;		// index 0 is -1
	}

// search max value
	a = 0;		// index
	
	for ( int i = 0; i < n; i++ )
	{
		if ( List[ i ] > a )
			a = List[ i ];
	}
	printf( "%d\n", a );
	return a;
}




Compiler output:
main.c: In function 'secure_scanf_decimal':
main.c:17:25: error: 'endptr' undeclared (first use in this function); did you mean 'endp'?
   17 |         a = strtol( s, &endptr, 10 );
      |                         ^~~~~~
      |                         endp
main.c:17:25: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:43: error: 'INT_MIN' undeclared (first use in this function)
   18 |         if ( ( *endptr != 0x00 ) || ( a < INT_MIN ) || ( a > INT_MAX ) )
      |                                           ^~~~~~~
main.c:5:1: note: 'INT_MIN' is defined in header '<limits.h>'; this is probably fixable by adding '#include <limits.h>'
    4 | #include <stdio.h>
  +++ |+#include <limits.h>
    5 | 
main.c:18:62: error: 'INT_MAX' undeclared (first use in this function)
   18 |         if ( ( *endptr != 0x00 ) || ( a < INT_MIN ) || ( a > INT_MAX ) )
      |                                                              ^~~~~~~
main.c:18:62: note: 'INT_MAX' is defined in header '<limits.h>'; this is probably fixable by adding '#include <limits.h>'
main.c: At top level:
main.c:23:1: error: expected identifier or '(' before '}' token
   23 | }
      | ^
Language: C++

#include <stdio.h>

#define MAX_LENGTH		(10000)

int main( int argc, char** argv )
{
	int a;
	int* List;
	int n;

	scanf( "%d", &n );
	if ( n > MAX_LENGTH )
		return -1;
	a = 0;
	List = malloc( n + 2 );		// n + 2 is anti-zero
	
	for ( int i = 0; i < n; i++ )
	{
		scanf( "%d", &a );
		List[ a - 1 ] += 1;
		List[ a     ] += 1;
		List[ a + 1 ] += 1;		// index 0 is -1
	}

// search max value
	a = 0		// index
	
	for ( int i = 0; i < n; i++ )
	{
		if ( List[ i ] > a )
			a = List[ i ];
	}
	return ( a + 1 );
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:15:16: error: 'malloc' was not declared in this scope
   15 |         List = malloc( n + 2 );         // n + 2 is anti-zero
      |                ^~~~~~
a.cc:2:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
    1 | #include <stdio.h>
  +++ |+#include <cstdlib>
    2 | 
a.cc:26:16: error: expected ';' before 'for'
   26 |         a = 0           // index
      |              ^~~
      |                ;
   27 | 
   28 |         for ( int i = 0; i < n; i++ )
      |         ~~~   
a.cc:28:26: error: 'i' was not declared in this scope
   28 |         for ( int i = 0; i < n; i++ )
      |                          ^
Language: C++

/********************************************
 *Author*        :ZZZZone
 *Created Time*  : 一  9/ 4 18:28:20 2017
 *Ended  Time*  : 一  9/ 4 18:32:38 2017
*********************************************/
#include<cstdio>
#include<string>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
const int MaxN = 1e5;

int n;
int cnt[MaxN + 10];

int main(){
    while(~scanf("%d", &n)){
        int res = 0;
        for(int i = 1; i <= n; i++){
            int x;
            scanf("%d", &x);
            for(int j = 0; j <= 2; j++){
                cnt[x + j]++;
                res = max(res, cnt[x + j]);
            }
        }
        printf("%d\n", res);
        memset(cnt, 0, sizeof(cnt));
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'memset' was not declared in this scope
   29 |         memset(cnt, 0, sizeof(cnt));
      |         ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include<algorithm>
  +++ |+#include <cstring>
   11 | using namespace std;
Language: C++

#include "IntMod.h"
typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>

using namespace std;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
#define FLOAT fixed << setprecision(16)
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

#if 1
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

int N;
int A[100001];
int P[100002];
int MAX;

int main() {
	cin >> N;
	REP(i, 0, N) {
		cin >> A[i];
		P[A[i]]++;
	}

	REP(i, 0, 100000) {
		int t = P[i] + P[i + 1] + P[i + 2];
		if (t > MAX) {
			MAX = t;
		}
	}
	cout << MAX << endl;
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: IntMod.h: No such file or directory
    1 | #include "IntMod.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
//import java.util.Scanner;

public class C{
    public static void main(String[] args)throws Exception {
    int N =0 ,i=0,max=0,count=0;
  //  Scanner in = new Scanner (System.in);
    BufferedReader in=new BufferedReader( new InputStreamReader(System.in));
    N=Integer.parseInt(in.readLine());
   StringTokenizer x= new StringTokenizer(in.readLine());
    PrintWriter out = new PrintWriter(System.out);  
  
    in.close();
    List counted= new ArrayList();
    int []nthn=new int[N*2];
    while(N!=0){
    nthn[i]=Integer.parseInt(x.nextToken()); 
    nthn[i+N]=nthn[i]-1;
    i++;
    N--;}
   // int l=nthn.length;
   
 
        for (int j = 0; j < nthn.length; j++) {
         //   if (j<nthn.length) System.out.print(nthn[j]+" " );
         //if (counted.contains(nthn[j-nthn.length]-1)) break;
         if (!counted.contains(nthn[j])) {
             count=0;
               for (int k = 0; k < (nthn.length/2); k++) {
               
                if (j<(nthn.length/2)){
                count = (nthn[j]==(nthn[k]+1)||nthn[j]==(nthn[k])-1)?++count:count;
                counted.add(nthn[j]);}
                //if(nthn[j]==nthn[j-1]) j++;
              else{
                 
               count = ((nthn[j])==(nthn[k]+1))?++count:count;      
               counted.add(nthn[j]);
                }
            }
            max=(max>count)?max:count;
            
        }}
       out.println(max+1);
       out.flush();
       out.close();
    }
}
/*

Problem Statement

You are given an integer sequence of length N, a1,a2,…,aN.

For each 1≤i≤N, you have three choices: add 1 to ai, subtract 1 from ai or do nothing.

After these operations, you select an integer X and count the number of i such that ai=X.

Maximize this count by making optimal choices.
Constraints

    1≤N≤105
    0≤ai<105(1≤i≤N)
    ai is an integer.




*/

Compiler output:
Main.java:9: error: class C is public, should be declared in a file named C.java
public class C{
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

N = 10**5 + 10
n = int(input())
a = list(map(int, input().split()))
c = [0] * N
for i in a: c[i] += 1
ans = max(c[i - 1] + c[i] + c[i + 1] for i in range(1, N - 1))
print(ans)
    

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = 10**5 + 10
      | ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n;
  int b;
  cin >> n;
  int a[n];
  memset(a,0,sizeof(a));
  for(int i=0; i<n; i++){
    cin >> b;
    a[b-1]++;
    a[b]++;
    a[b+1]++;
  }

  int ans = 0;
  for(int i=0; i<n; i++){
    ans = max(ans, a[i]);
  }
  cout << ans << endl;
  return 0;
}


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

#include <iostream>
#include <fstream>
#include <cmath>

using namespace std;

int main(){
	int n; cin >> n;
	int c[(int)1e6];
	memset(c, sizeof c, 0);
	if(n==1) {
		cout << 1 << endl;
		return 0;
	}
	for(int i = 0; i < n; i++){
		int a; cin >> a;
		c[a-1]++;
		c[a+1]++;
		c[a]++;
	}

	int ans = 0;
	for(int i = 0; i < n; i++)
	{
		ans = max(ans, c[i]);
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'memset' was not declared in this scope
   10 |         memset(c, sizeof c, 0);
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <cmath>
  +++ |+#include <cstring>
    4 |
Language: C++

#include<bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = INT_MAX;
const ll LLINF = LLONG_MAX;
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cout<<"!"<<endl
#define SHOW(a,b) cout<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cout<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
  
#define DIV 1000000007
typedef vector<ll> Array;
typedef vector<Array> matrix;
typedef tuple<int,int,int> tiii;
#define mt make_tuple

ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if(n&1==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
int k[1000100];
int main(){
  int n; cin >> n;
  rep(i,n){
    int tmp; cin >> tmp;
    k[tmp]++; k[tmp+1]++;
    if(tmp > 0) k[tmp-1]++;
  }
  int ans = 0;
  rep(i,1000001)
    if(kazu[ans] < kazu[i])
      ans = i;
  cout << kazu[ans] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:8: error: 'kazu' was not declared in this scope
   39 |     if(kazu[ans] < kazu[i])
      |        ^~~~
a.cc:41:11: error: 'kazu' was not declared in this scope
   41 |   cout << kazu[ans] << endl;
      |           ^~~~
Language: Java

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Together {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            for (int j = -1; j <= 1; j++) {
                int num = a[i] + j;
                int count = map.getOrDefault(num, 0) + 1;
                map.put(num, count);
            }
        }
        System.out.println(Collections.max(map.values()));
    }
}


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

    #include<stdio.h>
    int a,n,c=0,f=0;
    main() {
    scanf("%d",&n);
    for(int i=1;i<=n;i++) 
    if(a==i) c+=(f>0) f=0;
    printf("%d\n",c);
    }

Compiler output:
a.cc:3:5: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 |     main() {
      |     ^~~~
a.cc: In function 'int main()':
a.cc:6:22: error: expected ';' before 'f'
    6 |     if(a==i) c+=(f>0) f=0;
      |                      ^~
      |                      ;
Language: Java

public static void main(String[] args)throws Exception {
    int N =0,x=0 ,i=0,max=0,count=0;
    Scanner in = new Scanner (System.in);
    N=in.nextInt();
    int []add=new int[N];
    int []sub=new int[N];
    int []nthn=new int[N];
    while(N!=0){
     nthn[i]=in.nextInt();
     add[i]=nthn[i]+1;
     sub[i]=nthn[i]-1;
     i++;  
    N--;}
    in.close();
    
    //count for x
        for (int j = 0; j < nthn.length*2; j++) {
               for (int k = 0; k < nthn.length; k++) {
                   if (j<nthn.length)
                count = (nthn[j]==add[k]||nthn[j]==sub[k])?++count:count;
                else
                count = (sub[j-nthn.length]==add[k]||sub[j-nthn.length]==nthn[k])?++count:count;      
            }
            max=(max>count)?max:count;
            count=0;
        }
        System.out.println(max+1);
    }

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args)throws Exception {
              ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: Java

import java.util.Scanner;

public class C{
    public static void main(String[] args)throws Exception {
    int N =0,x=0 ,i=0,max=0,count=0;
    Scanner in = new Scanner (System.in);
    N=in.nextInt();
    int []add=new int[N];
    int []sub=new int[N];
    int []nthn=new int[N];
    while(N!=0){
     nthn[i]=in.nextInt();
     add[i]=nthn[i]+1;
     sub[i]=nthn[i]-1;
     i++;  
    N--;}
    in.close();
    
    //count for x
        for (int j = 0; j < nthn.length*2; j++) {
               for (int k = 0; k < nthn.length; k++) {
                   if (j<nthn.length)
                count = (nthn[j]==add[k]||nthn[j]==sub[k])?++count:count;
                else
                count = (sub[j-nthn.length]==add[k]||sub[j-nthn.length]==nthn[k])?++count:count;      
            }
            max=(max>count)?max:count;
            count=0;
        }
        System.out.println(max+1);
    }
}

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

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
#include <tuple>

using namespace std;

typedef int long long;

struct pos
{
    int x, y;
};

pos arr[200];
bool chk[200][200];

const int mod = 998244353;
int exp(int a, int x)
{
    if(x == 0)
        return 1;
    if(x%2)
        return 1LL * exp(a, x-1) * a % mod;
    int t = exp(a, x/2);
    return 1LL * t * t % mod;
}

int fac[201];
int caf[201];
inline int ncr(int n, int r)
{
    return 1LL * fac[n] * caf[r] % mod * caf[n-r] % mod;
}

vector<int> tmp;

int main()
{
    //freopen("in", "r", stdin);
    //freopen("out", "w", stdout);

    int n, x, y, r, t, i, j, k;
    scanf("%lld", &n);
    for(i = 0; i<n; i++)
    {
        scanf("%lld%lld", &x, &y);
        arr[i] = { x, y };
    }

    fac[0] = 1;
    for(i = 1; i<=200; i++)
        fac[i] = 1LL * fac[i-1] * i % mod;

    for(i = 0; i<=200; i++)
        caf[i] = exp(fac[i], mod-2);

    r = 0;
    for(i = 3; i<=n; i++)
        r = (r + ncr(n, i)) % mod;

    for(i = 0; i<n-1; i++)
    {
        for(j = i+1; j<n; j++)
        {
            if(chk[i][j] || chk[j][i])
                continue;

            tmp.clear();

            tmp.push_back(i);
            tmp.push_back(j);

            t = 2;
            for(k = 0; k<n; k++)
            {
                if(k == i || k == j)
                    continue;

                if(1LL * (arr[i].y - arr[j].y) * (arr[i].x - arr[k].x) != 1LL * (arr[i].x - arr[j].x) * (arr[i].y - arr[k].y))
                    continue;

                tmp.push_back(k);
                t++;
            }

            for(int ii = 0; ii<t-1; ii++)
                for(int jj = ii+1; jj<t; jj++)
                    chk[ii][jj] = 1;

            for(k = 3; k<=t; k++)
                r = (r + (mod - ncr(t, k))) % mod;
        }
    }

    printf("%lld\n", r);
    return 0;
}

Compiler output:
a.cc:12:18: error: declaration does not declare anything [-fpermissive]
   12 | typedef int long long;
      |                  ^~~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

#define ZERO(p) memset(p, 0, sizeof(p))

int main() {
    int N;
    std::cin >> N;
    int MAXNUM = 100000;
    int max=0;
    int counter[MAXNUM+2];
    ZERO(counter);
    for(int i=0;i<N;i++) {
        int a;
        std::cin >> a;
        //counter[i]はi+1の数
        counter[a] = counter[a] + 1;
        counter[a+1] = counter[a+1] + 1;
        counter[a+2] = counter[a+2] + 1;
        int candidate;
        if(max < counter[a] ) {
            max = counter[a];
        }
        if(max < counter[a+1] ) {
            max = counter[a+1];
        }
        if(max < counter[a+2] ) {
            max = counter[a+2];
        }
    }
    std::cout << max << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: 'memset' was not declared in this scope
    6 | #define ZERO(p) memset(p, 0, sizeof(p))
      |                 ^~~~~~
a.cc:14:5: note: in expansion of macro 'ZERO'
   14 |     ZERO(counter);
      |     ^~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<vector>
  +++ |+#include <cstring>
    5 |
Language: Java

import java.util.Scanner;

public class M082M1
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int[] a=new int[N];
		int[] dd=new int[(int)Math.pow(10, 5)+1];
		int max=0;
		int buf=0;
		for(int i=0;i<N;i++)
		{
			a[i]=sc.nextInt();
			dd[a[i]]++;
		}
		for(int i=0;i<N;i++)
		{
			if(a[i]==0){buf=dd[0]+dd[1];}
			else if(a[i]==(int)Math.pow(10, 5)){buf=dd[(int)Math.pow(10, 5)]+dd[(int)Math.pow(10, 5)-1];}
			else{buf=dd[a[i]]+dd[a[i]-1]+dd[a[i]+1];}
			max=(buf>=max)?buf:max;
		}
		System.out.println(max);
	}
}

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


import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Template {

    public static void main(String[] args) throws Throwable {
        InputStream is = null;
        if (false) {
            String input = "1\n" +
"99999";
            is = new ByteArrayInputStream(input.getBytes());
        } else {
            is = System.in;
        }
        try (BufferedReader r = new BufferedReader(new InputStreamReader(is))) {
            int N = readInt(r);
            int[] as = readInts(r);
            int[] counts = new int[(int)Math.pow(10, 5)];

            for (int a : as) {
                counts[a]++;
            }

            int max = -1;
            int maxIndex = -1;
            for (int i = 0; i < counts.length; i++) {
                int before = i == 0 ? 0 : counts[i - 1];
                int after = i == counts.length - 1 ? 0 : counts[i + 1];
                int total = before + after + counts[i];
                if (total > max) {
                    max = total;
                    maxIndex = i;
                }
            }
            System.out.println(max);
        }
    }

    private static int readInt(BufferedReader r) throws IOException {
        return Integer.parseInt(r.readLine());
    }

    private static int[] readInts(BufferedReader r) throws IOException {
        String[] data = r.readLine().split("\\s");
        int[] vals = new int[data.length];
        for (int i = 0; i < vals.length; i++) {
            vals[i] = Integer.parseInt(data[i]);
        }
        return vals;
    }

}


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

#include <iostream>
#include <cstdio>
#include <iostream>
using namespace std;

int main (void)
{
    int s[150000] = {0};
    int n;
    int i;
    int ans[150000] = {0};
    long long max = 0;
    int c[150000] = {0};
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&s[i]);
    }
    sort(s,s+n);
    
    for(i=0;i<n;i++){
        c[s[i]]++;
    }
    for(i=0;i<s[n-1];i++){
        ans[i] = c[i] + c[i+1] + c[i+2];
    }
    for(i=0;i<s[n-1];i++){
        if(ans[i] > max){
            max = ans[i];
        }
    }
    /*for(i=0;i<s[n-1];i++){
        printf("%d\n",ans[i]);
    }*/
    /*for(i=0;i<s[n-1]-2;i++){
        printf("%d\n",ans[i]);
    }*/
    printf("%lld\n",max);

    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |     sort(s,s+n);
      |     ^~~~
      |     short
Language: C++

#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
int n,a[100001]; 
int num[100001];
int ans=0;
int main(void)
{
	cin>>n;
	memset(num,0,sizeof(num));
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		num[a[i]]++;
		num[a[i]+1]++;
		num[a[i]-1]++;
		ans=max(ans,num[a[i]]);
		ans=max(ans,num[a[i]+1]);
		ans=max(ans,num[a[i]-1]);
	}
	cout<<ans<<endl;
	return 

Compiler output:
a.cc: In function 'int main()':
a.cc:23:15: error: expected primary-expression at end of input
   23 |         return
      |               ^
a.cc:23:15: error: expected ';' at end of input
   23 |         return
      |               ^
      |               ;
a.cc:23:15: error: expected '}' at end of input
a.cc:9:1: note: to match this '{'
    9 | {
      | ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int N;
    cin >> N;
    int a;
    int ap, am;
    vector<int> as;

    for (int i = 0; i < N; i++) {
        cin >> a;
        ap = a + 1;
        am = a - 1;
        as.push_back(a);
        as.push_back(ap);
        as.push_back(am);
    }
    sort(as.begin(), as.end());

    int count = 0;
    int tmp = 1;
    for (int i = 0; i < as.size() - 1; ++i) {
        if (as[i] != as[i + 1]) {
            count = max(count, tmp);
            tmp = 1;
        } else {
            ++tmp;
        }
    }

    cout << count << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   20 |     sort(as.begin(), as.end());
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
#include<Windows.h>
using namespace std;
#define MOD 1000000007
#define REP(m,n) for(int i=m;i<n;++i)
#define REPj(m,n) for(int j=m;j<n;++j)
#define INF 10000000000000000
#define ll long long
#define mp make_pair

vector<int>v(100002, 0);

int main() {
	int n, ans = 0;
	cin >> n;
	REP(0, n) {
		int tmp;
		cin >> tmp;
		if (tmp == 0) {
			v[0]++;
			v[1]++;
		}
		else {
			v[tmp]++;
			v[tmp + 1]++;
			v[tmp - 1]++;
		}
	}
	REP(0, 100002) {
		ans = max(ans, v[i]);
	}
	cout << ans << endl;
	return 0;
}

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

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

#define f first
#define s second
#define p pair<int,int>
#define P pair<ll,ll>
#define pb push_back
#define ll long long
#define db double
#define zero(a) memset(a,0,sizeof(a))
#define inff(a,n) fill(a,a+n+1,inf)
#define all(a) a.begin(),a.end()
#define sz(a) int((a).size())
#define read(x) scanf("%lld",&x)
#define read2(x,y) scanf("%lld%lld",&x,&y)
#define write(x) printf("%lld\n",x)

const int maxn=2e6+10;
const ll inf=1e9;

ll n,m,ans,sum,num,a[maxn],b[maxn],vis[maxn];
string s,t,s1,s2;

int main()
{
    read(n);
    for(int i=0;i<n;i++)read(a[i]),vis[a[i]]++,vis[a[i]+1]++,if(a[i]-1>=0)vis[a[i]-1]++;
    write(max(*max_element(vis,vis+maxn));
    return 0;
}


Compiler output:
a.cc:31:2: error: unterminated argument list invoking macro "write"
   31 | }
      |  ^
a.cc: In function 'int main()':
a.cc:28:62: error: expected primary-expression before 'if'
   28 |     for(int i=0;i<n;i++)read(a[i]),vis[a[i]]++,vis[a[i]+1]++,if(a[i]-1>=0)vis[a[i]-1]++;
      |                                                              ^~
a.cc:29:10: error: expected ';' at end of input
   29 |     write(max(*max_element(vis,vis+maxn));
      |          ^
      |          ;
a.cc:29:10: error: expected '}' at end of input
a.cc:26:1: note: to match this '{'
   26 | {
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> a(N);
	for (auto &x : a) cin >> x;

	unordered_map<int, int> h;

	for (auto x : a) {
		for (int d = -1; d <= +1; ++d) {
			++h[x + d];
		}
	}

	int ans = 0;
	for (const auto &e : h) {
		ans = max(ans, e.second);
	}

	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'vector' was not declared in this scope
   11 |         vector<int> a(N);
      |         ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <unordered_map>
  +++ |+#include <vector>
    4 | 
a.cc:11:16: error: expected primary-expression before 'int'
   11 |         vector<int> a(N);
      |                ^~~
a.cc:12:24: error: 'a' was not declared in this scope
   12 |         for (auto &x : a) cin >> x;
      |                        ^
a.cc:16:23: error: 'a' was not declared in this scope
   16 |         for (auto x : a) {
      |                       ^
Language: C++

#include<cstdio>
#include<cstring>
using namespace std;
int n,a[100005],cnt[200005];
template < typename T > MAX(T a,T b){
	return a>b?a:b;
}
int main(){
	scanf("%d",&n);
	int xb,x2;
	for(xb=0;xb<n;xb++) scanf("%d",a+xb);
	for(xb=0;xb<n;xb++){
		cnt[a[xb]]++;
		cnt[a[xb]+1]++;
		cnt[a[xb]+2]++;
	}
	int val=0;
	for(xb=0;xb<200005;xb++) val=MAX(val,cnt[xb]);
	printf("%d\n",val);
	return 0;
}

Compiler output:
a.cc:5:25: error: ISO C++ forbids declaration of 'MAX' with no type [-fpermissive]
    5 | template < typename T > MAX(T a,T b){
      |                         ^~~
Language: C++

#include<bits//stdc++/h>
using namespace std;
int a[100000],n,b[100001];
int main(){
cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    b[a[i]]++;
    b[a[i]-1]++;
    b[a[i]+1]++;
  }
  int sum=0;
  for(int i=0;i<n;i++){
	sum=max(sum,b[i]);
  }
  cout<<sum<<endl;
}

Compiler output:
a.cc:1:9: fatal error: bits//stdc++/h: No such file or directory
    1 | #include<bits//stdc++/h>
      |         ^~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;

int n, a[100010];

int main(){
  cin >> n;
  for (int i=1; i <= n; i++) cin >> a[i];
  int ans = 0; 
  int ted = 0;
  for (int i = 1; i <= n; i++){
      if (a[i] == i) ted++;
    else ans += (ted / 2) + ted % 2, ted = 0;
  }
  ans += (ted / 2) + ted % 2;
  cout << ans;
  
  return 0
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:11: error: expected ';' before '}' token
   19 |   return 0
      |           ^
      |           ;
   20 | 
   21 | }
      | ~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int n, a[100010];

int main(){
  cin >> n;
  for (int i=1; i <= n; i++) cin >> a[i];
  int ans = 0; 
  int ted = 0;
  for (int i = 1; i <= n; i++){
      if (a[i] == i) ted++;
    else ans += (ted / 2) + ted % 2, ted = 0
  }
  ans += (ted / 2) + ted % 2;
  cout << ans;
  
  return 0;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:45: error: expected ';' before '}' token
   14 |     else ans += (ted / 2) + ted % 2, ted = 0
      |                                             ^
      |                                             ;
   15 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int n, a[100010];

int main(){
  cin >> n;
  for (int i=1; i <= n; i++) cin >> a[i];
  int ans = 0; 
  int ted = 0;
  for (int i = 1; i <= n; i++){
      if (a[i] == i) ted++;
    else ans += (ted / 2) + ted % 2, ted = 0
  }
  ans += (ted / 2) + ted % 2;
  cout << ans;
  
  return 0
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:45: error: expected ';' before '}' token
   14 |     else ans += (ted / 2) + ted % 2, ted = 0
      |                                             ^
      |                                             ;
   15 |   }
      |   ~                                          
a.cc:19:11: error: expected ';' before '}' token
   19 |   return 0
      |           ^
      |           ;
   20 | 
   21 | }
      | ~
Language: C++

#include<iostream>
#include<vector>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

int main(){
  int N,a[100010],ans =0;
  
  cin >> N;
  
  for(int i=0;i<N;i++)
    cin >> a[i];
  
  
  for(int i=0;i<N;i++){
    
    if(a[i] == i){
      
      if(a[i+1] == i+1){
      ans ++;
      i++;
      }
      
      else{
        ans ++;
      }
      
    }
    
    cout << ans << endl;
    
  }
    
    
      
    
        
    
      
        
      
      
      
      
  
 


Compiler output:
a.cc: In function 'int main()':
a.cc:34:4: error: expected '}' at end of input
   34 |   }
      |    ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
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[] p = new int[N];
    int cnt = 0;
    for (int i = 0; i < N; i++) {
      p[i] = in.nextInt();
    }
    for(int i = 1;i <= N;i++){
      if(p[i-1]==i){
        cnt++;
        i++;
      }
    }
    System.out.println(cnt);
  }
}
        


Compiler output:
Main.java:10: error: cannot find symbol
      p[i] = in.nextInt();
             ^
  symbol:   variable in
  location: class Main
1 error
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int N = scanner.nextInt();
    int cnt = 0;
    for(int i = 1;i <= N;i++){
      if(scanner.nextInt() == i){
        cnt++;
      }
    }
    System.out.println(cnt);
  }
}
        


Compiler output:
Main.java:6: error: cannot find symbol
    int N = scanner.nextInt();
            ^
  symbol:   variable scanner
  location: class Main
Main.java:9: error: cannot find symbol
      if(scanner.nextInt() == i){
         ^
  symbol:   variable scanner
  location: class Main
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
signed main(){
  int a,c=0;
  cin>>a;
  vector<int> b(a);
  fo(i,a)
    cin>>b[i];
  fo(i,a){
    if(i==a-1&&b[i]==i+1)
      c++;
    else if(b[i]==i+1){
      swap(b[i],b[i+1]);
      c++;
    }
  }
  cout<<c<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:87:17: error: expected '}' at end of input
   87 |   cout<<c<<endl;
      |                 ^
a.cc:73:14: note: to match this '{'
   73 | signed main(){
      |              ^
Language: C++

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

int main(){
	int n;cin>>n;
	vector<int>a(n);
	for(auto&& w:a)cin>>w;
	int num=0,ans=0;
	for(int i=0;i<n;i++){
		if(a[i]==i+1){num++;}
		else{
			if(num!=0)ans+=((num/2)+1);
			num=0;
		} 
     // cout<<num<<" "<<ans<<endl;
	}
	if(num!=0)ans+=((num/2)+1;
                    
	cout<<ans<<endl;	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:34: error: expected ')' before ';' token
   17 |         if(num!=0)ans+=((num/2)+1;
      |                        ~         ^
      |                                  )
Language: C++

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

int main(){
	int n;cin>>n;
	vector<int>a(n);
	for(auto&& w:a)cin>>w;
	int num=0,ans=0;
	for(int i=0;i<n;i++){
		if(a[i]==i+1){num++;}
		else{
			if(num!=0)ans+=((num/2)+1);
			num=0;
		} 
      cout<<num<<" "<<ans<<endl;
	}
	if(num!=0)ans+=((num/2)+1
                    
	cout<<ans<<endl;	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:34: error: expected ')' before 'cout'
   17 |         if(num!=0)ans+=((num/2)+1
      |                        ~         ^
      |                                  )
   18 | 
   19 |         cout<<ans<<endl;
      |         ~~~~
Language: C++

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

int main(){
	int n;cin>>n;
	vector<int>a(n);
	for(auto&& w:a)cin>>w;
	int num=0;ans=0;
	for(int i=0;i<n;i++){
		if(a[i]==i+1)num++;
		else{
			ans+=num/2+1;
			num=0;
		} 
	}
	if(num!=0)ans+=num/2+1;
	cout<<ans<<endl;	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:19: error: 'ans' was not declared in this scope; did you mean 'abs'?
    8 |         int num=0;ans=0;
      |                   ^~~
      |                   abs
Language: C++

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

int n;
int p[100007];

int main()
{
  cin >> n;
  int count = 0;
  int tmp;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  
  for (int i = 0; i < n; i++) {
    if (p[i] == i + 1) {
      i++;
      continue;
      for (int j = 0; j < n; j++)  {
        if(p[j] == j + 1) break;
      	j--;
      	count += (j - i + 2) / 2
        i = j + 1;
      }
    }
  }
    
   cout << count << endl;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:23:33: error: expected ';' before 'i'
   23 |         count += (j - i + 2) / 2
      |                                 ^
      |                                 ;
   24 |         i = j + 1;
      |         ~
Language: C++

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

int n;
int p[100007];

int main()
{
  cin >> n;
  int count = 0;
  int tmp;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  
  for (int i = 0; i < n; i++) {
    if (p[i] == i + 1) {
      i++;
      continue;
      for (int j = 0; j < n; j++) if(p[j] == j + 1) break;
      j--;
      count += (j - i + 2) / 2
        i = j + 1;
    }
  }
    
   cout << count << endl;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:21:7: error: 'j' was not declared in this scope
   21 |       j--;
      |       ^
Language: C++

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

int n;
int p[100007];

int main()
{
  cin >> n;
  int count = 0;
  int tmp;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  
  for (int i = 0; i < n; i++) {
    if (p[i] == i + 1) {
      i++;
      continue;
      for (j = 0; j < n; j++) if(p[j] == j + 1) break;
      j--;
      ans += (j - i + 2) / 2
        i = j + 1;
    }
  }
    
   cout << count << endl;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:20:12: error: 'j' was not declared in this scope
   20 |       for (j = 0; j < n; j++) if(p[j] == j + 1) break;
      |            ^
a.cc:21:7: error: 'j' was not declared in this scope
   21 |       j--;
      |       ^
a.cc:22:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |       ans += (j - i + 2) / 2
      |       ^~~
      |       abs
Language: C++

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

int n;
int p[100007];

int main()
{
  cin >> n;
  int count = 0;
  int tmp;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  int k = 0;
  if (p[0] == 1 && p[n - 1] == n) {
    count++;
    swap(p[0], p[n-1]);
  	k++
  }
  
  for (int i = 0; i < n - 1 - k; i++) {
    if (p[i] == i + 1) {
      count++;
      if (p[i + 1] == i + 2) i++;
    }
  }
    
   cout << count << endl;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: expected ';' before '}' token
   19 |         k++
      |            ^
      |            ;
   20 |   }
      |   ~
Language: C++

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

int arr[100005];

int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>arr[i];
    int cnt=0;
    for(int i=1;i<=n;i++){
        if(arr[i]==i)
            cnt++,i++;
 
    cout<<cnt;
    return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:2: error: expected '}' at end of input
   20 | }
      |  ^
a.cc:7:1: note: to match this '{'
    7 | {
      | ^
Language: C++

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

int main() {
  int N;
  scanf("%d", &N);
  int cnt = 0;
  int arr[N+1;
  for (int i = 1; i <= N; ++i) {
    scanf("%d", arr+i);
  }
  for (int i = 1; i < N; ++i) {
    if (arr[i] == i) swap(arr[i], arr[i+1]). ++cnt;
  }
  printf("%d\n", cnt);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: expected ']' before ';' token
    8 |   int arr[N+1;
      |              ^
      |              ]
a.cc:10:17: error: 'arr' was not declared in this scope
   10 |     scanf("%d", arr+i);
      |                 ^~~
a.cc:13:9: error: 'arr' was not declared in this scope
   13 |     if (arr[i] == i) swap(arr[i], arr[i+1]). ++cnt;
      |         ^~~
a.cc:13:46: error: expected unqualified-id before '++' token
   13 |     if (arr[i] == i) swap(arr[i], arr[i+1]). ++cnt;
      |                                              ^~
Language: C++

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

int main() {
  int N;
  scanf("%d", &N);
  int cnt = 0;
  int tmp;
  for (int i = 0; i < N; ++i) {
    scanf("%d", &tmp);
    cnt += (tmp == i+1);
  }
  printf("%d\n" (cnt+1)/2);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: expression cannot be used as a function
   13 |   printf("%d\n" (cnt+1)/2);
      |          ~~~~~~~^~~~~~~
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,t=1,k=0;
	cin>>n;
	while(n--)
		cin>>a[t++];
	for(int i=1;i<=n;i++)
	{
		if(a[i]==i)
		{
			int t=a[i];a[i]=a[i+1];a[i+1]=t;
			k++;			
		}

			
	}
	cout<<k;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: 'a' was not declared in this scope
   10 |                 cin>>a[t++];
      |                      ^
a.cc:13:20: error: 'a' was not declared in this scope
   13 |                 if(a[i]==i)
      |                    ^
Language: C++

#include<bits/stdc++.h>
#define N 500005
using namespace std;
int n,a[N];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	int ans=0;
	for (int i=1;i<n;i++){
		if (a[i]==i){
			swap(a[i],a[i+1]);
			ans++;
		}
	}
	if (a[i]==n) ans++;
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: 'i' was not declared in this scope
   15 |         if (a[i]==n) ans++;
      |               ^
Language: C++

/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

int a[MAXN];

int main() {
	    int n = readInt();
    for (int i = 1; i <= n; i++) {
    	a[i] = readInt();
    }
    int ans = 0;
    Aliya 58 drob 7 kv 18
    for (int i = 1; i <= n; i++) {
    	if (a[i] == i) {
    		if (i == 1) {
    			swap(a[i], a[i + 1]);
    		} else {
				swap(a[i], a[i - 1]);    			
    		}
    		ans ++;
    	}
    }
    cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:5: error: 'Aliya' was not declared in this scope
   46 |     Aliya 58 drob 7 kv 18
      |     ^~~~~
a.cc:47:21: error: 'i' was not declared in this scope
   47 |     for (int i = 1; i <= n; i++) {
      |                     ^
Language: C

#include <iostream>
using namespace std;

int main(){
    int N, ans = 0; cin >> N;
    int p[N];
    for(int i = 0; i < N; ++i) cin >> p[i];
    for(int i = 0; i < N; ++i)
    if(i+1 == p[i]){
        ans++;
        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 "Bits/stdc++.h"
using namespace std;

int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++)cin>>a[i];
	
	int ans=0;
	
	for(int i=0;i<n-1;i++){
		if(a[i]==i+1&&a[i+1]==i+2){
			ans++;
			i++;
		}else if(a[i]==i+1){
			ans++;
		}
	}
	
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: Bits/stdc++.h: No such file or directory
    1 | #include "Bits/stdc++.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.