Language: C++

#include<iostream>
using namespace std;

int N,K;
int data[100001];
int taba[100001];	//最初から連続して並んでいる数字の数

int main(){
	int i,num;
	int max[1000];
	int mcor = 0;
	while(1){
		cin >> N >> K;
		if(N == 0 && K == 0)
			break;
		for(i = 0;i < K;i++){
			cin >> num;
			data[num] = 1;
		}
		int tcor,count;
		tcor = 0;
		count = 0;
		for(i = 1;i <= N;i++){
			if(data[i] == 1){
				count++;
			}
			else{
				taba[tcor] = count;
				tcor++;
				if(count > 0){
					taba[tcor] = 0;
					tcor++;
				}
				count = 0;
			}
		}
		taba[tcor] = count;
		max[mcor] = 0;
		for(i = 0;i <= tcor;i++){
			if(taba[i] != 0)
				continue;
			if(i == 0){
				if(1+taba[i+1] > max[mcor])
					max[mcor] = 1+taba[i+1];
			}
			else if(i == tcor){
				if(1+taba[i-1] > max[mcor])
					max[mcor] = 1+taba[i-1];
			}
			else{
				if(taba[i-1]+1+taba[i+1] > max)
					max[mcor] = taba[i-1]+1+taba[i+1];
			}
		}
		mcor++;
	}
	for(i = 0;i < mcor;i++){
		cout << max[i] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: reference to 'data' is ambiguous
   18 |                         data[num] = 1;
      |                         ^~~~
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:5:5: note:                 'int data [100001]'
    5 | int data[100001];
      |     ^~~~
a.cc:24:28: error: reference to 'data' is ambiguous
   24 |                         if(data[i] == 1){
      |                            ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:5:5: note:                 'int data [100001]'
    5 | int data[100001];
      |     ^~~~
a.cc:51:58: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   51 |                                 if(taba[i-1]+1+taba[i+1] > max)
      |                                    ~~~~~~~~~~~~~~~~~~~~~~^~~~~