criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  int W,H,N,ans=0;
  cin>>W>>H>>N;
  int A[H+1][W+1];
  REP(i,H+1){
    REP(j,W+1){
      A[i][j]=0;
    }
  }
  
  for(int i=1; i<=H; ++i){
    for(int j=1; j<=W; ++j){
      int X,Y,A;
      cin>>X>>Y>>A;
      if(A==1){
        for(int k=1; k<=H; ++k){
          for(int l=1; l<X; ++l){
            A[k][l]=1;
          }
        }
      }
      if(A==2){
        for(int k=1; k<=H; ++k){
          for(int l=X+1; l<=W; ++l){
            A[k][l]=1;
          }
        }
      }
      if(A==3){
        for(int l=1; l<=W; ++l){
          for(int k=1; k<Y; ++k){
            A[k][l]=1;
          }
        }
      }
      if(A==4){
        for(int l=1; l<=W; ++l){
          for(int k=Y+1; k<=H; ++k){
            A[k][l]=1;
          }
        }
      }
    }
  }
  
  for(int i=1; i<=H; ++i){
    for(int j=1; j<=W; ++j){
      if(A[i][j]==0) ans++;
    }
  }
  
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:14: error: invalid types 'int[int]' for array subscript
   36 |             A[k][l]=1;
      |              ^
a.cc:43:14: error: invalid types 'int[int]' for array subscript
   43 |             A[k][l]=1;
      |              ^
a.cc:50:14: error: invalid types 'int[int]' for array subscript
   50 |             A[k][l]=1;
      |              ^
a.cc:57:14: error: invalid types 'int[int]' for array subscript
   57 |             A[k][l]=1;
      |              ^
Language: C++

/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printfin(a) printf(a ? "possible\n" : "inposible\n")
#define all(x) (x).begin(), (x).end()
using ll = long long;

const int INF = 2147483647;
//const ll LINF = ll();今度書く

//マクロとかここまで

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>

using namespace std;

int main() {
	
	int w, a, b, ans = 0;
	int w, h, n, x, y, a, x0, y0, x1, y1;
	scanf("%d%d%d", &w, &h, &n);
	x0 = y0 = 0;
	x1 = w;
	y1 = h;
	rep(i, n) {
		scanf("%d%d%d", &x, &y, &a);
		if (a == 1) {
			x0 = max(x0, x);
		}
		else if (a == 2) {
			x1 = min(x1, x);
		}
		else if (a == 3) {
			y0 = max(y0, y);
		}
		else {
			y1 = min(y1, y);
		}
	}
	printf("%d\n", y1 > y0 && x1 > x0 ? (x1 - x0) * (y1 - y0) : 0);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:13: error: redeclaration of 'int w'
   41 |         int w, h, n, x, y, a, x0, y0, x1, y1;
      |             ^
a.cc:40:13: note: 'int w' previously declared here
   40 |         int w, a, b, ans = 0;
      |             ^
a.cc:41:28: error: redeclaration of 'int a'
   41 |         int w, h, n, x, y, a, x0, y0, x1, y1;
      |                            ^
a.cc:40:16: note: 'int a' previously declared here
   40 |         int w, a, b, ans = 0;
      |                ^
Language: C++

#include "stdafx.h"
#include<iostream>
#include<algorithm>
using namespace std;

int main() {
	int w, h, n; cin >> w >> h >> n;
	

	int wide[2] = {0,w}, height[2] = {0,h};
	for (int i = 0; i < n; i++) {
		int x, y, a; cin >> x >> y >> a;
		if (a == 1) wide[0] = max(wide[0], x);
		else if (a == 2)wide[1] = min(wide[1], x);
		else if (a == 3)height[0] = max(height[0], y);
		else height[1] = min(height[1], y);
	}
	cout << max(0,(wide[1] - wide[0])) * max(0,(height[1]-height[0])) << endl;

	return 0;
}

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int i,j,k,m,n,w,h;
    int ansx,ansy;
    cin>>w>>h>>n;
    int x,y,a;
    int shang=h,xia=0,zuo=0,you=w;
    for(i=1; i<=n; i++)
    {
        cin>>x>>y>>a;
        
        if(a==1)
            zuo=max(x,zuo);
        if(a==2)
            you=min(x,you);
        if(a==3)
            xia=max(y,xia);
        if(a==4)
            shang=min(y,shang);
    }
    if((you-zuo)<0||(shang-xia)<0)
    {
        cout<<0<<endl;
        return 0;
    }
    cout<<(you-zuo)*(shang-xia)<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int i,j,k,m,n,w,h;
    int ansx,ansy;
    cin>>w>>h>>n;
    int x,y,a;
    int shang=h,xia=0,zuo=0,you=w;
    for(i=1; i<=n; i++)
    {
        cin>>x>>y>>a;
        
        if(a==1)
            zuo=max(x,zuo);
        if(a==2)
            you=min(x,you);
        if(a==3)
            xia=max(y,xia);
        if(a==4)
            shang=min(y,shang);
    }
    if((you-zuo)<0||(shang-xia)<0)
    {
        cout<<0<<endl;
        return 0;
    }
    cout<<(you-zuo)*(shang-xia)<<endl;
    return 0;
}



Compiler output:
a.cc:36:5: error: redefinition of 'int main()'
   36 | int main()
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main()
      |     ^~~~
Language: C++

#include <bits/stdc++h.>
using namespace std;

int main(){
  int w,h,n;
  cin >> w >> h >> n;
  
  vector<vector<int>> vec(n, vector<int>(3));
  for (int i=0; i<n; i++){
    for (int j=0; j<3; j++){
      cin >> vec.at(i).at(j);
    }
  }
  
  int x_min = 0;
  int x_max = w;
  int y_min = 0;
  int y_max = h;
  
  for (int i=0; i<n; i++){
    if (vec.at(i).at(2) == 1){
      x_min = vec.at(i).at(0);
    }
    if (vec.at(i).at(2) == 2){
            x_max = vec.at(i).at(0);
    }
    if (vec.at(i).at(2) == 3){
            y_min = vec.at(i).at(1);
    }
    if (vec.at(i).at(2) == 4){
            y_max = vec.at(i).at(1);
    }
  }
  
  if (x_min <= x_max && y_min <= y_max){
    cout << (x_max - x_min)*(y_max - y_min) << endl;
  }
  else {
    cout << 0 << endl;
  }
}

Compiler output:
a.cc:1:10: fatal error: bits/stdc++h.: No such file or directory
    1 | #include <bits/stdc++h.>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
ll INF = 1000;
int main(){
  int w, h, n;
  cin >> w >> h >> n;
  
  int x, y, a, max_x=0, min_x=INF, max_y=0, min_y=INF;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> a;
    if (a == 1) max_x = max(max_x, x);
    if (a == 2) min_x = min(min_x, x);
    if (a == 3) max_y = max(max_y, y);
    if (a == 4) min_y = min(min_y, y);
  }
  max_x = max(max_x, 0);
  min_x = min(min_x, w);
  max_y = max(max_y, 0);
  min_y = min(min_y, h);
  
  cout << max(0, min_x - max_x) * max(0, min_y - max_y) << endl;
}

Compiler output:
a.cc:3:1: error: 'll' does not name a type
    3 | ll INF = 1000;
      | ^~
a.cc: In function 'int main()':
a.cc:8:31: error: 'INF' was not declared in this scope
    8 |   int x, y, a, max_x=0, min_x=INF, max_y=0, min_y=INF;
      |                               ^~~
a.cc:13:17: error: 'max_y' was not declared in this scope; did you mean 'max_x'?
   13 |     if (a == 3) max_y = max(max_y, y);
      |                 ^~~~~
      |                 max_x
a.cc:14:17: error: 'min_y' was not declared in this scope; did you mean 'min_x'?
   14 |     if (a == 4) min_y = min(min_y, y);
      |                 ^~~~~
      |                 min_x
a.cc:18:3: error: 'max_y' was not declared in this scope; did you mean 'max_x'?
   18 |   max_y = max(max_y, 0);
      |   ^~~~~
      |   max_x
a.cc:19:3: error: 'min_y' was not declared in this scope; did you mean 'min_x'?
   19 |   min_y = min(min_y, h);
      |   ^~~~~
      |   min_x
Language: C

#include <stdio.h>
#include <math.h>
int main(){
  int w,h,n,x,y,a;
  scanf("%d%d%d",&w,&h,&n);
  int r1=0,r2=w,r3=0,r4=h;
  for(int i=0;i<n;i++){
    scanf("%d%d%d",&x,&y,&a);
    switch(a){
      case 1:
        if(x>r1)r1=x;
        break;
      case 2:
        if(x<r2)r2=x;
        break;
      case 3:
        if(y>r3)r3=y;
        break;
      case 4:
        if(y<r4)r4=y;
        break;
    }
  }
  printf("%d",fdim(r2-r1)*fdim(r4-r3));
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:24:15: error: too few arguments to function 'fdim'
   24 |   printf("%d",fdim(r2-r1)*fdim(r4-r3));
      |               ^~~~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:28,
                 from main.c:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:362:1: note: declared here
  362 | __MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y));
      | ^~~~~~~~~~
main.c:24:27: error: too few arguments to function 'fdim'
   24 |   printf("%d",fdim(r2-r1)*fdim(r4-r3));
      |                           ^~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:362:1: note: declared here
  362 | __MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y));
      | ^~~~~~~~~~
Language: C

#include <stdio.h>
#include <math.h>
int main(){
  int w,h,n,x,y,a;
  scanf("%d%d%d",&w,&h,&n);
  int r1=0,r2=w,r3=0,r4=h;
  for(int i=0;i<n;i++){
    scanf("%d%d%d",&x,&y,&a);
    switch(a){
      case 1:
        if(x>r1)r1=x;
        break;
      case 2:
        if(x<r2)r2=x;
        break;
      case 3:
        if(y>r3)r3=y;
        break;
      case 4:
        if(y<r4)r4=y;
        break;
    }
  }
  printf("%d",dimf(r2-r1)*dimf(r4-r3));
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:24:15: error: implicit declaration of function 'dimf'; did you mean 'fdimf'? [-Wimplicit-function-declaration]
   24 |   printf("%d",dimf(r2-r1)*dimf(r4-r3));
      |               ^~~~
      |               fdimf
Language: C++

#include<cstdio>
int main(){
  int W, H, N;
  scanf("%d %d %d", &W, &H, &N);
  
  int x[N], y[N], a[N];
  for(int i=0; i<N; i++)
    scanf("%d %d %d", &x[i], &y[i], &a[i]);
  
  int k=W, l=0, m=W, n=0;
  for(int i=0; i<N; i++){
    if(a[i]==4){
      if(k>y[i])
        k = y[i];
    }
    if(a[i]==3){
      if(l<y[i])
        l = y[i];
    }
    if(a[i]==2){
      if(m>x[i])
        m = x[i];
    }  
    if(a[i]==4){
      if(n<x[i])
        n = x[i];
    }
  }
  if(k>l && m>n)
    printf("%d", (k-l)*(m-n) );
  else{
    int s = 0;
    print("%d", s);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:5: error: 'print' was not declared in this scope; did you mean 'printf'?
   33 |     print("%d", s);
      |     ^~~~~
      |     printf
Language: C++

#include<cstdio>
int main(){
  int W, H, N;
  scanf("%d %d %d", &W, &H, &N);
  
  int x[N], y[N], a[N];
  for(int i=0; i<N; i++)
    scanf("%d %d %d", &x[i], &y[i], &a[i]);
  
  int k=W, l=0, m=W, n=0;
  for(int i=0; i<N; i++){
    if(a[i]==4){
      if(k>y[i])
        k = y[i];
    }
    if(a[i]==3){
      if(l<y[i])
        l = y[i];
    }
    if(a[i]==2){
      if(m>x[i])
        m = x[i];
    }  
    if(a[i]==4){
      if(n<x[i])
        n = x[i];
    }
  }
  if(k>l && m>n)
    printf("%d", (k-l)*(m-n) );
  else
    print("0");
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'print' was not declared in this scope; did you mean 'printf'?
   32 |     print("0");
      |     ^~~~~
      |     printf
Language: C++

#include<cstdio>
int main(){
  int W, H, N;
  scanf("%d %d %d", &W, &H, &N);
  
  int x[N], y[N], a[N];
  for(int i=0; i<N; i++)
    scanf("%d %d %d", &x[i], &y[i], &a[i]);
  
  int k=W, l=0, m=W, n=0;
  for(int i=0; i<N; i++){
    if(a[i]==4){
      if(k>y[i])
        k = y[i];
    }
    if(a[i]==3){
      if(l<y[i])
        l = y[i];
    }
    if(a[i]==2){
      if(m>x[i])
        m = x[i];
    }  
    if(a[i]==4){
      if(n<x[i])
        n = x[i];
    }
  }
  if(k>l && m>n)
    printf("%d", (k-l)*(m-n) );
  else
    print("%d", 0);
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'print' was not declared in this scope; did you mean 'printf'?
   32 |     print("%d", 0);
      |     ^~~~~
      |     printf
Language: C++

#include <bits/stdc++.h>                                                                                                                                                                               [0/0]
using ll = long long;
using namespace std;

int main() {
  int W,H,N,x[100],y[100],a[100];
  cin>>W>>H>>N;
  for (int i(0);i<N;i++) cin>>x[i]>>y[i]>>a[i];
  int minx(0),miny(0),maxx(W),maxy(H);
  for (int i(0);i<N;i++){
    if (a[i]==1) minx=max(minx,x[i]);
    else if (a[i]==2) maxx=min(maxx,x[i]);
    else if (a[i]==3) miny=max(miny,y[i]);
    else if (a[i]==4) maxy=min(maxy,y[i]);
  }
  int a=(maxx-minx)*(maxy-miny);
  cout << (a>=0 ? a:0);
}

Compiler output:
a.cc:1:200: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>                                                                                                                                                                               [0/0]
      |                                                                                                                                                                                                        ^
a.cc: In function 'int main()':
a.cc:16:7: error: conflicting declaration 'int a'
   16 |   int a=(maxx-minx)*(maxy-miny);
      |       ^
a.cc:6:27: note: previous declaration as 'int a [100]'
    6 |   int W,H,N,x[100],y[100],a[100];
      |                           ^
a.cc:17:13: error: ordered comparison of pointer with integer zero ('int*' and 'int')
   17 |   cout << (a>=0 ? a:0);
      |            ~^~~
Language: C++

#include <bits/stdc++.h>                                                                                                                                                                               [0/0]
using ll = long long;
using namespace std;

int main() {
  int W,H,N,x[100],y[100],a[100];
  cin>>W>>H>>N;
  for (int i(0);i<N;i++) cin>>x[i]>>y[i]>>a[i];
  int minx(0),miny(0),maxx(W),maxy(H);
  for (int i(0);i<N;i++){
    if (a[i]==1) minx=max(minx,x[i]);
    else if (a[i]==2) maxx=min(maxx,x[i]);
    else if (a[i]==3) miny=max(miny,y[i]);
    else if (a[i]==4) maxy=min(maxy,y[i]);
  }
  int a=(maxx-minx)*(maxy-miny);
  cout << (a>=0 ? a:0);


Compiler output:
a.cc:1:200: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>                                                                                                                                                                               [0/0]
      |                                                                                                                                                                                                        ^
a.cc: In function 'int main()':
a.cc:16:7: error: conflicting declaration 'int a'
   16 |   int a=(maxx-minx)*(maxy-miny);
      |       ^
a.cc:6:27: note: previous declaration as 'int a [100]'
    6 |   int W,H,N,x[100],y[100],a[100];
      |                           ^
a.cc:17:13: error: ordered comparison of pointer with integer zero ('int*' and 'int')
   17 |   cout << (a>=0 ? a:0);
      |            ~^~~
a.cc:17:24: error: expected '}' at end of input
   17 |   cout << (a>=0 ? a:0);
      |                        ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include <iostream>
using namespace std;

int main() {
    int W, H, N;
    cin >> W >> H >> N;
    int x[N], y[N], a[N];

    for(int i = 0; i < N; i++) {
        cin >> x[i] >> y[i] >> a[i];
    }

    lbx = 0;    //白い長方形の左下の頂点のx座標
    lby = 0;    //白い長方形の左下の頂点のy座標
    rbx = W;    //白い長方形の右下の頂点のx座標
    lty = H;    //白い長方形の左上の頂点のy座標

    int tate;   //白い長方形の縦の長さ
    int yoko;   //白い長方形の横の長さ
    int S;      //白い長方形の面積

    for(int i = 0; i < N; i++) {
        if(a[i] == 1) {
            lbx = x[i];
        }
        else if(a[i] == 2) {
            rbx = x[i];
        }
        else if(a[i] == 3) {
            lby = y[i];
        }
        else if(a[i] == 4) {
            lty = y[i];
        }

        tate = lty - lby;
        yoko = rbx - lbx;

        if(tate <= 0 || yoko <= 0) {
            tate = 0;
            break;
        }
    }

    S = tate*yoko;

    cout << S;

    cout << endl;
    return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'lbx' was not declared in this scope
   13 |     lbx = 0;    //白い長方形の左下の頂点のx座標
      |     ^~~
a.cc:14:5: error: 'lby' was not declared in this scope
   14 |     lby = 0;    //白い長方形の左下の頂点のy座標
      |     ^~~
a.cc:15:5: error: 'rbx' was not declared in this scope
   15 |     rbx = W;    //白い長方形の右下の頂点のx座標
      |     ^~~
a.cc:16:5: error: 'lty' was not declared in this scope
   16 |     lty = H;    //白い長方形の左上の頂点のy座標
      |     ^~~
Language: C++

#include <iostream>
using namespace std;

int main() {
    int W, H, N;
    cin >> W >> H >> N;
    int x[N], y[N], a[N];

    for(int i = 0; i < N; i++) {
        cin >> x[i] >> y[i] >> a[i];
    }

    lbx = 0;    //白い長方形の左下の頂点のx座標
    lby = 0;    //白い長方形の左下の頂点のy座標
    rbx = W;    //白い長方形の右下の頂点のx座標
    rty = H;    //白い長方形の左上の頂点のy座標

    int tate;   //白い長方形の縦の長さ
    int yoko;   //白い長方形の横の長さ
    int S;      //白い長方形の面積

    for(int i = 0; i < N; i++) {
        if(a[i] == 1) {
            lbx = x[i];
        }
        else if(a[i] == 2) {
            rbx = x[i];
        }
        else if(a[i] == 3) {
            lby = y[i];
        }
        else if(a[i] == 4) {
            lty = y[i];
        }

        tate = lty - lby;
        yoko = rbx - lbx;

        if(tate <= 0 || yoko <= 0) {
            tate = 0;
            break;
        }
    }

    S = tate*yoko;

    cout << S;

    cout << endl;
    return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'lbx' was not declared in this scope
   13 |     lbx = 0;    //白い長方形の左下の頂点のx座標
      |     ^~~
a.cc:14:5: error: 'lby' was not declared in this scope
   14 |     lby = 0;    //白い長方形の左下の頂点のy座標
      |     ^~~
a.cc:15:5: error: 'rbx' was not declared in this scope
   15 |     rbx = W;    //白い長方形の右下の頂点のx座標
      |     ^~~
a.cc:16:5: error: 'rty' was not declared in this scope
   16 |     rty = H;    //白い長方形の左上の頂点のy座標
      |     ^~~
a.cc:33:13: error: 'lty' was not declared in this scope
   33 |             lty = y[i];
      |             ^~~
a.cc:36:16: error: 'lty' was not declared in this scope
   36 |         tate = lty - lby;
      |                ^~~
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;
ll mod = pow(10,9) + 7;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}


int main(void){
    int w,h,n; cin >> w >> h >> n;
	int min_w=0, min_h = 0;
	vector<int> x(n) ,y(n), a(n);
	rep(i,n){
		cin >> x[i] >> y[i] >> a[i];
		if (a[i]==1){
			if (min_w < x[i]){
				min_w = x[i];
			}
		}else if(a[i]==2){
			if (w > x[i]){
				w = x[i]
			}
		}else if(a[i]==3){
			if (min_h < y[i]){
				min_h = y[i];
			}
		}else{
			if (h > y[i]){
				h = y[i];
			}
		}
	}
	cout << ((h-min_h)*(w-min_w) < 0? 0: (h-min_h)*(w-min_w)) << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:41: error: expected ';' before '}' token
   43 |                                 w = x[i]
      |                                         ^
      |                                         ;
   44 |                         }
      |                         ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int w,h,n;
  cin>>w>>h>>n;
  int minx=101;
  int maxx=0;
  int miny=101;
  int maxy=0;
  for(int i=0;i<n;i++){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==1){maxx=max(maxx,b);}
    else if(a==2){minx=min(minx,b);}
    else if(a==3){maxy=max(maxy,c);}
    else{miny=min(miny,c);}
  }
  cout<<max(0,maxx-minx)*max(0,maxy-miny);
}
}

Compiler output:
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int W, H, N;
  cin >> W >> H >> N;
  vector<int> x(N);
  vector<int> y(N);
  vector<int> a(N);
  int A, B, C, D;
  A = 0;
  B = w;
  C = 0;
  D = H;
  
  for(int i = 0; i < N; i++) {
    cin >> x[i] >> y[i] >> a[i];
    
    if (a[i] == 1 && x[i] >= A) {
    A = X[i];
    }
    else if(a[i] == 2 && x[i] <= B) {
    B = x[i];
    }
    else if(a[i] == 3 && y[i] >= C) {
    C = y[i];
    }
    else if(a[i] == 4 && y[i] <= D) {
    D = y[i];
    }
  }
  if (B >= A && D >= C) {
    cout << (B - A) * (D - C) << endl;
  }
  else {
    cout << 0 << endl;
  }
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'w' was not declared in this scope
   12 |   B = w;
      |       ^
a.cc:20:9: error: 'X' was not declared in this scope
   20 |     A = X[i];
      |         ^
Language: C++

#include <stdc++.h>;
using namespace std;

int main() {
    int W,H,N;
    cin >> W>>H>>N;
    vector<vector<int>> data(N, vector<int>(3));
 
  // 入力 (2重ループを用いる)
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 3; j++) {
        cin >> data.at(i).at(j);
      }
    }
    int lx=0,hx=W,ly=0,hy=H;
    for(int i=0;i<N;i++){
      if(data[i][2]==1)
        lx=max(lx,data[i][0]);
      if(data[i][2]==2)
        hx=min(ly,data[i][0]);
      if(data[i][2]==3)
        ly=max(ly,data[i][1]);
      if(data[i][2]==4)
        hy=min(hy,data[i][1]);
    }
    if(hx-lx>=0&&hy-ly>=0)
       cout<<W*H-(hx-lx)*(hy-ly)<<endl;
    else
      cout<<0<<endl;
    
  
         
}


Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include <stdc++.h>;
      |                    ^
a.cc:1:10: fatal error: stdc++.h: No such file or directory
    1 | #include <stdc++.h>;
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <set>
using namespace std;

int main() {
    int W,H,N;
    cin >> W>>H>>N;
    vector<vector<int>> data(N, vector<int>(3));
 
  // 入力 (2重ループを用いる)
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 3; j++) {
        cin >> data.at(i).at(j);
      }
    }
    int lx=0,hx=W,ly=0,hy=H;
    for(int i=0;i<N;i++){
      if(data[i][2]==1)
        lx=max(lx,data[i][0]);
      if(data[i][2]==2)
        hx=min(ly,data[i][0]);
      if(data[i][2]==3)
        ly=max(ly,data[i][1]);
      if(data[i][2]==4)
        hy=min(hy,data[i][1]);
    }
    if(hx-lx>=0&&hy-ly>=0)
       cout<<W*H-(hx-lx)*(hy-ly)<<endl;
    else
      cout<<0<<endl;
    
  
         
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<vector<int>> data(N, vector<int>(3));
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <set>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:8:19: error: expected primary-expression before 'int'
    8 |     vector<vector<int>> data(N, vector<int>(3));
      |                   ^~~
a.cc:13:21: error: overloaded function with no contextual type information
   13 |         cin >> data.at(i).at(j);
      |                     ^~
a.cc:18:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   18 |       if(data[i][2]==1)
      |              ^
a.cc:19:23: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   19 |         lx=max(lx,data[i][0]);
      |                       ^
a.cc:20:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |       if(data[i][2]==2)
      |              ^
a.cc:21:23: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   21 |         hx=min(ly,data[i][0]);
      |                       ^
a.cc:22:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   22 |       if(data[i][2]==3)
      |              ^
a.cc:23:23: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   23 |         ly=max(ly,data[i][1]);
      |                       ^
a.cc:24:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   24 |       if(data[i][2]==4)
      |              ^
a.cc:25:23: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   25 |         hy=min(hy,data[i][1]);
      |                       ^
Language: C

#include <stdio.h>
int main(void)
{
    int w,h,n,ans;
    scanf("%d%d%d", &w,&h,&n);
    int x[n], y[n], a[n];
    for(int i=0; i<n; i++) scanf("%d%d%d", &x[i],&y[i],&a[i]);
    
    int p[2],q[2];
    p[0]=0;
    p[1]=0;
    q[0]=w;
    q[1]=h;
    for(int i=0; i<n; i++)
    {
        if(a[i]==1)
        {
            if(p[0]<x[i]) p[0]=x[i];
        }
        else if(a[i]==2)
        {
            if(q[0]>x[i]) q[0]=x[i];
        }
        else if(a[i]==3)
        {
            if(p[1]<y[i]) p[1]=y[i];
        }
        else
        {
            if(q[1]>y[i]) q[1]=y[i];
        }
    }
    if((q[0]-p[0])*(q[1]-p[1])>0) ans=(q[0]-p[0])*(q[1]-p[1]);
    else ans=0;
    printf("%d", ans);
    return 0;

Compiler output:
main.c: In function 'main':
main.c:36:5: error: expected declaration or statement at end of input
   36 |     return 0;
      |     ^~~~~~
Language: C++

W, H, N = map(int, input().split())
x1 = y1 = a1 = 0
xmin = 0
xmax = W
ymin = 0
ymax = H
for _ in range(N):
  x2, y2, a2 = map(int, input().split())
  if (a2 == 1):
    xmin = max(x2, xmin)
  if (a2 == 2):
    xmax = min(x2, xmax)
  if (a2 == 3):
    ymin = max(y2, ymin)
  if (a2 == 4):
    ymax = min(y2, ymax)
  if (xmax<= xmin or ymax <= ymin):
    print(0)
    exit()
print((xmax - xmin) * (ymax - ymin))

Compiler output:
a.cc:1:1: error: 'W' does not name a type
    1 | W, H, N = map(int, input().split())
      | ^
Language: C++

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const db EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
 
//#define int ll
//#define int long long
 
//配列版
signed main()
{
  array<array<int,110>, 110> t{0};
  int w,h,n; cin >> w >> h >> n;
  
  for(int i=0; i < n; ++i){
    int x,y,a; cin >> x >> y >> a;
    
    if(a==1){
      for(int j=0; j < x; ++j){
        for(int k=0; k < h; ++k)
          t[j][k]=1;
      }
    }
      
    if(a==2){
      for(int j=x; j < w; ++j){
        for(int k=0; k < h; ++k)
          t[j][k]=1;
      }
    }
      
    if(a==3){
      for(int j=0; j < w; ++j){
        for(int k=0;k < y; ++k)
          t[j][k]=1;
      }
    }
          
    if(a==4){
      for(int j=0; j < w; ++j){
        for(int k=y; k < h; ++k)
          t[j][k]=1;
      }
    }
  }

  int cnt=0;
  for(int i=0; i < w; ++i){
    for(int j=0; j < h; ++j){
      if(t[i][j]==0)
        ++cnt;
    }
  }
  
  cout << cnt;
  
  return 0;
}

Compiler output:
a.cc:2:7: error: 'll' does not name a type
    2 | const ll LINF = 1001001001001001001ll;
      |       ^~
a.cc:4:7: error: 'db' does not name a type
    4 | const db EPS = 1e-9;
      |       ^~
a.cc: In function 'int main()':
a.cc:13:3: error: 'array' was not declared in this scope
   13 |   array<array<int,110>, 110> t{0};
      |   ^~~~~
a.cc:13:15: error: expected primary-expression before 'int'
   13 |   array<array<int,110>, 110> t{0};
      |               ^~~
a.cc:14:14: error: 'cin' was not declared in this scope
   14 |   int w,h,n; cin >> w >> h >> n;
      |              ^~~
a.cc:22:11: error: 't' was not declared in this scope
   22 |           t[j][k]=1;
      |           ^
a.cc:29:11: error: 't' was not declared in this scope
   29 |           t[j][k]=1;
      |           ^
a.cc:36:11: error: 't' was not declared in this scope
   36 |           t[j][k]=1;
      |           ^
a.cc:43:11: error: 't' was not declared in this scope
   43 |           t[j][k]=1;
      |           ^
a.cc:51:10: error: 't' was not declared in this scope
   51 |       if(t[i][j]==0)
      |          ^
a.cc:56:3: error: 'cout' was not declared in this scope
   56 |   cout << cnt;
      |   ^~~~
Language: C++

w, h, n = gets.chomp.split.map(&:to_i)
x_l = y_d = 0
x_r = w
y_u = h

while x, y, a = gets.chomp.split.map(&:to_i)
  if a == 1
    x_l = x
  elsif a == 2
    x_r = x
  elsif a == 3
    y_d = y
  else
    y_u = y
  end
end

puts (x_r - x_r) * (y_u - y_d)

Compiler output:
a.cc:1:1: error: 'w' does not name a type
    1 | w, h, n = gets.chomp.split.map(&:to_i)
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int w,h,n,x[200],y[200],a[200],t,b,r,l;
  cin >>  >> h >> n;
  for(int i=0;i < n;i++){
    cin >> x[i] >> y[i] >> a[i];
  }
  l=0;
  b=0;
  r=w;
  t=h;
  for(int i=0;i<n;i++){
    switch(a[i]){
      case 1:
        if(l < x[i]) l = x[i];
        break;
      case 2:
        if(r > x[i]) r = x[i];
        break;
      case 3:
        if(b < y[i]) b  = y[i];
        break;
      case 4:
        if(t > y[i]) t = y[i];
        break;
    }
  }
  cout << (t - b)*(l -r) << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: expected primary-expression before '>>' token
    6 |   cin >>  >> h >> n;
      |           ^~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;

int main(){
  	int x,y,a;
	int w,h,n;
  	cin>>w>>h>>n;
  	int xmax=0;xmin=w,ymax=0,ymin=h;
  	for(int i=1;i<=n;++i){
    	cin>>x>>y>>a;
      	if(a==1)xmax=max(xmax,x);
      	else if(a==2)xmin=min(xmin,x);
      	else if(a==3)ymax=max(ymax,y);
      	else ymin=min(ymin,y);
    }
  	int ans=(xmin-xmax)*(ymin-ymax);
  	if(ans<0)ans=0;
  	cout<<ans<<endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: 'xmin' was not declared in this scope
    9 |         int xmax=0;xmin=w,ymax=0,ymin=h;
      |                    ^~~~
a.cc:9:27: error: 'ymax' was not declared in this scope; did you mean 'xmax'?
    9 |         int xmax=0;xmin=w,ymax=0,ymin=h;
      |                           ^~~~
      |                           xmax
a.cc:9:34: error: 'ymin' was not declared in this scope
    9 |         int xmax=0;xmin=w,ymax=0,ymin=h;
      |                                  ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int W, H, N;
  cin >> W >> H >> N;
  int bigx, smallx, bigy, smally;
  bigx = W, smallx = 0, bigy = H, smally = 0;
  int x, y, a;
  cin >> x >> y >> a;
  for (int i = 0; i < N; i++) {
    if (a == 1) {
      smallx = max(smallx, x);
    }
    else if (a == 2) {
      bigx = min(bigx, x);
    }
    else if (a == 3) {
      smally = max(smally, y);
    }
    else {
      bigy = min(bigy, y);
    }
  }
  cout << max(0, bigx - smallx) * max(0, bigy - smally) << endl;
}
}


Compiler output:
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
    int W, H, N;
    cin >> W >> H >> N;
    int tile[100][100];//[high(y)][width(x)]
    memset(tile, 0, sizeof(tile));//塗られていないのを0とする

    int counter=0;
    for(int i=0; i<N; i++){
        int x, y, a;
        cin >> x >> y >> a;
        if(a==1){
            for(int j=0; j<x; j++){
                for(int k=0; k<H; k++){
                    if(tile[k][j]==0){
                        tile[k][j]++;
                        counter++;
                    }
                }
            }
        }else if(a==2){
            for(int j=W-1; j>=x; j--){
                for(int k=0; k<H; k++){
                    if(tile[k][j]==0){
                        tile[k][j]++;
                        counter++;
                    }
                }
            }
        }else if(a==3){
            for(int j=0; j<W; j++){
                for(int k=0; k<y; k++){
                    if(tile[k][j]==0){
                        tile[k][j]++;
                        counter++;
                    }
                }
            }
        }else{
            for(int j=0; j<W; j++){
                for(int k=H-1; k>=y; k--){
                    if(tile[k][j]==0){
                        tile[k][j]++;
                        counter++;
                    }
                }
            }
        }
    }
    cout << H*W-counter << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'memset' was not declared in this scope
   11 |     memset(tile, 0, sizeof(tile));//塗られていないのを0とする
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    int w, h, n;

	cin >> w >> h >> n;

	int left = 0;
	int right = w;
	int top = h;
	int bottom = 0;

	int i;

	rep(i, n) {
		cin >> x >> y >> a;

		if (a == 1) Max(left, x);
		else if (a == 2) Min(right, x);
		else if (a == 3) Max(bottom, y);
		else if (a == 4) Min(top, y);
	}

	Out(max(0, right - left) * max(0, top - bottom));
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:79:24: error: 'x' was not declared in this scope
   79 |                 cin >> x >> y >> a;
      |                        ^
a.cc:79:29: error: 'y' was not declared in this scope
   79 |                 cin >> x >> y >> a;
      |                             ^
a.cc:79:34: error: 'a' was not declared in this scope
   79 |                 cin >> x >> y >> a;
      |                                  ^
Language: Java

import java.util.*;
public class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
  String po=sc.nextLine();
  int w=sc.nextInt();int h=sc.nextInt();
  int n=sc.nextInt();
  int po[][]=new int[w][h];
  for(int i=0;i<n;i++){
  	int a=sc.nextInt();int b=sc.nextInt();int c=sc.nextInt();
    if(c==1){
      for(int j=0;j<h;j++){
      	for(int k=0;k<a;k++){
        	po[k][j]=1;
        }
      }
    }
    else if(c==2){
      for(int j=0;j<h;j++){
      	for(int k=a;k<w;k++){
        	po[k][j]=1;
        }
      }
    }
    else if(c==3){
      for(int j=0;j<b;j++){
      	for(int k=0;k<w;k++){
        	po[k][j]=1;
        }
      }
    }
    else{
      for(int j=b;j<h;j++){
      	for(int k=0;k<w;k++){
        	po[k][j]=1;
        }
      }
    }
  }
  int count=0;
  for(int i=0;i<w;i++){
  for(int j=0;j<h;j++){
  if(po[j][i]==1){
  count++;
  }
  }
  }
  System.out.println(count);
}
}


Compiler output:
Main.java:8: error: variable po is already defined in method main(String[])
  int po[][]=new int[w][h];
      ^
1 error
Language: C++

import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )
import Control.Monad (replicateM)

cReadLn :: IO Int
cReadLn = fst . fromJust . C.readInt <$> C.getLine

getParms :: IO [Int]
getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  [w,h,n] <- getParms              :: IO [Int]
  xya     <- replicateM n getParms :: IO [[Int]]
  print $ uncurry area $ f w h xya

type Range = (Int,Int)

initialize
  :: Int -> Int -> (Range, Range)
initialize w h = ((0, w), (0, h))

cut :: (Range, Range) -> [Int] -> (Range, Range) 
cut (xx@(xi,xf),yy@(yi,yf)) [x,y,a]
  | a == 1 = ((max x xi, xf), yy)
  | a == 2 = ((xi, min x xf), yy)
  | a == 3 = (xx, (max y yi, yf))
  | a == 4 = (xx, (yi, min y yf))

f :: Int -> Int -> [[Int]] -> (Range, Range)
f w h = foldl cut (initialize w h) 

area :: Range -> Range -> Int
area (xi,xf) (yi,yf) 
  | xi < xf && yi < yf = (xf-xi)*(yf-yi)
  | otherwise          = 0

Compiler output:
a.cc:24:8: error: stray '@' in program
   24 | cut (xx@(xi,xf),yy@(yi,yf)) [x,y,a]
      |        ^
a.cc:24:19: error: stray '@' in program
   24 | cut (xx@(xi,xf),yy@(yi,yf)) [x,y,a]
      |                   ^
a.cc:1:1: error: 'import' does not name a type
    1 | import qualified Data.ByteString.Char8 as C
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C

#include<stdio.h>

int main()
{
	int i=0,xi,yi,a,N;
	int wl,wr,hu,hd,W,H;
    scanf("%d %d %d",&W,&H,&N);
    int wl=0,hd=0,wr=W,hu=H;
    for(i=0;i<N;i++)
    {
    	scanf("%d %d %d",&xi,&yi,&a);
    	if(a==1)
    	{
    		wl=xi;
		}
		else if(a==2)
		{
			wr=xi;
		}
		else if(a==3)
		{
			hd=yi;
		}
		else
		{
			hu=yi;
		}
		
	}
	if((wl>=wr)||(hd>=hu))
	{
		printf("0");
	}
	else
	printf("%d",(hu-hd)*(wr-wl));
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:9: error: redeclaration of 'wl' with no linkage
    8 |     int wl=0,hd=0,wr=W,hu=H;
      |         ^~
main.c:6:13: note: previous declaration of 'wl' with type 'int'
    6 |         int wl,wr,hu,hd,W,H;
      |             ^~
main.c:8:14: error: redeclaration of 'hd' with no linkage
    8 |     int wl=0,hd=0,wr=W,hu=H;
      |              ^~
main.c:6:22: note: previous declaration of 'hd' with type 'int'
    6 |         int wl,wr,hu,hd,W,H;
      |                      ^~
main.c:8:19: error: redeclaration of 'wr' with no linkage
    8 |     int wl=0,hd=0,wr=W,hu=H;
      |                   ^~
main.c:6:16: note: previous declaration of 'wr' with type 'int'
    6 |         int wl,wr,hu,hd,W,H;
      |                ^~
main.c:8:24: error: redeclaration of 'hu' with no linkage
    8 |     int wl=0,hd=0,wr=W,hu=H;
      |                        ^~
main.c:6:19: note: previous declaration of 'hu' with type 'int'
    6 |         int wl,wr,hu,hd,W,H;
      |                   ^~
Language: C

#include<stdio.h>

int main(){
  int W, H, N, x, y, a, i, l, r, u, d;
  
  scanf("%d %d %d", &W, &H, &N);
  l = d = 0;
  u = H;
  r = 
  for (i = 0; i < N; i++){
    scanf("%d %d %d", x, y, a);
    if(a == 1 && l < x){
      l = x;
    } else if(a == 2 && r > x){
      r = x;
    } else if(a == 3 && d < y){
      d = y;
    } else if(a == 4 && u > y){
      u = y;
    }
  }
  
  if(u > d && r > l){
    printf("%d\n", (u - d)*(r - l));
  } else {
    printf("0\n");
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:3: error: expected expression before 'for'
   10 |   for (i = 0; i < N; i++){
      |   ^~~
Language: C++

#include <iostream>
using namespace std;
int main(){
  int W, H ,N;
  cin >> W >> H >> N;
  int A[101][101];
  for(int i = 0; i < W; i++){
    for(int j = 0; j < H; j++){
      A[i][j] = false;
    }
  }
  int x, y, a;
  for(int i = 0; i < N; i++){
    cin >> x >> y >> a;
    if(a == 1){
      for(int i = 0; i < W; i++){
        for(int j = 0; j < x; j++){
          A[i][j] = true;
        }
      }
    }
    if(a == 2){
      for(int i = x; i < W; i++){
        for(int j = 0; j < x; j++){
          A[i][j] = true;
        }
      }
    }
    if(a == 3){
      for(int i = 0; i < H; i++){
        for(int j = 0; j < y; j++){
          A[i][j] = true;
        }
      }
    }
    if(a == 4){
      for(int i = y; i < H; i++){
        for(int j = 0; j < y; j++){
          A[i][j] = true;
        }
      }
    }
  }
  int count = 0;
  for(int i = 0; i < W; i++){
    for(int j = 0; j < H; j++){
      if(A[i][j] == false){
        count = count + 1;
      }
    }
  }
  cout << count << endl;
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:53:12: error: expected '}' at end of input
   53 |   return 0;
      |            ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
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 >> w >> 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 < h+1; i++){
        for(int j = 1; j < w; j++){
            p[i][j] = 1;
        }
    }
    for(int i = 1; i < n+1; i++){
        if(a[i] == 1){
            for(int j = 1; j < h+1; j++){
                for(int k = 1; k < x[i]; k++){
                    p[j][k] = 0;
                }
            }
        } else if(a[i] == 2){
            for(int j = 1; j < h+1; j++){
                for(int k = x[i]+1; k < w+1; k++){
                    p[j][k] = 0;
                }
            }
        } else if(a[i] == 3){
            for(int j = 1; j < y[i]; j++){
                for(int k = 1; k < w+1; k++){
                    p[j][k] = 0;
                }
            }
        } else {
            for(int j = y[i]+1; j < h+1; j++){
                for(int k = 1; k < w+1; k++){
                    p[j][k] = 0;
                }
            }
        }
    }
    int count = 0;
    for(int i = 1; i < h+1; i++){
        for(int j = 1; j < w+1; j++){
            if(p[i][k]) count++;
        }
    }
    cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:21: error: 'k' was not declared in this scope
   53 |             if(p[i][k]) count++;
      |                     ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
	int w,h,n;
	cin >> w >> h >> n;
	int x[n],y[n],a[n];
	for(int i=0; i<n; i++) cin >> x[i] >> y[i] >> a[i];

	int ox = 0;
	int oy = 0;
	int px = w;
	int py = h;

	for(int i=0; i<n; i++){
		if(a[i] == 1) ox = x[i];
		else if(a[i] == 2) px = x[i];
		else if(a[i] == 3) oy = y[i];
		else if(a[i] == 4) py = y[i];
	}
	int ans = (px-ox)*(py-oy)
	cout << ans << endl;

	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: expected ',' or ';' before 'cout'
   23 |         cout << ans << endl;
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int w, h, n;
  cin >> w >> h >> n;
  vector<int> x(n);
  vector<int> y(n);
  vector<int> a(n);
  for (int i = 0; i < n; i ++) {
    cin >> x.at(i) >> y.at(i) >> a.at(i);
  }

  int k = 0, l = w, m = 0, n = h;
  for (int i = 0; i < n; i ++) {
    if (a.at(i) == 1) {
      k = max(k, x.at(i));
    } else if (a.at(i) == 2) {
      l = min(l, x.at(i));
    } else if (a.at(i) == 3) {
      m = max(m, y.at(i));
    } else {
      n = min(n, y.at(i));
    }
  }

  if (l - k > 0 && n - m > 0) {
    cout << (l - k) * (n - m) << endl;
  } else {
    cout << 0 << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:28: error: redeclaration of 'int n'
   14 |   int k = 0, l = w, m = 0, n = h;
      |                            ^
a.cc:5:13: note: 'int n' previously declared here
    5 |   int w, h, n;
      |             ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>

using namespace std;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    int w, h, n;
    cin >> w >> h >> n;

    int ue = h, sita = 0, hidari = 0, migi = w;
    REP(i, n){
        cin >> x >> y >> a;
        if(a == 1){
            hidari = max(hidari, x);
        }
        else if(a == 2){
            migi = min(migi, x);
        }
        else if(a == 3){
            sita = max(sita, y);
        }
        else{
            ue = min(ue, y);
        }
    }

    cout << max(migi - hidari, 0)*max(ue -sita, 0) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:16: error: 'x' was not declared in this scope
   27 |         cin >> x >> y >> a;
      |                ^
a.cc:27:21: error: 'y' was not declared in this scope
   27 |         cin >> x >> y >> a;
      |                     ^
a.cc:27:26: error: 'a' was not declared in this scope
   27 |         cin >> x >> y >> a;
      |                          ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>

using namespace std;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    int w, h, n;
    cin >> w >> h >> n;

    int ue = h, sita = 0, hidari = 0, migi = w;
    REP(i, n){
        cin >> x >> y >> a;
        if(a[i] == 1){
            hidari = max(hidari, x);
        }
        else if(a[i] == 2){
            migi = min(migi, x);
        }
        else if(a[i] == 3){
            sita = max(sita, y);
        }
        else{
            ue = min(ue, y);
        }
    }

    cout << max(migi - hidari, 0)*max(ue -sita, 0) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:16: error: 'x' was not declared in this scope
   27 |         cin >> x >> y >> a;
      |                ^
a.cc:27:21: error: 'y' was not declared in this scope
   27 |         cin >> x >> y >> a;
      |                     ^
a.cc:27:26: error: 'a' was not declared in this scope
   27 |         cin >> x >> y >> a;
      |                          ^