Language: C++

#include<iostream>
#include<map>
#define REP(i,x) for (int i = 0; i < (x); i++)
#define TRI(i,j) (nails[(((i)*((i)-1)/2)+(j))]);
using namespace std;

typedef pair<int,int> P;

const int NMAX = 5008;
const int NAILMAX = NMAX * NMAX / 2;
int nails[NAILMAX];

int N, M;

void put(int a, int b, int x) {
  TRI(a,b) ++;
  TRI(a,b+1) --;
  TRI(a+x+1,b) --;
  TRI(a+x+2,b+1) ++;
  TRI(a+x+1,b+x+2) ++;
  TRI(a+x+2,b+x+2) --;
}

void show() {
  for (int a = 1; a < N+1; a++) {
    REP(b,a+1) {
      cout << TRI(a,b);
    }
    cout << endl;
  }
}

void accumulate() {
  show();
  for (int c = 1; c <= N; c++) for (int n = 1; c + n <= N; n++) {
    TRI(c + n, c) += TRI(c + n - 1, c);
  }

  show();
  for (int c = 1; c <= N; c++) for (int n = 1; c + n <= N; n++) {
    TRI(c + n , n) += TRI(c + n - 1, c);
  }

  show();
  for(int a = 1; a <= N; a++) for (int b = 2; b <= N; b++) {
    TRI(a, b) += TRI(a, b - 1);
}

int count() {
  int sum = 0;
  REP(a, N) {
    REP(b, N) {
      if (TRI(a+1,b+1) > 0) sum++;
    }
  }
  return sum;
}

int main() {
  cin >> N >> M;
  REP(i, M) {
    int a, b, x;
    cin >> a >> b >> x;
    put(a, b, x);
  }
  accumulate();
  cout << count() << endl;
}

Compiler output:
a.cc: In function 'void put(int, int, int)':
a.cc:16:14: error: expected primary-expression before ';' token
   16 |   TRI(a,b) ++;
      |              ^
a.cc:17:16: error: expected primary-expression before ';' token
   17 |   TRI(a,b+1) --;
      |                ^
a.cc:18:18: error: expected primary-expression before ';' token
   18 |   TRI(a+x+1,b) --;
      |                  ^
a.cc:19:20: error: expected primary-expression before ';' token
   19 |   TRI(a+x+2,b+1) ++;
      |                    ^
a.cc:20:22: error: expected primary-expression before ';' token
   20 |   TRI(a+x+1,b+x+2) ++;
      |                      ^
a.cc:21:22: error: expected primary-expression before ';' token
   21 |   TRI(a+x+2,b+x+2) --;
      |                      ^
a.cc: In function 'void accumulate()':
a.cc:36:19: error: expected primary-expression before '+=' token
   36 |     TRI(c + n, c) += TRI(c + n - 1, c);
      |                   ^~
a.cc:41:20: error: expected primary-expression before '+=' token
   41 |     TRI(c + n , n) += TRI(c + n - 1, c);
      |                    ^~
a.cc:46:15: error: expected primary-expression before '+=' token
   46 |     TRI(a, b) += TRI(a, b - 1);
      |               ^~
a.cc:49:10: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   49 | int count() {
      |          ^~
a.cc:49:10: note: remove parentheses to default-initialize a variable
   49 | int count() {
      |          ^~
      |          --
a.cc:49:10: note: or replace parentheses with braces to value-initialize a variable
a.cc:49:13: error: a function-definition is not allowed here before '{' token
   49 | int count() {
      |             ^
a.cc:59:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   59 | int main() {
      |         ^~
a.cc:59:9: note: remove parentheses to default-initialize a variable
   59 | int main() {
      |         ^~
      |         --
a.cc:59:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:59:12: error: a function-definition is not allowed here before '{' token
   59 | int main() {
      |            ^
a.cc:68:2: error: expected '}' at end of input
   68 | }
      |  ^
a.cc:33:19: note: to match this '{'
   33 | void accumulate() {
      |                   ^