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

#include <bits/stdc++.h>
using namespace std;
int N[500005];
int main()
{
    int N;
    cin>>N;
    while(N--)
    {
        int a;
        cin>>a;
        N[a]++;
        N[a-1]++;
        N[a+1]++;
    }
    int m=0;
    for(int i=0;i<=500000;i++)
        if(N[i]>m)
            m=N[i];
    cout<<m;
    return 0;
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: invalid types 'int[int]' for array subscript
   12 |         N[a]++;
      |          ^
a.cc:13:10: error: invalid types 'int[int]' for array subscript
   13 |         N[a-1]++;
      |          ^
a.cc:14:10: error: invalid types 'int[int]' for array subscript
   14 |         N[a+1]++;
      |          ^
a.cc:18:13: error: invalid types 'int[int]' for array subscript
   18 |         if(N[i]>m)
      |             ^
a.cc:19:16: error: invalid types 'int[int]' for array subscript
   19 |             m=N[i];
      |                ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char const *argv[]) {
  int N;
  cin >> N;
  vector<int> a(N + 1);
  vector<int> count(10e5 + 2, 0);
  for (int i = 1; i < N + 1; i++) {
    cin >> a[i];
    count[a[i]]++;
    if (a[i] != 0) {
      count[a[i] - 1]++;
    }
    count[a[i] + 1]++;
  }

  int max = 0;
  for (int i = 0; i < 10e5 + 2; i++) {
    max = max > count[i] ? max : count[i];
  }

  cout << max << "\n";
  return 0;
}
```````````

Compiler output:
a.cc:28:1: error: stray '`' in program
   28 | ```````````
      | ^
a.cc:28:2: error: stray '`' in program
   28 | ```````````
      |  ^
a.cc:28:3: error: stray '`' in program
   28 | ```````````
      |   ^
a.cc:28:4: error: stray '`' in program
   28 | ```````````
      |    ^
a.cc:28:5: error: stray '`' in program
   28 | ```````````
      |     ^
a.cc:28:6: error: stray '`' in program
   28 | ```````````
      |      ^
a.cc:28:7: error: stray '`' in program
   28 | ```````````
      |       ^
a.cc:28:8: error: stray '`' in program
   28 | ```````````
      |        ^
a.cc:28:9: error: stray '`' in program
   28 | ```````````
      |         ^
a.cc:28:10: error: stray '`' in program
   28 | ```````````
      |          ^
a.cc:28:11: error: stray '`' in program
   28 | ```````````
      |           ^
Language: Java

import java.util.Scanner;

public class main {
	public static void main(String args[]){
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int arr[][] = new int [3][n];
		int count[] = new int [100002]; 
		
		for(int i = 0 ; i<n ; i++){
			arr[0][i] = scanner.nextInt();
		}
		for(int i = 0 ; i<n ; i++){
			arr[1][i] = arr[0][i]-1;
		}
		for(int i = 0 ; i<n ; i++){
			arr[2][i] = arr[0][i]+1;
		}
		
		for(int i = 0 ; i<3 ; i++){
			for(int j = 0 ; j<n ; j++){
				count[arr[i][j]+1]++;
			}
		}
		
		int max = 0;
		for(int i=0 ; i<count.length ; i++){
			if(count[i]>max){
				max = count[i];
			}
		}
		System.out.println(max);
		
	}
}


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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,a,ans;cin>>n;ll v[100000+1];
  rep(i,n) {cin>>a;v[a]+=1;}
  ans=a[0]+a[1];
  ans=max(ans,a[100000]+a[100000-1]);
  for(ll i=1; i<100000; ++i) {
    ll ans_ = a[i-1]+a[i]+a[i+1];
    ans=max(ans,ans_);
  }
  print(ans);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: invalid types 'long long int[int]' for array subscript
   12 |   ans=a[0]+a[1];
      |        ^
a.cc:12:13: error: invalid types 'long long int[int]' for array subscript
   12 |   ans=a[0]+a[1];
      |             ^
a.cc:13:16: error: invalid types 'long long int[int]' for array subscript
   13 |   ans=max(ans,a[100000]+a[100000-1]);
      |                ^
a.cc:13:26: error: invalid types 'long long int[int]' for array subscript
   13 |   ans=max(ans,a[100000]+a[100000-1]);
      |                          ^
a.cc:15:16: error: invalid types 'long long int[long long int]' for array subscript
   15 |     ll ans_ = a[i-1]+a[i]+a[i+1];
      |                ^
a.cc:15:23: error: invalid types 'long long int[long long int]' for array subscript
   15 |     ll ans_ = a[i-1]+a[i]+a[i+1];
      |                       ^
a.cc:15:28: error: invalid types 'long long int[long long int]' for array subscript
   15 |     ll ans_ = a[i-1]+a[i]+a[i+1];
      |                            ^
Language: C++

N=int(input())
a=list(map(int,input().split()))
l=[]
for i in range(N):
    l.extend([a[i]-1,i,a[i]+1])

import collections
c=collections.Counter(l)

print(c.most_common()[0][1])

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N=int(input())
      | ^
Language: C++

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

int main()
{
  int n;
  cin>>n;
  vector<int> v;
  for(int i=0;i<n;i++)
  	cin>>v[i];
  
  sort(v.begin(),v.end());
  
  map<int,int>mp;
  
  for(int i=0;i<n;i++)
  {
    mp[v[i]]++;
  }
  auto itr2=mp.begin();
  auto itr=mp.begin();
  auto itr3=mp.begin();
  
  
  if(mp.size()==2)
    itr2++
  else if(mp.size()>=3){
  
  itr2++;  
  
    itr3++;
  }
  int max=0;
  
  if(mp.size()>=3){
  	for(;(itr!=mp.end()) && ( itr2!=mp.end()) && ( itr3!=mp.end());itr++)
  	{
    	if((itr->first+1==itr2->first) && (itr2->first+1==itr3->first )  )
    	{
         	if((itr->second + itr2->second +itr3->second )>max  )
            {
              max=itr->second + itr2->second +itr3->second;
            }
    	}
      	else if((itr->first+1)==(itr2->first) )
    	{
      		if((itr->second + itr2->second )>max  )
            {
              max=itr->second + itr2->second ;
            }
        }
      //if( (itr2!=mp.end()))
      itr2++;
      
      //if( (itr3!=mp.end()))
      itr3++;
      
  	}
  
  
  if((itr->first+1)==(itr2->first) )
  {  
    		if((itr->second + itr2->second )>max  )
            {
              max=itr->second + itr2->second ;
            }
    
  } 
    
    
  }
  
  
  
  else if(mp.size()==1)
  	cout<<"1"<<endl;
  else if(mp.size()==2)
  {
    if((itr->first+1)==(itr2->first) )
  	{  
    		if((itr->second + itr2->second )>max  )
            {
              max=itr->second + itr2->second ;
            }
    
  	} 
    
  }
  
  
  cout<<max<<endl;
  
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:26:11: error: expected ';' before 'else'
   26 |     itr2++
      |           ^
      |           ;
   27 |   else if(mp.size()>=3){
      |   ~~~~
Language: C++

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

int main()
{
  int n;
  cin>>n;
  vector<int> v;
  for(int i=0;i<n;i++)
  	cin>>v[i];
  
  sort(v.begin(),v.end());
  
  map<int,int>mp;
  
  for(int i=0;i<n;i++)
  {
    mp[v[i]]++;
  }
  
  auto itr=mp.begin();
  if(mp.size()>=3){
  auto itr2=mp.begin();
  itr2++;  
  auto itr3=mp.begin();
    itr3++
  }
  int max=0;
  
  if(mp.size()>=3){
  	for(;(itr!=mp.end()) && ( itr2!=mp.end()) && ( itr3!=mp.end());itr++)
  	{
    	if((itr->first+1==itr2->first) && (itr2->first+1==itr3->first )  )
    	{
         	if((itr->second + itr2->second +itr3->second )>max  )
            {
              max=itr->second + itr2->second +itr3->second;
            }
    	}
      	else if((itr->first+1)==(itr2->first) )
    	{
      		if((itr->second + itr2->second )>max  )
            {
              max=itr->second + itr2->second ;
            }
        }
      //if( (itr2!=mp.end()))
      itr2++;
      
      //if( (itr3!=mp.end()))
      itr3++;
      
  	}
  
  
  if((itr->first+1)==(itr2->first) )
  {  
    		if((itr->second + itr2->second )>max  )
            {
              max=itr->second + itr2->second ;
            }
    
  } 
    
    
  }
  
  
  
  else if(mp.size()==1)
  	cout<<"1"<<endl;
  else if(mp.size()==2)
  {
    if((itr->first+1)==(itr2->first) )
  	{  
    		if((itr->second + itr2->second )>max  )
            {
              max=itr->second + itr2->second ;
            }
    
  	} 
    
  }
  
  
  cout<<max<<endl;
  
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:26:11: error: expected ';' before '}' token
   26 |     itr3++
      |           ^
      |           ;
   27 |   }
      |   ~        
a.cc:31:35: error: 'itr2' was not declared in this scope; did you mean 'itr'?
   31 |         for(;(itr!=mp.end()) && ( itr2!=mp.end()) && ( itr3!=mp.end());itr++)
      |                                   ^~~~
      |                                   itr
a.cc:31:56: error: 'itr3' was not declared in this scope; did you mean 'itr'?
   31 |         for(;(itr!=mp.end()) && ( itr2!=mp.end()) && ( itr3!=mp.end());itr++)
      |                                                        ^~~~
      |                                                        itr
a.cc:56:23: error: 'itr2' was not declared in this scope; did you mean 'itr'?
   56 |   if((itr->first+1)==(itr2->first) )
      |                       ^~~~
      |                       itr
a.cc:74:25: error: 'itr2' was not declared in this scope; did you mean 'itr'?
   74 |     if((itr->first+1)==(itr2->first) )
      |                         ^~~~
      |                         itr
Language: C++

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

int main()
{
  int n;
  cin>>n;
  vector<int> v;
  for(int i=0;i<n;i++)
  	cin>>v[i];
  
  sort(v.begin(),v.end());
  
  map<int,int>mp;
  
  for(int i=0;i<n;i++)
  {
    mp[v[i]]++;
  }
  
  auto itr=mp.begin();
  if(mp.size()>=3){
  auto itr2=itr++;
  auto itr3=itr2++;
  }
  int max=0;
  
  if(mp.size()>=3){
  	for(;(itr!=mp.end()) && ( itr2!=mp.end()) && ( itr3!=mp.end());itr++)
  	{
    	if((itr->first+1==itr2->first) && (itr2->first+1==itr3->first )  )
    	{
         	if((itr->second + itr2->second +itr3->second )>max  )
            {
              max=itr->second + itr2->second +itr3->second;
            }
    	}
      	else if((itr->first+1)==(itr2->first) )
    	{
      		if((itr->second + itr2->second )>max  )
            {
              max=itr->second + itr2->second ;
            }
        }
      //if( (itr2!=mp.end()))
      itr2++;
      
      //if( (itr3!=mp.end()))
      itr3++;
      
  	}
  
  
  if((itr->first+1)==(itr2->first) )
  {  
    		if((itr->second + itr2->second )>max  )
            {
              max=itr->second + itr2->second ;
            }
    
  } 
    
    
  }
  
  
  
  else if(mp.size()==1)
  	cout<<"1"<<endl;
  else if(mp.size()==2)
  {
    if((itr->first+1)==(itr2->first) )
  	{  
    		if((itr->second + itr2->second )>max  )
            {
              max=itr->second + itr2->second ;
            }
    
  	} 
    
  }
  
  
  cout<<max<<endl;
  
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:29:35: error: 'itr2' was not declared in this scope; did you mean 'itr'?
   29 |         for(;(itr!=mp.end()) && ( itr2!=mp.end()) && ( itr3!=mp.end());itr++)
      |                                   ^~~~
      |                                   itr
a.cc:29:56: error: 'itr3' was not declared in this scope; did you mean 'itr'?
   29 |         for(;(itr!=mp.end()) && ( itr2!=mp.end()) && ( itr3!=mp.end());itr++)
      |                                                        ^~~~
      |                                                        itr
a.cc:54:23: error: 'itr2' was not declared in this scope; did you mean 'itr'?
   54 |   if((itr->first+1)==(itr2->first) )
      |                       ^~~~
      |                       itr
a.cc:72:25: error: 'itr2' was not declared in this scope; did you mean 'itr'?
   72 |     if((itr->first+1)==(itr2->first) )
      |                         ^~~~
      |                         itr
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
signed main(){
  int N,top=0,small=MOD;
  cin>>N;
  vi A(N);
  rep(i,0,N){
    cin>>A[i];
    top=max(top,A[i]);
    small=min(small,A[i]);
    }
  sort(ALL(A));
  int ans=0;
  REP(X,small,top){
    int count=distance(A.begin(),upper_bound(ALL(A)),X+1))-distance(A.begin(),lower_bound(ALL(A)),X-1));
    ans=max(count,ans);
    }
  cout<<ans<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:24:45: error: no matching function for call to 'upper_bound(std::vector<long long int>::iterator, std::vector<long long int>::iterator)'
   24 |     int count=distance(A.begin(),upper_bound(ALL(A)),X+1))-distance(A.begin(),lower_bound(ALL(A)),X-1));
      |                                  ~~~~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:2019:5: note: candidate: 'template<class _FIter, class _Tp> _FIter std::upper_bound(_FIter, _FIter, const _Tp&)'
 2019 |     upper_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2019:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:2050:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::upper_bound(_FIter, _FIter, const _Tp&, _Compare)'
 2050 |     upper_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2050:5: note:   candidate expects 4 arguments, 2 provided
Language: C++

n = int(input())
l = list(map(int,input().split()))

a = []

for i in range(n):
	a.append(l[i]-1)
	a.append(l[i])
	a.append(l[i]+1)

maxnum = 0

b = list(set(a))

for i in range(len(b)):
	if maxnum < a.count(b[i]):
		maxnum = a.count(b[i])
print(maxnum)


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

n = int(input())
l = list(map(int,input().split()))

a = []

for i in range(n):
	a.append(l[i]-1)
	a.append(l[i])
	a.append(l[i]+1)

#print(a)

maxnum = 0

b = list(set(a))

for i in range(len(b)):
	if maxnum < a.count(b[i]):
		maxnum = a.count(b[i])
print(maxnum)


Compiler output:
a.cc:11:2: error: invalid preprocessing directive #print
   11 | #print(a)
      |  ^~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

n = int(input())
l = list(map(int,input().split()))

a = []

for i in range(n):
	a.append(l[i]-1)
	a.append(l[i])
	a.append(l[i]+1)

#print(a)

maxnum = 0

b = list(set(a))

for i in range(len(b)):
	if maxnum < a.count(b[i]):
		maxnum = a.count(b[i])

print(maxnum)


Compiler output:
a.cc:11:2: error: invalid preprocessing directive #print
   11 | #print(a)
      |  ^~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//コピペするとこ



//-------------------------------------------------


int main()
{
  vector<int> arr(100000+3) ;
  int n ;
  cin >> n ;
  REP(i,n){
    int m ;
    cin >> m ;
    arr.at(m)++ ;
    arr.at(m+1)++ ;
    arr.at(m+2)++ ;
  }
  int max = 0 ;
  REP(i,100000+3){
    max = max(max,arr.at(i)) ;
  }
  
  cout <<max <<endl;
    
  return 0 ;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:51:14: error: 'max' cannot be used as a function
   51 |     max = max(max,arr.at(i)) ;
      |           ~~~^~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

int main(int argc,char* argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll n;cin>>n;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    sort(all(a));

    ll max = 0;
    ll smaller=0, greater=0,equal = 0;

    ll i = 0;
    ll x;
    while (i < n)
    {
        x = a[i];
        while (a[i] == x)
        {
            i++;
            equal++;
        }
        ll j = i;
        while (a[j] - x == 1)
        {
            j++;
            greater++;
        }
        if (smaller + equal + greater > max)
            max = smaller + equal + greater;
        if(a[i]-x==1)smaller = equal;
        else smaller = 0;
        greater = 0;
        equal = 0;
    }

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:47:6: error: expected '}' at end of input
   47 |     }
      |      ^
a.cc:13:1: note: to match this '{'
   13 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
const long long INF = 1LL << 60;
int main() 
{
    int n;
    cin >> n;
    long long a[n+10],b[100100],mini,rep=1;

    rep(i,100100){
        b[i]=0;
    }

    rep(i,n){
        cin >> a[i];
        b[a[i]]++;
    }

    rep(i,100000){
            mini = b[i]+b[i+1]+b[i+2];
            rep = max(rep,mini);
        }
    }

    cout << rep << endl;


}

Compiler output:
a.cc:27:5: error: 'cout' does not name a type
   27 |     cout << rep << endl;
      |     ^~~~
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
Language: C++

#include <iostream>

using namespace std;

int N;

int main() {
    cin >> N;
    int *A;
    A = (int *) malloc(sizeof(int) * N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    sort(A, A + N);
//    for (int i = 0; i < N; i++) {
//        cout << A[i] << endl;
//    }
    int cnt = 0;
    int max_cnt = cnt;
    for (int i = 0; i < N; i++) {
        for (int j = 1; j < N; j++) {
            if (A[i] == A[j] || A[j] - A[i] == 1) {
                cnt++;
            } else {
                break;
            }
        }
        if (max_cnt < cnt){
            max_cnt = cnt;
        }
    }
    if (cnt == 0){
        max_cnt = 1;
    }
    cout << max_cnt << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |     sort(A, A + N);
      |     ^~~~
      |     short
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[] x = new int[100001];
      for(int i = 0;i < n;i++){
      	int a = sc.nextInt();
        if(a==0){
        	x[0]++;
            x[1]++;
        }else if(a==100000){
        	x[99999]++;
            x[100000]++;
        }else{
        	x[a-1]++;
        	x[a]++;
        	x[a+1]++;
        }
      }
      int max = 0;
      for(int i = 0;i < 100000)max = Math.max(max,x[i]);
      System.out.println(max);
    }
}

Compiler output:
Main.java:22: error: ';' expected
      for(int i = 0;i < 100000)max = Math.max(max,x[i]);
                              ^
1 error
Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int N; cin >> N;
  vi a(N); REP(i,N) cin >> a[i];

  int cnt[1e5+1];
  REP(i,N) {
    cnt[a[i]]++;
  }

  int ans = 0;
  REP(X,1e5+1) {
    ans = max(ans, cnt[X-1]+cnt[X]+cnt[X+1]);
  }

  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:14: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   43 |   int cnt[1e5+1];
      |           ~~~^~
a.cc:43:14: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
   43 |   int cnt[1e5+1];
      |           ~~~^~
      |              |
      |              double
a.cc:43:14: error: size of array 'cnt' has non-integral type 'double'
Language: C++

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

int main() {
  int n;
  cin >> n;
  
  int i, a;
  vector<int> x(100000);
  for(i = 0; i < n; i++){
    cin >> a;
    x.at(a - 1)++;
  }
  
  int ans = 0;
  for(i = 0; i < n - 2; i++){
    ans = max(ans, x.at(i) + x.at(i + 1) + x.at(i + 2);
  }
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:55: error: expected ')' before ';' token
   17 |     ans = max(ans, x.at(i) + x.at(i + 1) + x.at(i + 2);
      |              ~                                        ^
      |                                                       )
Language: C++

#入力
n=int(input())
A=list(map(int,input().split()))
#答え
ans=0

#空のリスト作成
b=[0]*(10**5+1)

#与えられた数列Aに含まれる数aiの順番にあるリストｂiを+１して、aiの個数のリストにする。
for i in A:
    b[i]+=1

#0から最大の10＊＊5まで調べる。ある数の前後プラス・マイナス１に含まれる数の個数が
#最大になるものを探す。それをXとすれば、答えが最大となる。
for i in range(10**5+1):
    if ans < sum(b[i:i+3]):
        ans=sum(b[i:i+3])

print(ans)

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #\U00005165\U0000529b
    1 | #入力
      |  ^~~~
a.cc:4:2: error: invalid preprocessing directive #\U00007b54\U00003048
    4 | #答え
      |  ^~~~
a.cc:7:2: error: invalid preprocessing directive #\U00007a7a\U0000306e\U000030ea\U000030b9\U000030c8\U00004f5c\U00006210
    7 | #空のリスト作成
      |  ^~~~~~~~~~~~~~
a.cc:10:2: error: invalid preprocessing directive #\U00004e0e\U00003048\U00003089\U0000308c\U0000305f\U00006570\U00005217A\U0000306b\U0000542b\U0000307e\U0000308c\U0000308b\U00006570ai\U0000306e\U00009806\U0000756a\U0000306b\U00003042\U0000308b\U000030ea\U000030b9\U000030c8\U0000ff42i\U00003092
   10 | #与えられた数列Aに含まれる数aiの順番にあるリストｂiを+１して、aiの個数のリストにする。
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:10:55: error: extended character 、 is not valid in an identifier
   10 | #与えられた数列Aに含まれる数aiの順番にあるリストｂiを+１して、aiの個数のリストにする。
      |                                                       ^
a.cc:10:55: error: extended character 。 is not valid in an identifier
a.cc:14:2: error: extended character 。 is not valid in an identifier
   14 | #0から最大の10＊＊5まで調べる。ある数の前後プラス・マイナス１に含まれる数の個数が
      |  ^
a.cc:14:2: error: "0から最大の10＊＊5まで調べる。ある数の前後プラス・マイナス１に含まれる数の個数が" after # is not a positive integer
   14 | #0から最大の10＊＊5まで調べる。ある数の前後プラス・マイナス１に含まれる数の個数が
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:15:2: error: extended character 。 is not valid in an identifier
   15 | #最大になるものを探す。それをXとすれば、答えが最大となる。
      |  ^
a.cc:15:2: error: extended character 、 is not valid in an identifier
a.cc:15:2: error: extended character 。 is not valid in an identifier
a.cc:15:2: error: invalid preprocessing directive #\U00006700\U00005927\U0000306b\U0000306a\U0000308b\U00003082\U0000306e\U00003092\U000063a2\U00003059\U00003002\U0000305d\U0000308c\U00003092X\U00003068\U00003059\U0000308c\U00003070\U00003001\U00007b54\U00003048\U0000304c\U00006700\U00005927\U00003068\U0000306a\U0000308b\U00003002
   15 | #最大になるものを探す。それをXとすれば、答えが最大となる。
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:2:1: error: 'n' does not name a type
    2 | n=int(input())
      | ^
Language: C++

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] count = new int[100000];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            count[a[i]]++;
        }
        Arrays.sort(count);
        int max = count[0] + count[1] + count[2];
        for (int i = 2; i < 99999; i++) {
            if (max < count[i - 1] + count[i] + count[i + 1])
                max = count[i - 1] + count[i] + count[i + 1];
        }
        System.out.println(max);
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long

void solve() {
    int N; cin >> N;
    int a[100100];
    map<int, int> mp;
    rep(i, N) {
        cin >> a[i];
        mp[a[i]] ++;
    }
    int res = 0;
    for(auto p ; mp) {
        int n = p.fr;
        int cnt = mp[n - 1] + mp[n] + mp[n + 1];
        if(cnt >= res) res = cnt;
    }
    cout << res << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:58:9: error: declaration of 'auto p' has no initializer
   58 |     for(auto p ; mp) {
      |         ^~~~
a.cc:58:18: error: could not convert 'mp' from 'std::map<int, int>' to 'bool'
   58 |     for(auto p ; mp) {
      |                  ^~
      |                  |
      |                  std::map<int, int>
a.cc:58:20: error: expected ';' before ')' token
   58 |     for(auto p ; mp) {
      |                    ^
      |                    ;
Language: C++

#include <bits/stdc++>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> da(n),co(100005,0);
  for(int i=0;i<n;i++){
    cin >> da[i];
    for(int j=0;j<3;j++){
      co[j+da[i]]++;
    }
  }
  int ans=0;
  for(int i=0;i<100005;i++){
    ans=max(ans,da[i]);
  }
  cout << ans << endl;
}

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

#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
  int N;
  cin >> N;
  map<int , int> m;
  for(int i = 0; i < N; i++) {
    int a;
    cin >> a;
    m[a]++;
  }
  
  ans = 0;
  for(auto iter = m.begin(); iter != m.end(); iter++){
    int tmp = m[iter->first - 1] + m[iter->first] + m[iter->first + 1];
    if(tmp > ans) ans = tmp;
  }
  cout << ans;
}


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

#include <iostream>
#include <vector>
#include <map>

int main(){
  int N;
  cin >> N;
  map<int , int> m;
  for(int i = 0; i < N; i++) {
    int a;
    cin >> a;
    m[a]++;
  }
  
  ans = 0;
  for(auto iter = m.begin(); iter != m.end(); iter++){
    int tmp = m[iter->first - 1] + m[iter->first] + m[iter->first + 1];
    if(tmp > ans) ans = tmp;
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   cin >> N;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:3: error: 'map' was not declared in this scope
    8 |   map<int , int> m;
      |   ^~~
a.cc:8:3: note: suggested alternatives:
In file included from /usr/include/c++/14/map:63,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_map.h:102:11: note:   'std::map'
  102 |     class map
      |           ^~~
/usr/include/c++/14/map:89:13: note:   'std::pmr::map'
   89 |       using map
      |             ^~~
a.cc:8:7: error: expected primary-expression before 'int'
    8 |   map<int , int> m;
      |       ^~~
a.cc:12:5: error: 'm' was not declared in this scope
   12 |     m[a]++;
      |     ^
a.cc:15:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |   ans = 0;
      |   ^~~
      |   abs
a.cc:16:19: error: 'm' was not declared in this scope
   16 |   for(auto iter = m.begin(); iter != m.end(); iter++){
      |                   ^
a.cc:20:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   20 |   cout << ans;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
typedef long long ll;
using namespace std;
#define mod 1000000007


int main(){
    int n;cin >> n;
    vector<int>a(100001);
    vector<int>b(100001,0);
    for(int i=0;i<n;i++){
        cin >> a[i];
        b[a[i]-1]++;
        b[a[i]]++;
        b[a[i]+1]++;
    }
    int max=0;
   /* for(int x:b){
        if(x>max)max=x;
    }
    */
    for(int i=0; i<=100000; i++)
    {
        if(b[i]>mx)
        {
            mx=b[i];
        }
    }
    cout << max << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: 'mx' was not declared in this scope; did you mean 'max'?
   35 |         if(b[i]>mx)
      |                 ^~
      |                 max
Language: C

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

int main()
{
	int n,x[100005];
	memset(x,0,sizeof(x));
	cin >> n;
	int a[n],max = 0;
	
	for(int i = 0;i < n;i++){
		cin >> a[i];
		if(a[i] > max) max = a[i];
		x[a[i] - 1]++;
		x[a[i]]++;
		x[a[i] + 1]++;
	}
	
	int max2 = 0;
	for(int i = 0;i <= max + 1;i++){
		if(x[i] > max2) max2 = x[i];
	}
	cout << max2;
	return 0;
}

Compiler output:
main.c:1:10: 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 a[100000],b[100000];
main(){
	int n;
	cin>>n;
	m=0;
	memset(b,0,sizeof(b));
	for(int i=0;i<n;i++){
		cin>>a[i];
		b[a[i]]++;
		m=max(m,a[i]);
	}
	int cnt=0;
	for(int i=0;i<m;i++){
		cnt=max(cnt,b[i]+b[i+1]+b[i+2]);
	}
	cout<<cnt<<endl;
}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'm' was not declared in this scope
    7 |         m=0;
      |         ^
Language: C

#include<bits/stdc++.h>
using namespace std;
int a[100000],b[100000];
main(){
	int n;
	cin>>n;
	m=0;
	memset(b,0,sizeof(b));
	for(int i=0;i<n;i++){
		cin>>a[i];
		b[a[i]]++;
		m=max(m,a[i]);
	}
	int cnt=0;
	for(int i=0;i<m;i++){
		cnt=max(cnt,b[i]+b[i+1]+b[i+2]);
	}
	cout<<cnt<<endl;
}

Compiler output:
main.c: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;
main(){
	int n;
	cin>>n;
	int a[10000],b[10000],m=0;
	memset(b,0,sizeof(b));
	for(int i=0;i<n;i++){
		cin>>a[i];
		b[a[i]]++;
		m=max(m,a[i]);
	}
	int cnt=0;
	for(int i=0;i<m;i++){
		cnt=max(cnt,b[i]+b[i+1]+b[i+2]);
	}
	cout<<cnt<<endl;
}

Compiler output:
main.c: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=100010;
int main()
{
	int a[N]={0};
	int n;
	cin >> n;
	int b[m+10];
	for(int i=0;i<n;i++)
	{
		scanf("%d",&b[i]);
	}
	for(int i=0;i<n;i++)
	{
		a[b[i]+1]++;
		a[b[i]]++;
		a[b[i]-1]++;
	}
	int p=0;
	for(int i=0;i<N;i++)
		if(a[i]>p)p=a[i];
	cout << p <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: 'm' was not declared in this scope
    9 |         int b[m+10];
      |               ^
a.cc:12:29: error: 'b' was not declared in this scope
   12 |                 scanf("%d",&b[i]);
      |                             ^
a.cc:16:19: error: 'b' was not declared in this scope
   16 |                 a[b[i]+1]++;
      |                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[100005]={0};
int main()
{
	int n;
	cin>>n;
	while(n--)
	{
		int b;
		scanf("%d",&b);
		a[b]++;
		a[b+1]++;
		a[b-1]++;
	}
	int max=0;
	for(int i=1;i<=100000,i++)
	{
		if(a[i]>max)
		max=a[i];
	}
	printf("%d",max);
	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:34: error: expected ';' before ')' token
   17 |         for(int i=1;i<=100000,i++)
      |                                  ^
      |                                  ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,s[100101],maxn=-1;
    cin>>n;
    for(int i=1;i<=n;i++){
        s[i]++;
        s[i-1++;
        s[i+1]++;
    }for(int i=1;i<=n;i++){
        maxn=max(maxn,s[i]);
    }cout<<maxn<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: lvalue required as increment operand
    8 |         s[i-1++;
      |             ^
a.cc:8:16: error: expected ']' before ';' token
    8 |         s[i-1++;
      |                ^
      |                ]
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int c[1e5];
    rep(i, 1e5) {
        c[i] = 0;
    }
    rep(i, n) {
        int a;
        cin >> a;
        c[a]++;
    }

    int ans = 0;
    for(int i = 1; i <= 1e5 - 2; i++) {
        int t = c[i-1] + c[i] + c[i+1];
        ans = max(ans, t);
    }
    
    cout << ans;

    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   14 |     int c[1e5];
      |           ^~~
a.cc:14:11: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
   14 |     int c[1e5];
      |           ^~~
      |           |
      |           double
a.cc:14:11: error: size of array 'c' has non-integral type 'double'
Language: C++

int main() {
  int n;
  int min;
  int inp[100100];
  int kazu[100100];
  int tog[100100];
  int ans;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> inp[i];
    kazu[i] = 0;
  }
  
  for(int i = 0; i < 100010; i++){
    kazu[i] = 0;
      }

  for(int i = 0; i < n; i++){
    int a;
    a = inp[i];
    kazu[a] = kazu[a] + 1;
      }
 
 ans = kazu[0] + kazu[1];
 
 for(int i = 1; i < 100001; i++){
       int b;
       b = ans;
    if(kazu[i - 1] + kazu[i] + kazu[i + 1] > b){
       ans = kazu[i - 1] + kazu[i] + kazu[i + 1];
    }
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope; did you mean 'min'?
    8 |   cin >> n;
      |   ^~~
      |   min
a.cc:33:3: error: 'cout' was not declared in this scope
   33 |   cout << ans;
      |   ^~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
  int n;
  std::cin >> n;
  std::vector<int> a(n),b(100005,0);
  rep(i,n)std::cin >> a[i];
  rep(i,n)b[a[i]+1]++;
  int ma=0,mal=0;
  for (int i = 1; i < 100005; i++) {
    /* code */
    int c;
    c=b[i-1]+b[i]+b[i+1];
    if(ma<c){ma=c;mal=i+1;}
  }
  std::cout <<ma  << std::endl;
  
  
}

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

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
const int INF = 1e9;
const long long LINF = 1e18;


int main(){
  int N;cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  vector<int> b(1e5+1);
  for(int i = 0; i < 1e5+1; i++){
    b[a[i]]++;
  }
  int cnt = 0;
  int ans = 0;
  for(int i = 1; i < 1e5; i++){
    else cnt += b[i-1] + b[i] + b[i+1];
    ans = max(ans,cnt);
  }
  cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'else' without a previous 'if'
   23 |     else cnt += b[i-1] + b[i] + b[i+1];
      |     ^~~~
Language: C++

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

int main(){
  int a,b,c,d,ans,sum;
cin>>a;
  vector<int>b(a),c(100001);
    for(int i=0;i<a;i++){
 cin>>b[i];
      c[b[i]]++;
  }
ans=0;

  for(int i=1;i<100000;i++){
     sum=c[i-1]+c[i]+c[i+1]; 
 ans=max(sum,ans);
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: conflicting declaration 'std::vector<int> b'
    8 |   vector<int>b(a),c(100001);
      |              ^
a.cc:6:9: note: previous declaration as 'int b'
    6 |   int a,b,c,d,ans,sum;
      |         ^
a.cc:8:19: error: conflicting declaration 'std::vector<int> c'
    8 |   vector<int>b(a),c(100001);
      |                   ^
a.cc:6:11: note: previous declaration as 'int c'
    6 |   int a,b,c,d,ans,sum;
      |           ^
a.cc:10:8: error: invalid types 'int[int]' for array subscript
   10 |  cin>>b[i];
      |        ^
a.cc:11:10: error: invalid types 'int[int]' for array subscript
   11 |       c[b[i]]++;
      |          ^
a.cc:16:11: error: invalid types 'int[int]' for array subscript
   16 |      sum=c[i-1]+c[i]+c[i+1];
      |           ^
a.cc:16:18: error: invalid types 'int[int]' for array subscript
   16 |      sum=c[i-1]+c[i]+c[i+1];
      |                  ^
a.cc:16:23: error: invalid types 'int[int]' for array subscript
   16 |      sum=c[i-1]+c[i]+c[i+1];
      |                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)

int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i, n) cin >> a[i];
  sort(a, a+n);
  int ans = 0;
  rep(pos, a[n-1]) ans = max(ans, upper_bound(a,a+n,pos+1)-lower_bound(a,a+n,pos-1));
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:29: error: no matching function for call to 'max(int&, long int)'
   12 |   rep(pos, a[n-1]) ans = max(ans, upper_bound(a,a+n,pos+1)-lower_bound(a,a+n,pos-1));
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:12:29: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   12 |   rep(pos, a[n-1]) ans = max(ans, upper_bound(a,a+n,pos+1)-lower_bound(a,a+n,pos-1));
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:12:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   12 |   rep(pos, a[n-1]) ans = max(ans, upper_bound(a,a+n,pos+1)-lower_bound(a,a+n,pos-1));
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: Java

import java.util.*;
 
class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[100_000];
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
            b[a[i]]++;
        }
        
        int max = 0;
        for(i=1; i<100_000; i++){
            if(max<b[i-1]+b[i]+b[i+1]){
                max=b[i-1]+b[i]+b[i+1];
            }
        }
        System.out.println(max);
    }
}

Compiler output:
Main.java:15: error: cannot find symbol
        for(i=1; i<100_000; i++){
            ^
  symbol:   variable i
  location: class Main
Main.java:15: error: cannot find symbol
        for(i=1; i<100_000; i++){
                 ^
  symbol:   variable i
  location: class Main
Main.java:15: error: cannot find symbol
        for(i=1; i<100_000; i++){
                            ^
  symbol:   variable i
  location: class Main
Main.java:16: error: cannot find symbol
            if(max<b[i-1]+b[i]+b[i+1]){
                     ^
  symbol:   variable i
  location: class Main
Main.java:16: error: cannot find symbol
            if(max<b[i-1]+b[i]+b[i+1]){
                            ^
  symbol:   variable i
  location: class Main
Main.java:16: error: cannot find symbol
            if(max<b[i-1]+b[i]+b[i+1]){
                                 ^
  symbol:   variable i
  location: class Main
Main.java:17: error: cannot find symbol
                max=b[i-1]+b[i]+b[i+1];
                      ^
  symbol:   variable i
  location: class Main
Main.java:17: error: cannot find symbol
                max=b[i-1]+b[i]+b[i+1];
                             ^
  symbol:   variable i
  location: class Main
Main.java:17: error: cannot find symbol
                max=b[i-1]+b[i]+b[i+1];
                                  ^
  symbol:   variable i
  location: class Main
9 errors
Language: C++

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ld long double
#define ii pair<ll,ll>;
#define vi vector<int>;
#define ll long long int
#define ook order_of_key
#define fbo find_by_order
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i = a; i < b; i++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
int main(){
    IOS
    //io_set();
    ll n, i, ans = INT_MIN;
    cin >> n;
    ll a[n];
    for(i = 0; i < n; i++){
        cin >> a[i];
    }
    if(n == 1){
        cout << 1 << endl;
        return 0;
    }
    sort(a,a+n);
    for(i=0;i<n;i++){
        x = (upper_bound(a,a+n,a[i]+2)-(a+i));
        //cout << x << endl;
        ans = max(x,ans);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:9: error: 'x' was not declared in this scope
   41 |         x = (upper_bound(a,a+n,a[i]+2)-(a+i));
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
 
int N, a;
  cin >> N;
int d[100010] = {};
int ma = 0;  
 
  for(int i = 0;i< N;i++){
  cin >> a;
    if(a > ma) ma = a;
    d[a]++;
  }
  
int ans = 0;
  if(ma == 0) cout << a[0] << endl;
  else{
  for(int i = 1;i <= ma;i++){
  ans = max(ans,d[i-1] + d[i] + d[i+1]);
    }
  }
  
  
  cout << ans << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:24: error: invalid types 'int[int]' for array subscript
   18 |   if(ma == 0) cout << a[0] << endl;
      |                        ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,tmp;cin>>n;
  vector<int>a(1e5+2,0);
  for(int i=0;i<n;i++)cin>>tmp,a[tmp-1]++,a[tmp]++,a[tmp+1]++;
  cout<<*max_element(a.begin(),a.end())<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'max_element' was not declared in this scope
    8 |   cout<<*max_element(a.begin(),a.end())<<endl;
      |          ^~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
  int n; cin >> n;
  
  vector<int> cnt(100000);
  for (int i = 0; i < n; i++) {
    int a; cin >> a;
    cnt[a]++;
  }
  
  int ans = 0;
  for (int i = 1; i < 100000; i++) {
    ans = max(ans, cnt[i - 1] + cnt[i] + cnt[i + 1]);
  }
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> cnt(100000);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> cnt(100000);
      |          ^~~
a.cc:10:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
   10 |     cnt[a]++;
      |     ^~~
      |     int
a.cc:15:20: error: 'cnt' was not declared in this scope; did you mean 'int'?
   15 |     ans = max(ans, cnt[i - 1] + cnt[i] + cnt[i + 1]);
      |                    ^~~
      |                    int