Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 10000000005
#define NIL -1
int main(){
    int w, h; cin >> n >> h;
    int n; cin >> n; 
    int x[n+2], y[n+2], a[n+2];
    int p[n+1][n+1];
    for(int i = 1; i < n+1; i++){
        cin >> x[i] >> y[i] >> a[i];
    }
    for(int i = 1; i < n+1; i++){
        for(int j = 1; j < n+1; j++){
            p[i][j] = 1;
        }
    }
    for(int i = 1; i < n+1; i++){
        if(a[i] == 1){
            for(int j = 1; j < n+1; j++){
                for(int k = 1; k < x[i]; k++){
                    p[j][k] = 0;
                }
            }
        } else if(a[i] == 2){
            for(int j = 1; j < n+1; j++){
                for(int k = x[i]+1; k < n+1; k++){
                    p[j][k] = 0;
                }
            }
        } else if(a[i] == 3){
            for(int j = 1; j < y[i]+1; j++){
                for(int k = 1; k < x[i]; k++){
                    p[j][k] = 0;
                }
            }
        } else {
            for(int j = y[i]+1; j < n+1; j++){
                for(int k = 1; k < n+1; k++){
                    p[j][k] = 0;
                }
            }
        }
    }
    int count = 0;
    for(int i = 1; i < n+1; i++){
        for(int j = 1; j < n+1; j++){
            if(p[i][k]) count++;
        }
    }
    cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:22: error: 'n' was not declared in this scope
   11 |     int w, h; cin >> n >> h;
      |                      ^
a.cc:16:16: error: 'x' was not declared in this scope
   16 |         cin >> x[i] >> y[i] >> a[i];
      |                ^
a.cc:16:24: error: 'y' was not declared in this scope
   16 |         cin >> x[i] >> y[i] >> a[i];
      |                        ^
a.cc:16:32: error: 'a' was not declared in this scope
   16 |         cin >> x[i] >> y[i] >> a[i];
      |                                ^
a.cc:20:13: error: 'p' was not declared in this scope
   20 |             p[i][j] = 1;
      |             ^
a.cc:24:12: error: 'a' was not declared in this scope
   24 |         if(a[i] == 1){
      |            ^
a.cc:26:36: error: 'x' was not declared in this scope
   26 |                 for(int k = 1; k < x[i]; k++){
      |                                    ^
a.cc:27:21: error: 'p' was not declared in this scope
   27 |                     p[j][k] = 0;
      |                     ^
a.cc:32:29: error: 'x' was not declared in this scope
   32 |                 for(int k = x[i]+1; k < n+1; k++){
      |                             ^
a.cc:33:21: error: 'p' was not declared in this scope
   33 |                     p[j][k] = 0;
      |                     ^
a.cc:37:32: error: 'y' was not declared in this scope
   37 |             for(int j = 1; j < y[i]+1; j++){
      |                                ^
a.cc:38:36: error: 'x' was not declared in this scope
   38 |                 for(int k = 1; k < x[i]; k++){
      |                                    ^
a.cc:39:21: error: 'p' was not declared in this scope
   39 |                     p[j][k] = 0;
      |                     ^
a.cc:43:25: error: 'y' was not declared in this scope
   43 |             for(int j = y[i]+1; j < n+1; j++){
      |                         ^
a.cc:45:21: error: 'p' was not declared in this scope
   45 |                     p[j][k] = 0;
      |                     ^
a.cc:53:16: error: 'p' was not declared in this scope
   53 |             if(p[i][k]) count++;
      |                ^
a.cc:53:21: error: 'k' was not declared in this scope
   53 |             if(p[i][k]) count++;
      |                     ^