Language: C++

#include<stdio.h>
int n=0, a,i,j;
	 int *a1[100000] = { 0 };
	 int *a2[100000] = { 0 };
	 int *a3[100000] = { 0 };
	int max=0;
	int count=0, work;
int main(){
	scanf("%d", &n);

	for (i = 0; i < n; i++){
		//printf("1");
		scanf("%d", &a);
		//printf("2");
		a1[i] = a;
		//printf("3");
		a2[i] = a + 1;
		//printf("4");
		a3[i] = a - 1;
		//printf("5");
	}
	for (i = 0; i < n; i++){
		work = a1[i];
		count = 0;
		for (j = 0; j < n; j++){
			if (a1[j] == work){
				count++;
			}
			if (a2[j] == work){
				count++;
			}
			if (a3[j] == work){
				count++;
			}
		}
		if (count > max){
			max = count;
		}
	}
	for (i = 0; i < n; i++){
		work = a2[i];
		count = 0;
		for (j = 0; j < n; j++){
			if (a1[j] == work){
				count++;
			}
			if (a2[j] == work){
				count++;
			}
			if (a3[j] == work){
				count++;
			}
		}
		if (count > max){
			max = count;
		}
	}
	for (i = 0; i < n; i++){
		work = a3[i];
		count = 0;
		for (j = 0; j < n; j++){
			if (a1[j] == work){
				count++;
			}
			if (a2[j] == work){
				count++;
			}
			if (a3[j] == work){
				count++;
			}
		}
		if (count > max){
			max = count;
		}
	}
	printf("%d", max);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   15 |                 a1[i] = a;
      |                         ^
      |                         |
      |                         int
a.cc:17:27: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   17 |                 a2[i] = a + 1;
      |                         ~~^~~
      |                           |
      |                           int
a.cc:19:27: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   19 |                 a3[i] = a - 1;
      |                         ~~^~~
      |                           |
      |                           int
a.cc:23:28: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   23 |                 work = a1[i];
      |                        ~~~~^
      |                            |
      |                            int*
a.cc:26:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   26 |                         if (a1[j] == work){
      |                             ~~~~~~^~~~~~~
a.cc:29:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   29 |                         if (a2[j] == work){
      |                             ~~~~~~^~~~~~~
a.cc:32:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   32 |                         if (a3[j] == work){
      |                             ~~~~~~^~~~~~~
a.cc:41:28: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   41 |                 work = a2[i];
      |                        ~~~~^
      |                            |
      |                            int*
a.cc:44:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   44 |                         if (a1[j] == work){
      |                             ~~~~~~^~~~~~~
a.cc:47:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   47 |                         if (a2[j] == work){
      |                             ~~~~~~^~~~~~~
a.cc:50:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   50 |                         if (a3[j] == work){
      |                             ~~~~~~^~~~~~~
a.cc:59:28: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   59 |                 work = a3[i];
      |                        ~~~~^
      |                            |
      |                            int*
a.cc:62:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   62 |                         if (a1[j] == work){
      |                             ~~~~~~^~~~~~~
a.cc:65:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   65 |                         if (a2[j] == work){
      |                             ~~~~~~^~~~~~~
a.cc:68:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   68 |                         if (a3[j] == work){
      |                             ~~~~~~^~~~~~~