Language: C++

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

using namespace std;
typedef struct d
{
	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)
	{
		vector<pair<int, int> > obstacle;
		for (int i = 0; i < n; i++)
		{
			int x, y;
			cin >> x >> y;
			obstacle.push_back(make_pair(x, y));
		}

		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;
			}
		}

		for (int i = 0; i < n; i++)
		{
			pair<int, int> p;
			p = obstacle.at(i);
			map[p.second + 50][p.first + 50] = INT_MIN;
		}

		queue<data> q;
		data first;
		first.cx = startX + 50;
		first.cy = startY + 50;
		q.push(first);
		map[startY + 50][startX + 50] = 0;

		while (q.size() > 0)
		{
			data d = q.front(); q.pop();
			int cx = d.cx;
			int cy = d.cy;
			if (map[cy][cx] != INT_MAX && map[cy][cx] + 1 > t)continue;

			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 (map[ny][nx] == INT_MIN)continue;
				if (map[ny][nx] != INT_MAX)continue;
				map[ny][nx] = map[cy][cx] + 1;
				data next;
				next.cx = nx;
				next.cy = ny;
				q.push(next);
			}
		}
		int ans = 0;
		for (int i = 0; i < 100; i++)
		{
			for (int j = 0; j < 100; j++)
			{
				if (map[i][j] != INT_MIN && map[i][j] != INT_MAX)
				{
					ans++;
				}
			}
		}

		cout << ans << endl;

	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:45: error: 'INT_MAX' was not declared in this scope
   35 |                                 map[i][j] = INT_MAX;
      |                                             ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include<limits>
  +++ |+#include <climits>
    6 | 
a.cc:43:60: error: 'INT_MIN' was not declared in this scope
   43 |                         map[p.second + 50][p.first + 50] = INT_MIN;
      |                                                            ^~~~~~~
a.cc:43:60: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:46:27: error: template argument 1 is invalid
   46 |                 queue<data> q;
      |                           ^
a.cc:46:27: error: template argument 2 is invalid
a.cc:47:17: error: reference to 'data' is ambiguous
   47 |                 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 d data'
   12 | } data;
      |   ^~~~
a.cc:48:17: error: 'first' was not declared in this scope
   48 |                 first.cx = startX + 50;
      |                 ^~~~~
a.cc:50:19: error: request for member 'push' in 'q', which is of non-class type 'int'
   50 |                 q.push(first);
      |                   ^~~~
a.cc:53:26: error: request for member 'size' in 'q', which is of non-class type 'int'
   53 |                 while (q.size() > 0)
      |                          ^~~~
a.cc:55:25: error: reference to 'data' is ambiguous
   55 |                         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 d data'
   12 | } data;
      |   ^~~~
a.cc:55:47: error: request for member 'pop' in 'q', which is of non-class type 'int'
   55 |                         data d = q.front(); q.pop();
      |                                               ^~~
a.cc:56:35: error: expected primary-expression before '.' token
   56 |                         int cx = d.cx;
      |                                   ^
a.cc:57:35: error: expected primary-expression before '.' token
   57 |                         int cy = d.cy;
      |                                   ^
a.cc:58:44: error: 'INT_MAX' was not declared in this scope
   58 |                         if (map[cy][cx] != INT_MAX && map[cy][cx] + 1 > t)continue;
      |                                            ^~~~~~~
a.cc:58:44: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:65:52: error: 'INT_MIN' was not declared in this scope
   65 |                                 if (map[ny][nx] == INT_MIN)continue;
      |                                                    ^~~~~~~
a.cc:65:52: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:66:52: error: 'INT_MAX' was not declared in this scope
   66 |                                 if (map[ny][nx] != INT_MAX)continue;
      |                                                    ^~~~~~~
a.cc:66:52: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:68:33: error: reference to 'data' is ambiguous
   68 |                                 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 d data'
   12 | } data;
      |   ^~~~
a.cc:69:38: error: overloaded function with no contextual type information
   69 |                                 next.cx = nx;
      |                                      ^~
a.cc:70:38: error: overloaded function with no contextual type information
   70 |                                 next.cy = ny;
      |                                      ^~
a.cc:71:35: error: request for member 'push' in 'q', which is of non-class type 'int'
   71 |                                 q.push(next);
      |                                   ^~~~
a.cc:79:50: error: 'INT_MIN' was not declared in this scope
   79 |                                 if (map[i][j] != INT_MIN && map[i][j] != INT_MAX)
      |                                                  ^~~~~~~
a.cc:79:50: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:79:74: error: 'INT_MAX' was not declared in this scope
   79 |                                 if (map[i][j] != INT_MIN && map[i][j] != INT_MAX)
      |                                                                          ^~~~~~~
a.cc:79:74: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'