Language: C++

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

const int dx[] = {0, -1, 0, 1, 0, -1, -1, 1, 1, -2, 0, 2, 0};
const int dy[] = {0, 0, -1, 0, 1, 1, -1, -1, 1, 0, -2, 0, 2};
const int size[] = {5, 9, 13};

typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef tuple<int, int, int> T;

bool ingrid(int i, int j)
{
	return i >= 0 && i < 10 && j >= 0 && j < 10;
}

set<VVi> done;

vector<T> search(int n, VVi grid)
{
	if (done.count(grid)) return vector<T>(0);
	
	if (!n){
		int f = 0;
		for (int i = 0; i < 10; i++){
			for (int j = 0; j < 10; j++){
				f |= grid[i][j];
			}
		}
		vector<T> t;
		if (!f) t.push_back(T(-1, -1, -1));
		return t;
	}
	
	for (int i = 0; i < 10; i++){
		for (int j = 0; j < 10; j++){
			for (int s = 0; s < 3; s++){
				bool f = false;
				for (int d = 0; d < size[s]; d++){
					if (!ingrid(i + dx[d], j + dy[d])) continue;
					if (--grid[i + dx[d]][j + dy[d]] < 0){
						f = true;
					}
				}
				if (!f){
					vector<T> tmp = search(n - 1, grid);
					if (tmp.size()){
						tmp.push_back(T(i, j, s));
						return tmp;
					}
				}
				for (int d = 0; d < size[s]; d++){
					if (!ingrid(i + dx[d], j + dy[d])) continue;
					grid[i + dx[d]][j + dy[d]]++;
				}
			}
		}
	}
	
	done.insert(grid);
	return vector<T>(0);
}

signed main()
{
	int n;
	VVi grid(10, Vi(10));
	scanf("%d", &n);
	for (int i = 0; i < 10; i++){
		for (int j = 0; j < 10; j++){
			scanf("%d", &grid[i][j]);
		}
	}
	
	vector<T> res = search(n, grid);
	for (int i = 1; i <= n; i++){
		int x = get<0>(res[i]);
		int y = get<1>(res[i]);
		int s = get<2>(res[i]);
		printf("%d %d %d\n", y, x, ++s);
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'std::vector<std::tuple<int, int, int> > search(int, VVi)':
a.cc:39:53: error: reference to 'size' is ambiguous
   39 |                                 for (int d = 0; d < size[s]; d++){
      |                                                     ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size [3]'
    6 | const int size[] = {5, 9, 13};
      |           ^~~~
a.cc:52:53: error: reference to 'size' is ambiguous
   52 |                                 for (int d = 0; d < size[s]; d++){
      |                                                     ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size [3]'
    6 | const int size[] = {5, 9, 13};
      |           ^~~~