Language: C++

#include <iostream>
#include <stdlib.h>

#define SHIRO 0
#define USUI  1
#define ATSUI 2

using namespace std;

int l, k;
double array[1000];
void print (int *pole)
{
	for (int i = 0; i < l; i++)
		printf ("%d ", pole[i]);
	printf("\n");
}

bool check (int *pole, int len)
{
	// l ?????????????¶????????????????
	if (l < len)
		return false;
	// ???????????\?????????
	if (pole[0] == SHIRO)
		return false;
	// ???????????\?????????
	if (pole[len-1] == SHIRO)
		return false;
	return true;
}

/* copy array */
void copy (int *tmp, int *pole)
{
	for (int i = 0; i < l; i++)
		tmp[i] = pole[i];
}

double kuro(int *pole, int len);
// ???????????????OK?????£????????°
double shiro (int *pole, int len)
{
	if (array[len] != -1){
	//	printf("%d\n", array[len]);
		return array[len];
	}
	int tmp[l]; /* pole ???????????? */
	double count = 0;
	//??????????????\??????
	//????????\????????????????????§???????????????????????????
	//?????????????????????????????§???????????????????????????????????????
	copy(tmp, pole);
	tmp[len] = SHIRO;
	if (len + 1 <= l) {
		count = kuro(tmp, len+1);
	}
	array[len] = count;
	return count;
}
// ???????????????OK?????£????????°
double kuro (int *pole, int len)
{
	int tmp[l]; /* pole ???????????? */
	double count = 0;
	//??????????????\??????
	copy(tmp, pole);
	tmp[len] = USUI;
	//check ??????????????????????????????????????°????????????
	if (check(tmp, len+1)) {
		// print(tmp);
		count += 1 + shiro(tmp, len+1);
	}
	//??????????????\??????	
	copy(tmp, pole);
	for (int i = 0; i < k; i++)
		tmp[len + i] = ATSUI;
	if (check(tmp, len+k)) {
		// print(tmp);
		count += 1 + shiro(tmp, len+k);
	}
	return count;
}


int main (void)
{
	cin >> l >> k;
	int pole[l];
	int len = 0; /* len of disks */
	for (int i = 0; i < l; i++)
	{
		pole[i] = -1;
	}
	for (int i = 0; i < 1000; i++)
		array[i] = -1;
	//cout << kuro(pole, 0) << endl;
	printf("%.0lf\n", kuro(pole, 0));	

	return 0;
}

Compiler output:
a.cc: In function 'double shiro(int*, int)':
a.cc:44:13: error: reference to 'array' is ambiguous
   44 |         if (array[len] != -1){
      |             ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 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_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:8: note:                 'double array [1000]'
   11 | double array[1000];
      |        ^~~~~
a.cc:46:24: error: reference to 'array' is ambiguous
   46 |                 return array[len];
      |                        ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:8: note:                 'double array [1000]'
   11 | double array[1000];
      |        ^~~~~
a.cc:58:9: error: reference to 'array' is ambiguous
   58 |         array[len] = count;
      |         ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:8: note:                 'double array [1000]'
   11 | double array[1000];
      |        ^~~~~
a.cc: In function 'int main()':
a.cc:96:17: error: reference to 'array' is ambiguous
   96 |                 array[i] = -1;
      |                 ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:8: note:                 'double array [1000]'
   11 | double array[1000];
      |        ^~~~~