Language: C++

#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

int n,m;

const int Max = 5008;

short data[Max][Max];

void debug(){
#if 0
	for(int j=1;j<=n + 1;j++){
		for(int i=1;i<=n + 1;i++){
			printf("%+d ",data[i][j]);
		}
		puts("");
	}
	puts("");
#endif	
}

int main(){
	exit(1);
	scanf("%d %d",&n,&m);
	int a,b,x;
	for(int i=0;i<m;i++){
		scanf("%d %d %d",&b,&a,&x);
		//printf("%d %d %d\n",a,b,x);
		data[a][b] += 1;
		data[a+1][b] -= 1;
		data[a][b + x + 1] -= 1;
		data[a+1][b + x + 1 + 1] += 1;
		data[a + x + 2][b + x + 1] += 1;
		data[a + x + 2][b + x + 1 + 1] -= 1;
		if(a + x + 2 > max || b + x + 2 > max){
			exit(1);
		}
	}
	debug();
	//ツ可。ツづ可づづゥ
	for(int i=0;i<Max;i++){
		int s = 0;
		for(int j=0;j<Max;j++){
			s += data[j][i];
			data[j][i] = s;
		}
	}
	debug();
	//ツ縦ツづ可づづゥ
	for(int i=0;i<Max;i++){
		int s = 0;
		for(int j=0;j<Max;j++){
			s += data[i][j];
			data[i][j] = s;
		}
	}
	debug();
	//ツ偲篠づ淞づ可偲ヲツづゥ
	for(int i=-Max;i<Max;i++){
		int s=0;
		for(int j=0;i+j<Max;j++){
			//printf("%d,%d:%d\n",i,j,i+j);
			if(j < 0 || j + i < 0){ continue; }
			if(j >= Max || j + i >= Max){ break; }
			s += data[j][i+j];
			data[j][i+j] = s;
		}
	}
	debug();
	int ans = 0;
	for(int i=0;i<Max;i++){
		for(int j=0;j<Max;j++){
			if(data[i][j] > 0){
				ans++;
			}
		}
	}
	printf("%d\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:17: error: reference to 'data' is ambiguous
   32 |                 data[a][b] += 1;
      |                 ^~~~
In file included from /usr/include/c++/14/vector:69,
                 from a.cc:2:
/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:11:7: note:                 'short int data [5008][5008]'
   11 | short data[Max][Max];
      |       ^~~~
a.cc:33:17: error: reference to 'data' is ambiguous
   33 |                 data[a+1][b] -= 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:11:7: note:                 'short int data [5008][5008]'
   11 | short data[Max][Max];
      |       ^~~~
a.cc:34:17: error: reference to 'data' is ambiguous
   34 |                 data[a][b + x + 1] -= 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:11:7: note:                 'short int data [5008][5008]'
   11 | short data[Max][Max];
      |       ^~~~
a.cc:35:17: error: reference to 'data' is ambiguous
   35 |                 data[a+1][b + x + 1 + 1] += 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:11:7: note:                 'short int data [5008][5008]'
   11 | short data[Max][Max];
      |       ^~~~
a.cc:36:17: error: reference to 'data' is ambiguous
   36 |                 data[a + x + 2][b + x + 1] += 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:11:7: note:                 'short int data [5008][5008]'
   11 | short data[Max][Max];
      |       ^~~~
a.cc:37:17: error: reference to 'data' is ambiguous
   37 |                 data[a + x + 2][b + x + 1 + 1] -= 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:11:7: note:                 'short int data [5008][5008]'
   11 | short data[Max][Max];
      |       ^~~~
a.cc:38:30: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>'
   38 |                 if(a + x + 2 > max || b + x + 2 > max){
      |                    ~~~~~~~~~~^~~~~
a.cc:38:49: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>'
   38 |                 if(a + x + 2 > max || b + x + 2 > max){
      |                                       ~~~~~~~~~~^~~~~
a.cc:47:30: error: reference to 'data' is ambiguous
   47 |                         s += data[j][i];
      |                              ^~~~
/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:11:7: note:                 'short int data [5008][5008]'
   11 | short data[Max][Max];
      |       ^~~~
a.cc:48:25: error: reference to 'data' is ambiguous
   48 |                         data[j][i] = s;
      |                         ^~~~
/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:11:7: note:                 'short int data [5008][5008]'
   11 | short data[Max][Max];
      |       ^~~~
a.cc:56:30: error: reference to 'data' is ambiguous
   56 |                         s += data[i][j];
      |                              ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class