Language: C++

#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<limits.h>

using namespace std;
typedef struct
{
	int cx;
	int cy;
} data;
int main()
{
	int t, n;
	int dx[] = { 0, 1, 1, 0, -1, -1 };
	int dy[] = { 1, 1, 0, -1, -1, 0 };
	while (cin >> t >> n && t != 0 || n != 0)
	{
		bool obstacle[100][100];
		memset(obstacle, false, sizeof(obstacle));
		for (int i = 0; i < n; i++)
		{
			int x, y;
			cin >> x >> y;
			obstacle[y + 50][x + 50] = true;
		}

		int startX, startY;
		cin >> startX >> startY;
		int map[100][100];
		for (int i = 0; i < 100; i++)
		{
			for (int j = 0; j < 100; j++)
			{
				map[i][j] = INT_MAX;
			}
		}

		queue<data> q;
		data first;
		first.cx = startX + 50;
		first.cy = startY + 50;
		q.push(first);
		map[startY + 50][startX + 50] = 0;
		int ans = 1;
		while (q.size() > 0)
		{
			data d = q.front(); q.pop();
			int cx = d.cx;
			int cy = d.cy;

			for (int i = 0; i < 6; i++)
			{
				int nx = cx + dx[i];
				int ny = cy + dy[i];
				if (nx < 0 || nx >= 100 || ny < 0 || ny >= 100)continue;
				if (obstacle[ny][nx])continue;
				if (map[ny][nx] != INT_MAX)continue;
				if (map[cy][cx] + 1> t)continue;
				map[ny][nx] = map[cy][cx] + 1;
				ans++;
				data next;
				next.cx = nx;
				next.cy = ny;
				q.push(next);
			}
		}
		cout << ans << endl;

	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'memset' was not declared in this scope
   21 |                 memset(obstacle, false, sizeof(obstacle));
      |                 ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<limits.h>
  +++ |+#include <cstring>
    6 | 
a.cc:40:27: error: template argument 1 is invalid
   40 |                 queue<data> q;
      |                           ^
a.cc:40:27: error: template argument 2 is invalid
a.cc:41:17: error: reference to 'data' is ambiguous
   41 |                 data first;
      |                 ^~~~
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:12:3: note:                 'typedef struct data data'
   12 | } data;
      |   ^~~~
a.cc:42:17: error: 'first' was not declared in this scope
   42 |                 first.cx = startX + 50;
      |                 ^~~~~
a.cc:44:19: error: request for member 'push' in 'q', which is of non-class type 'int'
   44 |                 q.push(first);
      |                   ^~~~
a.cc:47:26: error: request for member 'size' in 'q', which is of non-class type 'int'
   47 |                 while (q.size() > 0)
      |                          ^~~~
a.cc:49:25: error: reference to 'data' is ambiguous
   49 |                         data d = q.front(); q.pop();
      |                         ^~~~
/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:12:3: note:                 'typedef struct data data'
   12 | } data;
      |   ^~~~
a.cc:49:47: error: request for member 'pop' in 'q', which is of non-class type 'int'
   49 |                         data d = q.front(); q.pop();
      |                                               ^~~
a.cc:50:34: error: 'd' was not declared in this scope
   50 |                         int cx = d.cx;
      |                                  ^
a.cc:63:33: error: reference to 'data' is ambiguous
   63 |                                 data next;
      |                                 ^~~~
/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:12:3: note:                 'typedef struct data data'
   12 | } data;
      |   ^~~~
a.cc:64:38: error: overloaded function with no contextual type information
   64 |                                 next.cx = nx;
      |                                      ^~
a.cc:65:38: error: overloaded function with no contextual type information
   65 |                                 next.cy = ny;
      |                                      ^~
a.cc:66:35: error: request for member 'push' in 'q', which is of non-class type 'int'
   66 |                                 q.push(next);
      |                                   ^~~~