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

#include<bits/stdc++.h>
#define size(a) (int)a.size()
#define int long long
#define F first
#define S second
#define pb push_back
using namespace std;
void null(){return ;}
const int maxn=3e5+7,INF=3e18+9237,mod=1e9+7;
string s,t;

int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  cin»s;
  for(int i=0;i<size(s);i++){
    if(i%2==0)t+=s[i];
  }
  cout«t;
}

Compiler output:
a.cc:14:3: error: extended character » is not valid in an identifier
   14 |   cin»s;
      |   ^
a.cc:18:3: error: extended character « is not valid in an identifier
   18 |   cout«t;
      |   ^
a.cc: In function 'int32_t main()':
a.cc:14:3: error: 'cin\U000000bbs' was not declared in this scope
   14 |   cin»s;
      |   ^~~~~
a.cc:18:3: error: 'cout\U000000abt' was not declared in this scope
   18 |   cout«t;
      |   ^~~~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <algorithm>
#include <climits>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <ctime>
#include <cstdlib>
#include <iterator>
using namespace std;

//#define TEST
int main()
{
#ifdef TEST
	freopen("data.in", "r", stdin);
	freopen("data.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	string str;
	while(cin >> str) {
		for (int i = 0; i < str.legth(); i += 2) {
			cout<< str[i];
		}
		cout << endl;
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:41: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'legth'; did you mean 'length'?
   30 |                 for (int i = 0; i < str.legth(); i += 2) {
      |                                         ^~~~~
      |                                         length
Language: C++

#include <iostream>
#include <string>
using namespace std;
string s,t;
int32_t main(){
  cin»s;
  for(int i=0;i<size(s);i++){
    if(i%2==0)t+=s[i];
  }
  cout«t;
}

Compiler output:
a.cc:6:3: error: extended character » is not valid in an identifier
    6 |   cin»s;
      |   ^
a.cc:10:3: error: extended character « is not valid in an identifier
   10 |   cout«t;
      |   ^
a.cc: In function 'int32_t main()':
a.cc:6:3: error: 'cin\U000000bbs' was not declared in this scope
    6 |   cin»s;
      |   ^~~~~
a.cc:10:3: error: 'cout\U000000abt' was not declared in this scope
   10 |   cout«t;
      |   ^~~~~~
Language: C++

#include <stdio.h>
#include <string.h>

int main() {
  int len,string_len = 1e5 + 1;
  char s[];
  char h[];
  scanf("%s%",&s);
  len = strlen(s);
  for(int i=1;i<len;i=i+2){
    strcat(h,s[i]);
  }
  printf("%s",h);
  return 0;
}
        


Compiler output:
a.cc: In function 'int main()':
a.cc:6:8: error: storage size of 's' isn't known
    6 |   char s[];
      |        ^
a.cc:7:8: error: storage size of 'h' isn't known
    7 |   char h[];
      |        ^
Language: C++

#include <stdio.h>
#include <string.h>

int main() {
  char s[1e5+1];
  char h[];
  scanf("%s%",&s);
  len = strlen(s);
  for(int i=1;i<len;i=i+2){
    strcat(h,s[i]);
  }
  printf("%s",h);
  return 0;
}
        

Compiler output:
a.cc: In function 'int main()':
a.cc:5:13: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    5 |   char s[1e5+1];
      |          ~~~^~
a.cc:5:13: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
    5 |   char s[1e5+1];
      |          ~~~^~
      |             |
      |             double
a.cc:5:13: error: size of array 's' has non-integral type 'double'
a.cc:6:8: error: storage size of 'h' isn't known
    6 |   char h[];
      |        ^
a.cc:8:3: error: 'len' was not declared in this scope
    8 |   len = strlen(s);
      |   ^~~
Language: C

#include<stdio.h>
#include<conio.h>
int main(void)
{
  int i;
  char s[100000];
  for(i=0;s[i];i++){
    s[i]=getche();
  }
  for(i=0;s[i];i+=2){
    printf("%c",s[i]);
  }
  
  return 0;
}

Compiler output:
main.c:2:9: fatal error: conio.h: No such file or directory
    2 | #include<conio.h>
      |         ^~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
int main(void)
{
  int i;
  char s[100000];
  for(i=0;s[i];i++){
    s[i]=getche();
  }
  for(i=0;s[i];i+=2){
    printf("%c",s[i]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:10: error: implicit declaration of function 'getche'; did you mean 'getchar'? [-Wimplicit-function-declaration]
    7 |     s[i]=getche();
      |          ^~~~~~
      |          getchar
Language: C++

#include <iosteam>
#include <string>
int main(){
  std::string str;
  std::cin >> str;
  
  for(int i =0; i < str.length();i++){
  	if(i%2 == 0){
    	std::cout << str[i];
    }
  }
	return 0;
}

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

#include<stdio.h>
#include <string.h>

int main(){
  int i;
  char s[101],p[101];
  scanf("%s",s);
  len = strlen(s);
  while(i <= len) {
    p[i] = s[i+1];
    i++;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'len' was not declared in this scope
    8 |   len = strlen(s);
      |   ^~~
Language: C++

#include <cstdio>
 
int main ()
{
    char c;
    int i=0;
    while (scanf("%c",&c)!=EOF)
  {
    i++;
    if (c=='\n');
    {
        printf("\n");
        i=0;
        continue;
    }
    if (i%2!=0)
      printf("%c",c);
  }
  return 0;
}
Submission

Compiler output:
a.cc:21:1: error: 'Submission' does not name a type
   21 | Submission
      | ^~~~~~~~~~
Language: C++

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

int main(){
  string s
  cin >> s;

  for(int i = 0; i < s.size(); i++){
    if(i%2 == 0){
      cout << s[i];
    }
  }
  cout << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected initializer before 'cin'
    7 |   cin >> s;
      |   ^~~
a.cc:9:22: error: 's' was not declared in this scope
    9 |   for(int i = 0; i < s.size(); i++){
      |                      ^
Language: C++

#include<iostream>
using namespace std;

const int MAX_N = 100000;
char s[MAX_N];
string t;
int len;

void solve() {
  len = strlen(s);
  for (int i = 0; i < len; i++){
    if (i % 2 == 0) {
      t.push_back(s[i]);
    }
  }
  cout << t << endl;
  
}

int main() {
  cin >> s ;

  solve();

  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:10:9: error: 'strlen' was not declared in this scope
   10 |   len = strlen(s);
      |         ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include<stdio.h>
int main()
{
    char s;
    scanf("%s",s);
    for(int i=0;s[i];i++)
        if(i%2==0)
        printf("%c",s[i]);
    printf("\n");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:18: error: invalid types 'char[int]' for array subscript
    6 |     for(int i=0;s[i];i++)
      |                  ^
a.cc:8:22: error: invalid types 'char[int]' for array subscript
    8 |         printf("%c",s[i]);
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	string s;
	while (cin >> s) {
		int len = s.length();
		for (int i = 0, i < len; ++i)
			if (i % 2 == 0) cout << s[i];
		cout << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:8:34: error: expected ';' before '<' token
    8 |                 for (int i = 0, i < len; ++i)
      |                                  ^~
      |                                  ;
a.cc:8:35: error: expected primary-expression before '<' token
    8 |                 for (int i = 0, i < len; ++i)
      |                                   ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

char s[100000+10];
int len;

int main()
{
    gets(s);
    len=strlen(s);
    for(int i=0;i<=len-1;i=i+2)
    {
        cout<<s[i];
    }
    return 0;

}


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

#include<iostream>
#include<string>

using namespace std;

int main()
{
 string s;
 cin >> s;

 string out;
 for(int i = 0;i < s.length();i +=2)
 {
  out.pushback(s[i]);
 }

 cout << out << endl;

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pushback'; did you mean 'push_back'?
   14 |   out.pushback(s[i]);
      |       ^~~~~~~~
      |       push_back
Language: C++

#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++++)
	{
		cout<<s[i]; 
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:35: error: lvalue required as increment operand
   62 |         for(int i=0;i<s.length();i++++)
      |                                  ~^~
Language: C++

#include <cmath>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int a,b,n;
char str[1000000]
int main()
{
    scanf("%s",str);
    n=strlen(str);
    for (int i=0;i<n;i++)
    {
    	if (i%2==0) printf("%d",str[i]);
    }
}

Compiler output:
a.cc:9:1: error: expected initializer before 'int'
    9 | int main()
      | ^~~
Language: C++

#include<iostream>
#include<String>
using namespace std;
 
int main() {
    string s;
    cin >> s;
    for(int i = 0; i<s.length(); i = i+2){
        cout << s[i];
    }
    cout << endl;
    
    return 0;
}


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

#include<stdio.h>
#include<string.h>

int main(){
	char s[1000000];
	char ans[10000] = {""};
	int i,len;

	
	scanf("%s", &s);
	ans[0] = s[1];
	len = strlen(s);
	for (i = 2; i < len; i++){
		if (i % 2 == 1){
			strcat(ans[i], s[i]);
		}
	}
	printf("%s", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:37: error: invalid conversion from 'char' to 'char*' [-fpermissive]
   15 |                         strcat(ans[i], s[i]);
      |                                ~~~~~^
      |                                     |
      |                                     char
In file included from a.cc:2:
/usr/include/string.h:149:39: note:   initializing argument 1 of 'char* strcat(char*, const char*)'
  149 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
      |                      ~~~~~~~~~~~~~~~~~^~~~~~
a.cc:15:43: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   15 |                         strcat(ans[i], s[i]);
      |                                        ~~~^
      |                                           |
      |                                           char
/usr/include/string.h:149:70: note:   initializing argument 2 of 'char* strcat(char*, const char*)'
  149 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Language: C++

#include<stdio.h>
#include<string.h>

int main(){
	char s[1000000];
	char ans[10000] = {""};
	int i,len;

	
	scanf("%s", &s);
	ans[0] = s[1];
	len = strlen(s);
	for (i = 2; i < s; i++){
		if (i % 2 == 1){
			strcat(ans[i], s[i]);
		}
	}
	printf("%s", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |         for (i = 2; i < s; i++){
      |                     ~~^~~
a.cc:15:37: error: invalid conversion from 'char' to 'char*' [-fpermissive]
   15 |                         strcat(ans[i], s[i]);
      |                                ~~~~~^
      |                                     |
      |                                     char
In file included from a.cc:2:
/usr/include/string.h:149:39: note:   initializing argument 1 of 'char* strcat(char*, const char*)'
  149 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
      |                      ~~~~~~~~~~~~~~~~~^~~~~~
a.cc:15:43: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   15 |                         strcat(ans[i], s[i]);
      |                                        ~~~^
      |                                           |
      |                                           char
/usr/include/string.h:149:70: note:   initializing argument 2 of 'char* strcat(char*, const char*)'
  149 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Language: C++

# coding: utf-8


def main():
    _ = int(input())
    A = list(map(int, input().split()))
    B = [0] * 100002
    ans = 0

    for a in A:
        if a != 0: B[a - 1] += 1
        B[a] += 1
        B[a + 1] += 1

    ans = max(B)
    
    print(ans)

if __name__ == "__main__":
    main()


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #coding
    1 | # coding: utf-8
      |   ^~~~~~
a.cc:4:1: error: 'def' does not name a type
    4 | def main():
      | ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
const ll MOD = 1000000007;
using pint = pair<ll, ll>;

int main(){
    ll N;
    cin >> N;
    map<ll, ll> a;
    for(int i = 0; i < N; i++){
      ll d;
      cin >> d;
      a[d] += 1;
    }
    ll out = 0;

    ll mini = INF;
    ll maxi = -INF;
    for(auto i : a){
      mini = min(mini, i.first);
      maxi = max(maxi, i.second);
    }
    for (int X = min-1; X < maxi+1; X++) {
      ll cnt = 0;
      for (auto iter = a.begin(); iter != a.end(); iter++) {
        if (iter->first == X || iter->first - 1 == X || iter->first + 1 == X) {
          cnt+= iter->second;
        }
      }
      out = max(out, cnt);
    }
    cout << out << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   26 |     for (int X = min-1; X < maxi+1; X++) {
      |                  ~~~^~
Language: C++

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

int main(){
  int N;cin>>N;
  vector<int> A(100000,0);
  for(int i=0;i<N;i++) int l;cin>>l;A.at(l)++;
  priority_queue<int> ans;
  for(int i=1;i<99999;i++){
    int L=A.at(i-1)+A.at(i)+A.at(i+1);
    ans.push(L);
  }
  cout<<ans.top()<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:35: error: 'l' was not declared in this scope
    7 |   for(int i=0;i<N;i++) int l;cin>>l;A.at(l)++;
      |                                   ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector <int> a(n);
	for (int i = 0; i < n; i++){
        cin >> a[i];
	}
	map <int, int> cnt;
	for (int i = 0; i < n; i++){
        cnt[a[i]]++;
        cnt[a[i] - 1]]++;
        cnt[a[i] + 1]]++;
	}
	int ans = 0;
	for (auto x : cnt){
	ans = max(ans, x.second);
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: expected ';' before ']' token
   21 |         cnt[a[i] - 1]]++;
      |                      ^
      |                      ;
a.cc:22:22: error: expected ';' before ']' token
   22 |         cnt[a[i] + 1]]++;
      |                      ^
      |                      ;
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:25:18: error: no matching function for call to 'max(int&, std::map<int, int>&)'
   25 |         ans = max(ans, cnt);
      |               ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:25:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::map<int, int>')
   25 |         ans = max(ans, cnt);
      |               ~~~^~~~~~~~~~
/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,
                 from a.cc:4:
/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:25:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   25 |         ans = max(ans, cnt);
      |               ~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:25:28: error: 'class std::map<int, int>' has no member named 'second'
   25 |         ans = max(ans, cnt.second);
      |                            ^~~~~~
Language: C

#include<stdio.h>
int main()
{
int n,i,num[100001],temp,max;
  scanf("%d",&n);
int a[n];
  
    for(i=0;i<100001;++i)
  {num[i]=0;
  }
  
  for(i=0;i<n;++i)
  {
  scanf("%d",&a[i]);
  num[a[i]]++;
  }
  max=0;
  
  for(i=0;i<99999;i++)
  {
  temp=num[i]+num[i+1]+num[i+2];
  if(temp>max) max=temp;
  }

  pritnf("%d",max);
  
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:25:3: error: implicit declaration of function 'pritnf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   25 |   pritnf("%d",max);
      |   ^~~~~~
      |   printf
Language: C

#include<stdio.h>
int main()
{
int n,i,num[100001],temp;
  scanf("%d",&n);
int a[n];
  
    for(i=0;i<100001;++i)
  {num[i]=0;
  }
  
  for(i=0;i<n;++i)
  {
  scanf("%d",&a[i]);
  num[a[i]]++;
  }
  max=0;
  
  for(i=0;i<99999;i++)
  {
  temp=num[i]+num[i+1]+num[i+2];
  if(temp>max) max=temp;
  }

  pritnf("%d",max);
  
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:3: error: 'max' undeclared (first use in this function)
   17 |   max=0;
      |   ^~~
main.c:17:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:3: error: implicit declaration of function 'pritnf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   25 |   pritnf("%d",max);
      |   ^~~~~~
      |   printf
Language: Java

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
Scanner SC = new Scanner(System.in);
int N  = SC.nextInt();
int[] A = new int[N];
int[] freq = new int[100000 + 1];
for (int i = 0; i < N; i++)
{
  A[i] = SC.nextInt();
}
for (int i = 0; i < N; i++)
{
  freq[A[i]] += 1; //case do nothing:
  if (A[i] - 1 >= 0) freq[A[i] - 1] += 1;
  freq[A[i] + 1] += 1;
}
int counter = 0;
for (int i = 0; i< 100000 + 1; i++)
{
  counter = Math.max(counter, freq[i]);
}
System.out.println(counter);
	}

}


Compiler output:
Main.java:5: error: cannot find symbol
Scanner SC = new Scanner(System.in);
^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
Scanner SC = new Scanner(System.in);
                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    int[] a = new int[n];
    String[] str = in.readLine().split(" ");
    int[] count = new int[100003];
    for(int i=0; i<n; i++) {
      a[i] = Integer.parseInt(str[i]);
      count[a]++;
      count[a+1]++;
      count[a+2]++;
    }
    in.close();
    
    Arrays.sort(count);
    System.out.println(count[100002]);
  }
}

Compiler output:
Main.java:15: error: incompatible types: int[] cannot be converted to int
      count[a]++;
            ^
Main.java:16: error: bad operand types for binary operator '+'
      count[a+1]++;
             ^
  first type:  int[]
  second type: int
Main.java:17: error: bad operand types for binary operator '+'
      count[a+2]++;
             ^
  first type:  int[]
  second type: int
3 errors
Language: C++

#include<bits/stdc++.h>
#define ll                  long long
#define dl                 long double
#define pb                push_back
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007LL
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   {for(int i=s;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
#define N                  101LL
#define tmod             998244353LL
using namespace std;

bool sBs(const pair<int,int> &a,const pair<int,int> &b)
{   return (a.second < b.second);   }

ll Powb(ll b,ll n,ll m);
ll BS(vector<pair< ll ,ll > > &PS,ll s,ll e,ll ser);
ll MI(ll a, ll m);
ll P[N+1];
void Sieve(int n=N);

int main()
{
fast;
ll q=1,t;
//cin >> q; t = q;
while(q--)
{
    ll i,j,n,m,k,l=0,r=0,a=0,b=0,c=0,d=0,e,g=1,p,u,v,w,x,y,flag=1;
    //n=m=k=i=j=l=r=a=b=c=d=u=v=w=p=x=y=0;
    cin >> n;
    map<ll,ll> M;
    for(=0;i<n;i++)
    {
        cin >> u;
        M[u]++;
        M[u+1]++;
        M[u-1]++;
    }
    for(auto it:M)
        a = max(a,it.S);
    cout << a;
}
    return 0;
}

//*****************************************************************************************************************************************

ll Powb(ll b,ll n,ll m)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2,m);
    if(n%2==0){return (temp*temp)%m;}
    else{return (b*((temp*temp)%m))%m;}
}

ll BS(vector<pair<ll,ll> > &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid].F==ser)
    {
        return mid;
    }
    else if(PS[mid].F > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}

void Sieve(int n)
{
    //memset(P,true,sizeof(P));
    //P[0] = false;
    //P[1]= false;
    for(int i=1;i<=n;i++) P[i] = i;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i]==i)
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                if(P[j]==j)
                    P[j]=i;
            }
        }
    }

}



Compiler output:
a.cc: In function 'int main()':
a.cc:40:9: error: expected primary-expression before '=' token
   40 |     for(=0;i<n;i++)
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);
string iro(int x){
  string color;
  if(x >= 3200) color = "ziyu";
  else if(x >= 2800) color = "aka";
  else if(x >= 2400) color = "daidai";
  else if(x >= 2000) color = "ki";
  else if(x >= 1600) color = "ao";
  else if(x >= 1200) color = "mizu";
  else if(x >= 800) color = "midori";
  else if(x >= 400) color = "tya";
  else color = "hai";
  return  color;
}
int main() {
 int n;
 cin >> n;
 vector<int> a(n);
 rep(i,n) cin >> a.at(i);
 sort(a.begin(),a.end());
 map<int,int> mp;
 rep(i,n){
   mp[a.at(i)]++;
 }
 int ans = 1;
 for(auto itr = mp.begin(); itr != prev(mp.end(), 2); itr++){
   ans = max(ans,(itr->second)+(next(itr, 1)->second)+(next(itr, 2)->second))
 }
 cout << ans << endl;

 
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:32:78: error: expected ';' before '}' token
   32 |    ans = max(ans,(itr->second)+(next(itr, 1)->second)+(next(itr, 2)->second))
      |                                                                              ^
      |                                                                              ;
   33 |  }
      |  ~
Language: C

#include <stdio.h>
#include <iostream>
using namespace std;	
int a[100005] = {0};
int b[100005] = {0};
int main(){
	int i,n;
	cin >> n;
	int tp = 0;
	for(i=0;i<n;i++){
		cin >> a[i];
		if(tp<a[i]){
			tp = a[i];
		}
		b[a[i]]++;
		b[a[i]-1]++;
		b[a[i]+1]++;
	}
	int max = 0;
	for(i=0;i<=tp;i++){
		if(max<b[i]){
			max = b[i];
		}
	}
	cout << max;
	return 0;
}

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

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

int main() {
  int N; cin >> N;
  int min = INT_MAX, max = INT_MIN;
  int a[100000];
  for (int i=0; i<100000; i++) a[i] = 0;
  for (int i=0; i<N; i++) {
    int num; cin >> num;
    if (num < min) min = num;
    if (num > max) max = num;
    a[num]++;
  }

  int ans;
  int X = min;
  while(X != max+1) {
    int sum = a[X-1] + a[X] + a[X+1];
    if (sum > ans) ans = sum;
    X++;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'INT_MAX' was not declared in this scope
    8 |   int min = INT_MAX, max = INT_MIN;
      |             ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <vector>
  +++ |+#include <climits>
    4 | using namespace std;
a.cc:14:13: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>'
   14 |     if (num > max) max = num;
      |         ~~~~^~~~~
a.cc:14:26: error: overloaded function with no contextual type information
   14 |     if (num > max) max = num;
      |                          ^~~
a.cc:20:17: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+'
   20 |   while(X != max+1) {
      |              ~~~^~
Language: C++

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

const long long MAX = 1<<5+5
int main(void){
  int N;
  cin >> N;
  vector<long long> a(N);
  vector<long long> bucket(N);

  for(long long i=0; i<N; i++){
     cin >> a[i];
     bucket[a[i]]++;
  }//for
   
  long long ans = bucket[0] + bucket[1];
  for(long long i=1; i<N+1; i++){
     long long count = bucket[i-1] + bucket[i] + bucket[i+1];
     ans = max(ans, count);
  }//for

  cout << ans << "\n";
}//main


Compiler output:
a.cc:6:1: error: expected ',' or ';' before 'int'
    6 | int main(void){
      | ^~~
Language: Java

=Math.max(a[x], a[x+1]);
			if (x > 0) {
				a[x-1]++;
				max = Math.max(a[x], a[x-1]);
			}
		}
		System.out.println(max);
	}
	
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
=Math.max(a[x], a[x+1]);
^
Main.java:2: error: class, interface, enum, or record expected
			if (x > 0) {
			^
Main.java:4: error: class, interface, enum, or record expected
				max = Math.max(a[x], a[x-1]);
				^
Main.java:5: error: class, interface, enum, or record expected
			}
			^
Main.java:8: error: class, interface, enum, or record expected
	}
	^
Main.java:52: error: class, interface, enum, or record expected
}
^
6 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
ll n;
map<ll,ll>mp;
cin>>n;
for(ll i=0;i<n;i++){
    ll t;
    cin>>t
    mp[t]++;
    mp[t-1]++;
    mp[t+1]++;
}
ll ans=0;
for(auto i:mp)chmax(ans,i.second);
cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: expected ';' before 'mp'
   28 |     cin>>t
      |           ^
      |           ;
   29 |     mp[t]++;
      |     ~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(a,b,n) for(ll a = (ll)(b); a < (ll)(n); a++)
#define mrep(i,n) for (ll i = (ll)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int n; cin >> n;
	vector<int> a(100001,0);
	rep(i,n) {
		int s; cin >> s;
		a[i]++;
	}
	int ans=-1;
	rep(i,99999) {
		ans=max(ans,(a[i]+a[i-1]+a[i+1]))
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:50: error: expected ';' before '}' token
   23 |                 ans=max(ans,(a[i]+a[i-1]+a[i+1]))
      |                                                  ^
      |                                                  ;
   24 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(a,b,n) for(ll a = (ll)(b); a < (ll)(n); a++)
#define mrep(i,n) for (ll i = (ll)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:23:50: error: expected ';' before '}' token
   23 |                 ans=max(ans,(a[i]+a[i-1]+a[i+1]))
      |                                                  ^
      |                                                  ;
   24 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(a,b,n) for(ll a = (ll)(b); a < (ll)(n); a++)
#define mrep(i,n) for (ll i = (ll)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int n; cin >> n;
	vint a(n,0);
	rep(i,n) {
		int s; cin >> s;
		a[i]++;
	}
	int ans=1;
	rep(i,n+1) {
		ans=max(ans,(a[i]+a[i-1]+a[i+1]))
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:24: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   23 |                 ans=max(ans,(a[i]+a[i-1]+a[i+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:23:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   23 |                 ans=max(ans,(a[i]+a[i-1]+a[i+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:23:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   23 |                 ans=max(ans,(a[i]+a[i-1]+a[i+1]))
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
	int n; cin >> n;
	vint a(n);
	int ma=0;
	rep(i,n) {
		cin >> a[i];
		ma=max(ma,a[i]);
	}
	int ans = 0;
	for(int i=ma;i>=0;i--) {
		int cou=0;
		rep(j,n) {
			if(i-1<=a[j]&&a[j]<=i+1) cou++;
		}
		ans=max(ans,cou);
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
   13 |                 ma=max(ma,a[i]);
      |                    ~~~^~~~~~~~~
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:13:23: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   13 |                 ma=max(ma,a[i]);
      |                    ~~~^~~~~~~~~
/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:13:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   13 |                 ma=max(ma,a[i]);
      |                    ~~~^~~~~~~~~
Language: C++

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

int main() {
	int n; cin >> n;
	vint a(n);
	rep(i,n) cin >> a[i];
	sort(be(a));
	int ans = 0;
	for(int i=a[n-1];i>=0;i--) {
		int cou=0;
		rep(j,n) {
			if(i-1<=a[j]&&a[j]<=i+1) cou++;
		}
		ans=max(ans,cou);
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: 'be' was not declared in this scope
   11 |         sort(be(a));
      |              ^~
Language: C

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	vector<int> num(100010,0);
	for (int i = 0; i < N; i++) {
		num[a[i]]++;
	}
	vector<int> ans(100010, 0);
	for (int i = 0; i < num.size(); i++) {
		if (i == 0)ans[i] = num[i] + num[i + 1];
		else if (i == num.size() - 1)ans[i] = num[i - 1] + num[i];
		else ans[i] = num[i - 1] + num[i] + num[i + 1];
	}
	int ANS=0;
	for (int i = 0; i < ans.size(); i++) {
		if (ANS < ans[i])ANS = ans[i];
	}
	cout << ANS;
}

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <functional>
#include <math.h>
#include <numeric>
#include <stdio.h>
#include <cstdio>

using namespace std;

int main(){
    int n , a,sum;
    cin >> n;
    vector<int> var;
    vector<int> var1;
    for (int i = 0; i < n; i++){
        cin >> a;
        var.push_back(a);
    }
    sort(var.begin(), var.end());
    if (n == 1){
        cout << n << endl;
        return 0;
    }
    if (n == 2){
        if (var.at(0) + 1 == var.at(1) || var.at(0) == var.at(1) || var.at(0) + 2 == var.at(1))
            cout << 2;
        else
            cout << 1;
        return 0;
    }
    for (int i : var){
        if (not count(var1.begin(), var1.end(), i))
            var1.push_back(i);
    }
    
    
    for (int x = 1; x < var1.size() - 1; x++){
        if (x == 1){
            sum = count(var.begin(), var.end(), var1.at(x - 1)) +
                  count(var.begin(), var.end(), var1.at(x)) +
                  count(var.begin(), var.end(), var1.at(x + 1));
        }
        a = count(var.begin(), var.end(), var1.at(x - 1)) +
            count(var.begin(), var.end(), var1.at(x)) +
            count(var.begin(), var.end(), var1.at(x + 1));
        sum = max(sum, a);
    }
    cout << sum << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:52:25: error: expected '}' at end of input
   52 |     cout << sum << endl;
      |                         ^
a.cc:14:11: note: to match this '{'
   14 | int main(){
      |           ^
Language: C++

from collections import Counter

n=int(input())
a=list(map(int,input().split()))
a_max=max(a)

c=Counter(a)

ans=0
for i in range(a_max-1):
  ans=max(ans,c[i]+c[i+1]+c[i+2])

print(ans)

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import Counter
      | ^~~~
Language: C++

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#ifdef RUBICK
#include "dbg.h"
#else
#define dbg(exp) /* nop; */
#endif

using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;

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

    vector<int> arr(n);
    for (int& e : arr)
        scanf("%d", &e);

    sort(begin(arr), end(arr));

    int ans = 0;
    for (int i = 0; i < n; i ++) {
        auto lb = lower_bound(begin(arr), end(arr), arr[i] - 1);
        auto ub = upper_bound(begin(arr), end(arr), arr[i] + 1);
        ans = max(ans, (ub - lb));
    }

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

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:33:18: error: no matching function for call to 'max(int&, __gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)'
   33 |         ans = max(ans, (ub - lb));
      |               ~~~^~~~~~~~~~~~~~~~
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:33:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'})
   33 |         ans = max(ans, (ub - lb));
      |               ~~~^~~~~~~~~~~~~~~~
/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:33:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   33 |         ans = max(ans, (ub - lb));
      |               ~~~^~~~~~~~~~~~~~~~
Language: C++

///////////////////////////////////////////////////
/* __                                       __   */
/*|  |--.-----.---.-.----.----.-----.-----.|  |_ */
/*|  _  |  -__|  _  |  __|  __|  -__|  _  ||   _|*/
/*|_____|_____|___._|____|____|_____|   __||____|*/
/*                                  |__|         */
///////////////////////////////////////////////////
#include<algorithm>
#include<array>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
typedef long long lint; using namespace std;
#define rep(counter, limit) for (int counter = 0; counter < limit; counter++)
#define INF 1000000000000
#define MOD 10000007
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }
int lcm(int a, int b) { return a * b / gcd(a, b); }
bool primenum(int a) { if (a == 1) { return false; }if (a == 2) { return true; }if (a % 2 == 0) { return false; }for (int i = 3; i < sqrt(a) + 1; i += 2) { if (a != i) { if (a % i == 0) { return false; } } }return true; }
struct setupios{setupios(){cin.tie(0);ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}setupios;
int main() {

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

}



Compiler output:
a.cc: In function 'int main()':
a.cc:43:5: error: 'a' was not declared in this scope
   43 |     a[k]++;
      |     ^
a.cc:47:19: error: 'a' was not declared in this scope
   47 |     ans = max(ans,a[i]+a[i+1]+a[i+2]);
      |                   ^