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

#include<bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(void){
  int W, H, N;
  cin>>W>>H>>N;
  vector<int> x_min(1,0), x_max(1,W), y_min(1,0), y_max(1,H);
  int i,j;
  int tmp[3];
  for(i=0;i<N;i++){
    cin>>tmp[0]>>tmp[1]>>tmp[2];
    if(tmp[2]==1) x_min.push_back(tmp[0]);
    if(tmp[2]==2) x_max.push_back(tmp[0]);
    if(tmp[2]==3) y_min.push_back(tmp[1]);
    if(tmp[2]==4) y_max.push_back(tmp[1]);
  }

  sort(x_min.begin(),x_min.end());
  sort(x_max.begin(),x_max.end());
  sort(y_min.begin(),y_min.end());
  sort(y_max.begin(),y_max.end());

  if (x_max.front()<x_min.back() or y_max.front()<y_min.back()){
    cout<<0;
    exit(0)
  }
  cout<<max(0,((x_max.front()-x_min.back())*(y_max.front()-y_min.back())));
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:12: error: expected ';' before '}' token
   25 |     exit(0)
      |            ^
      |            ;
   26 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int c[101][101];
int b[101];
int main(){
	int W,H,N,x,y,a;
	cin>>W>>H>>N;
	for(int n=1;n<=N;n++){
		cin>>x>>y>>a;
		if(a==1){
			for(int i=0;i<x;i++){
				for(int j=0;j<H;j++)
				c[i][j]=1;
			}
		}
		else if(a==2){
			for(int i=x;i<W;i++){
				for(int j=0;j<H;j++)
				c[i][j]=1;
			}
		}
		else if(a==3){
			for(int i=0;i<W;i++){
				for(int j=0;j<y;j++)
				c[i][j]=1;
			}
		}
		else if(a==4){
			for(int i=0;i<W;i++){
				for(int j=y;j<H;j++)
				c[i][j]=1;
			}
		}
	}
	int ans=0;
	for(int i=0;i<W;i++){
		for(j=0;j<H;j++)
		if(!c[i][j]) ans++;
	}
	cout<<ans;
	return 0;
}
//若 1，则将满足 的小矩形涂黑。 
//若 2，则将满足 的小矩形涂黑。 
//若 3，则将满足 的小矩形涂黑。 
//若 4，则将满足 的小矩形涂黑。

Compiler output:
a.cc: In function 'int main()':
a.cc:37:21: error: 'j' was not declared in this scope
   37 |                 for(j=0;j<H;j++)
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[101][101];
int b[101];
int main(){
	int W,H,N,x,y,a;
	cin>>W>>H>>N;
	for(int n=1;n<=N;n++){
		cin>>x>>y>>a;
		if(a==1){
			for(int i=0;i<x;i++){
				for(int j=0;j<H;j++)
				c[i][j]=1;
			}
		}
		else if(a==2){
			for(int i=x;i<W;i++){
				for(int j=0;j<H;j++)
				c[i][j]=1;
			}
		}
		else if(a==3){
			for(int i=0;i<W;i++){
				for(int j=0;j<y;j++)
				c[i][j]=1;
			}
		}
		else if(a==4){
			for(int i=0;i<W;i++){
				for(int j=y;j<H;j++)
				c[i][j]=1;
			}
		}
	}
	int ans=0;
	for(int i=0;i<W;i++){
		for(j=0;j<H;j++)
		if(!c[i][j]) ans++;
	}
	cout<<ans;
	return 0;
}
//若 1，则将满足 的小矩形涂黑。 
//若 2，则将满足 的小矩形涂黑。 
//若 3，则将满足 的小矩形涂黑。 
//若 4，则将满足 的小矩形涂黑。

Compiler output:
a.cc: In function 'int main()':
a.cc:13:33: error: 'c' was not declared in this scope
   13 |                                 c[i][j]=1;
      |                                 ^
a.cc:19:33: error: 'c' was not declared in this scope
   19 |                                 c[i][j]=1;
      |                                 ^
a.cc:25:33: error: 'c' was not declared in this scope
   25 |                                 c[i][j]=1;
      |                                 ^
a.cc:31:33: error: 'c' was not declared in this scope
   31 |                                 c[i][j]=1;
      |                                 ^
a.cc:37:21: error: 'j' was not declared in this scope
   37 |                 for(j=0;j<H;j++)
      |                     ^
a.cc:38:21: error: 'c' was not declared in this scope
   38 |                 if(!c[i][j]) ans++;
      |                     ^
Language: C++

// 別解
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
  int W,H,N;
  cin>>W>>H>>N;
  
  int xmax=W
  int xmin=0;
  int ymax=H;
  int ymin=0;
 
  for(int i=0;i<N;++i){
    int x,y,a;
    cin>>x>>y>>a;
    
    if(a==1){
      if(xmin<=x)
        xmin=x;
    }
    
    if(a==2){
      if(x<=xmax)
        xmax=x;
    }
    
    if(a==3){
      if(ymin<=y)
        ymin=y;
    }
    
    if(a==4){
      if(y<=ymax)
        ymax=y;
    }
  }
  
  int yoko=xmax-xmin;
  int tate=ymax-ymin;
  
  if(yoko<=0 || tate<=0)
    cout<<0<<endl;
  else
    cout<<tate*yoko<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: expected ',' or ';' before 'int'
   11 |   int xmin=0;
      |   ^~~
a.cc:20:10: error: 'xmin' was not declared in this scope; did you mean 'ymin'?
   20 |       if(xmin<=x)
      |          ^~~~
      |          ymin
a.cc:40:17: error: 'xmin' was not declared in this scope; did you mean 'ymin'?
   40 |   int yoko=xmax-xmin;
      |                 ^~~~
      |                 ymin
Language: C

#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int xx, yy, n;
	int x[120], y[120], a[120];
	while(~scanf("%d %d %d", &xx, &yy, &n))
	{
		int i;
		int ans = 0;
		int x1 = 0, x2 = xx, y1 = 0, y2 = yy;
		for(i = 0; i < n; i++)
		{
			scanf("%d %d %d", &x[i], &y[i], &a[i]);
			if(a[i] == 1)
			x1 = max(x1, x[i]);
			if(a[i] == 2)
			x2 = min(x2, x[i]);
			if(a[i] == 3)
			y1 = max(y1, y[i]);
			if(a[i] == 4)
			y2 = min(y2, y[i]);
		}
		ans = (x2 - x1) * (y2 - y1);
		if((x1 >= x2) || (y1 >= y2)) ans = 0;
		printf("%d\n", ans);
	}

}

Compiler output:
main.c:2:9: fatal error: iostream: No such file or directory
    2 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

//
// Created by Tzyark on 2018/9/19.
//
#include <iostream>
using namespace std;
int c[101][101];
int main() {
    int W, H, N, x, y, a;
    cin >> W >> H >> N;
    memset(c, 0, sizeof(c));
    for (int n = 0; n < N; n++) {
        cin >> x >> y >> a;
        if (a == 1) {
            for (int i = 0; i < x; i++) {
                for (int j = 0; j < H; j++) {
                    c[i][j] = 1;
                }
            }
        } else if (a == 2) {
            for (int i = x; i < W; i++) {
                for (int j = 0; j < H; j++) {
                    c[i][j] = 1;
                }
            }
        } else if (a == 3) {
            for (int i = 0; i < W; i++) {
                for (int j = 0; j < y; j++) {
                    c[i][j] = 1;
                }
            }
        } else if (a == 4) {
            for (int i = 0; i < W; i++) {
                for (int j = y; j < H; j++) {
                    c[i][j] = 1;
                }
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < W; i++) {
        for (int j = 0; j < H; j++) {
            if (!c[i][j]) ans ++;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'memset' was not declared in this scope
   10 |     memset(c, 0, sizeof(c));
      |     ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <iostream>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
main()
{
  int w, h, n;
  cin >> w >> h >> n;
  int x, y, a, g, j, k, l;
  g = j = 0;
  k = w;
  l = h;
  for (int i = 0;i<n;i++){
    cin >> x >> y >> a;
    if(a==1&&g<x)
      g = x;
      else if(a==2&&k>x)
        k = x;
        else if(a==3&&j<y)
          j = y;
          else if(a==4&&l>y)
            l = y;
  }
  if(g>=k||j>=l)
    cout << 0 << endl;
    else
      cout << (k - g)(l - j) << endl;
}


Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:25:22: error: expression cannot be used as a function
   25 |       cout << (k - g)(l - j) << endl;
      |               ~~~~~~~^~~~~~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<time.h>
#include<ctime>
#include<functional>
#define int long long
#define itn int
using namespace std;
typedef pair<int, int> P;
int main() {
	int w, h, n, x[100][100]={},a;
	cin >> w >> h >> n;
	for (int i = 0; i < n;i++) {
		int a, b, c;
		cin >> a >> b >> c;
		if (c == 1) {
			for (int j = 0; j < a; j++) {
				for (int k = 0; k < h; k++) {
					x[j][k] = 1;
				}
			}
		}
		if (c == 2) {
			for (int j = a; j < w; j++) {
				for (int k = 0; k < h; k++) {
					x[j][k] = 1;
				}
			}
		}
		if (c == 3) {
			for (int j = 0; j < w; j++) {
				for (int k = 0; k < b; k++) {
					x[j][k] = 1;
				}
			}
		}
		if (c == 4) {
			for (int j = 0; j < w; j++) {
				for (int k = b; k < h; k++) {
					x[j][k] = 1;
				}
			}
		}
	}
	for (int i = 0; i < w; i++) {
		for (int j = 0; j < h; j++) {
			if (x[i][j] == 0) {
				a++;
			}
		}
	}
	cout << a << endl;
	return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<time.h>
#include<ctime>
#include<functional>
#define int long long
#define itn int
using namespace std;
typedef pair<int, int> P;
int main() {
	int w, h, n, x[100][100]={},a;
	cin >> w >> h >> n;
	for (int i = 0; i < n;i++) {
		int a, b, c;
		cin >> a >> b >> c;
		if (c == 1) {
			for (int j = 0; j < a; j++) {
				for (int k = 0; k < h; k++) {
					x[j][k] = 1;
				}
			}
		}
		if (c == 2) {
			for (int j = a; j < w; j++) {
				for (int k = 0; k < h; k++) {
					x[j][k] = 1;
				}
			}
		}
		if (c == 3) {
			for (int j = 0; j < w; j++) {
				for (int k = 0; k < b; k++) {
					x[j][k] = 1;
				}
			}
		}
		if (c == 4) {
			for (int j = 0; j < w; j++) {
				for (int k = b; k < h; k++) {
					x[j][k] = 1;
				}
			}
		}
	}
	for (int i = 0; i < w; i++) {
		for (int j = 0; j < h; j++) {
			if (x[i][j] == 0) {
				a++;
			}
		}
	}
	cout << a << endl;
	getchar();
	getchar();
	return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int W,H,N,a;
  cin >> W >> H >> N;
  int xy[W][H];
  for(int i=0;i<W;i++){
    for(int j=0;j<H;j++){
      xy[i][j] = 0;
    }
  }
  int x,y,a;
  cin >> x >> y >> a;
  if(a==1){
    for(int i=0;i<x;i++){
      for(int j=0;j<H;j++){
        xy[i][j] = 1;
      }
    }
  }
  else if(a==2){
    for(int i=x;i<W;i++){
      for(int j=0;j<H;j++){
        xy[i][j] = 1;
      }
    }
  }
  else if(a==3){
    for(int i=0;i<W;i++){
      for(int j=0;j<y;j++){
        xy[i][j] = 1;
      }
    }
  }
  else if(a==4){
    for(int i=0;i<W;i++){
      for(int j=y;j<H;j++){
        xy[i][j] = 1;
      }
    }
  }
  int XMin=101,YMin=101,XMax=0,YMax=0;
  for(int i=0;i<W;i++){
    for(int j=0;j<H;j++){
      if(xy[i][j]==0){
        XMin = min(XMin,i);
        XMax = max(XMax,i);
        YMin = min(YMin,j);
        YMax = max(YMax,j);
      }
    }
  }
  cout << (XMax - XMin) * (YMax - YMin) << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:11: error: redeclaration of 'int a'
   31 |   int x,y,a;
      |           ^
a.cc:23:13: note: 'int a' previously declared here
   23 |   int W,H,N,a;
      |             ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  int W,H,N;
  cin >> W >> H >> N;
  int x,y,a;
  int xmax,xmin,ymax,ymin;
  xmin = 0;
  xmax = W;
  ymin = 0;
  ymax = H;
  for(int i = 0; i < N; i++){
    cin >> x >> y >> a;
    switch(a){
      case 1:
        if(xmin < x) xmin = x;
        break;
      case 2:
        if(xmax > x) xmax = x;
        break;
      case 3:
        if(ymin < y) ymin = y;
        break;
      case 4:
        if(ymax > y) ymax = y;
        break;
    }
  }
  int xans = xmax-xmin;
  int yans = ymax-ymin;
  if(xans>=0 && yans>=0) printf("%d\n",xans*yanss);
  else printf("%d\n",0);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:45: error: 'yanss' was not declared in this scope; did you mean 'yans'?
   32 |   if(xans>=0 && yans>=0) printf("%d\n",xans*yanss);
      |                                             ^~~~~
      |                                             yans
Language: C++

#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>

int main(void) {
  int W,H,N;

  std::cin >> W >> H >> N;
  
  int map[100][100] = {0};

  for (int i = 0; i < N; ++i) {
    int x, y, a;
    std::cin >> x >> y >> a;
    switch (a) {
      case 1:
        for (int i = 0; i < x; i++) {
          for (int j = 0; j < H; j++) {
            map[i][j] = 1;
          }
        }
        break;
      case 2:
        for (int i = x; i < W; i++) {
          for (int j = 0; j < H; j++) {
            map[i][j] = 1;
          }
        }
        break;
      case 3:
        for (int i = 0; i < W; i++) {
          for (int j = 0; j < y; j++) {
            map[i][j] = 1;
          }
        }
        break;
      case 4:
        for (int i = 0; i < W; i++) {
          for (int j = y; j < H; j++) {
            map[i][j] = 1;
          }
        }
        break;
      default:
        break;
    }
  }

  int count = 0;
  for (int i = 0; i < W; i++) {
    for (int j = y; j < H; j++) {
      if (map[i][j] == 0) {
        count++;
      }
    }
  }
  
  std::cout << count << std::endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:18: error: 'y' was not declared in this scope
   52 |     for (int j = y; j < H; j++) {
      |                  ^
Language: C++

#include <iostream>

using std::cin;
using std::cout;
using std::endl;

int main() {
  int w, h, n, s;
  // 長方形を作るx座標の左端、右端を表す（xp[0]: 右, xp[1]: 左）
  int xp[2];
  // 長方形を作るy座標の上端、下端を表す（yp[0]: 上, yp[1]: 下）
  int yp[2];
  cin >> w >> h >> n;

  // 初期位置をセット
  xp[0] = w;
  xp[1] = 0;
  yp[0] = h;
  yp[1] = 0;

  for (int i = 0; i < n; i++) {
    int x, y, a;
    cin >> x >> y >> a;

    if (a == 1　&& xp[1] < x) {
      xp[1] = x;
    } else if (a == 2 && xp[0] > x) {
      xp[0] = x;
    } else if (a == 3 && yp[1] < y) {
      yp[1] = y;
    } else if(yp[0] > y){
      yp[0] = y;
    }
  }

  if ((xp[0] - xp[1]) <= 0 || (yp[0] - yp[1] <= 0)) {
    cout << 0 << endl;
  } else {
    s = (xp[0] - xp[1]) * (yp[0] - yp[1]);
    cout << s << endl;
  }

  return 0;
}


Compiler output:
a.cc:25:14: error: extended character 　 is not valid in an identifier
   25 |     if (a == 1　&& xp[1] < x) {
      |              ^
a.cc: In function 'int main()':
a.cc:25:14: error: unable to find numeric literal operator 'operator""\U00003000'
   25 |     if (a == 1　&& xp[1] < x) {
      |              ^~~
Language: C++

#include <iostream>

using std::cin;
using std::cout;
using std::endl;

int main() {
  int w, h, n, s;
  // 長方形を作るx座標の左端、右端を表す（xp[0]: 右, xp[1]: 左）
  int xp[2];
  // 長方形を作るy座標の上端、下端を表す（yp[0]: 上, xp[1]: 下）
  int yp[2];
  cin >> w >> h >> n;

  xp[0] = w;
  xp[1] = 0;
  yp[0] = h;
  yp[1] = 0;

  for (int i = 0; i < n; i++) {
    int x, y, a;
    cin >> x >> y >> a;

    if (a == 1) {
      if (xp[1] > x) {
        xp[1] = x;
      }

    } else if (a == 2) {
      if (xp[0] > x) {
        xp[0] = x;
      }
    } else if (a == 3) {
      if (yp[1] > y)　{
        yp[1] = y;
      }
    }
    else {
      if (yp[0] > y) {
        yp[0] = y;
      }
    }
  }

  if ((xp[0] - xp[1]) <= 0 || (yp[0] - yp[1] <= 0)) {
    cout << 0 << endl;
  } else {
    s = (xp[0] - xp[1]) * (yp[0] - yp[1]);
    cout << s << endl;
  }

  return 0;
}


Compiler output:
a.cc:34:21: error: extended character 　 is not valid in an identifier
   34 |       if (yp[1] > y)　{
      |                     ^
a.cc: In function 'int main()':
a.cc:34:21: error: '\U00003000' was not declared in this scope
   34 |       if (yp[1] > y)　{
      |                     ^~
Language: C++

#include <iostream>

using std::cin;
using std::cout;
using std::endl;

int main() {
  int w, h, n, s;
  // 長方形を作るx座標の左端、右端を表す（x[0]: 右, x[1]: 左）
  int xp[2];
  // 長方形を作るy座標の上端、下端を表す（y[0]: 上, x[1]: 下）
  int yp[2];
  cin >> w >> h >> n;

  xp[0] = w;
  xp[1] = 0;
  yp[0] = h;
  yp[1] = 0;

  for (int i = 0; i < n; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    if (a == 1) {
      xp[1] = x;
    } else if (a == 2) {
      xp[0] = x;
    } else if (a == 3) {
      yp[1] = y;
    } else {
      yp[0] = y;
    }
  }

  if (xp[0] - xp[1]) > 0 && yp[0] - yp[1] > 0) {
    s = (xp[0] - xp[1]) * (yp[0] - yp[1]);
    cout << s << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:22: error: expected primary-expression before '>' token
   34 |   if (xp[0] - xp[1]) > 0 && yp[0] - yp[1] > 0) {
      |                      ^
Language: Java

import java.util.Scanner;

public class SnukesColoring2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int n = sc.nextInt();
        int[] x = new int [n];
        int[] y = new int [n];
        int[] a = new int [n];
        for (int i = 0 ; i < n ; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
            a[i] = sc.nextInt();
        }

        int minX = 0;
        int maxX = w;
        int minY = 0;
        int maxY = h;
        for (int i = 0 ; i < n ; i++) {
            if (a[i] == 1) {
                minX = Math.max(minX, x[i]);
            } else if (a[i] == 2) {
                maxX = Math.min(maxX, x[i]);
            } else if (a[i] == 3) {
                minY = Math.max(minY, y[i]);
            } else {
                maxY = Math.min(maxY, y[i]);
            }
        }
        if (minX >= maxX || minY >= maxY) {
            System.out.println(0);
        } else {
            System.out.println((maxX - minX) * (maxY - minY));
        }
    }

}

Compiler output:
Main.java:3: error: class SnukesColoring2 is public, should be declared in a file named SnukesColoring2.java
public class SnukesColoring2 {
       ^
1 error
Language: C++

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

int main() {
	int W, H, N;
	cin >> W >> H >> N;
	int xf = 0;
	int yf = 0;
	for(int i = 0;i < N;i++){
		int x, y, a;
		cin >> x >> y >> a;
		if(a == 1){
			W -= x - xf;
			xf += x - xf;
		}
		else if(a == 2){
			if(W + xf > x){
			W = x - xf;
			}
		}
		else if(a == 3){
			H -= y - yf;
			yf += y - yf;
		}
		else if(a == 4){
			if(H + yf > y){
			H = y - yf;
			}
		}
	}
	if(W < 1 || H < 1){
		cout << 0 << endl;
		return 0;
	}
	cout << W*H << endl;
}#include <bits/stdc++.h>
using namespace std;

int main() {
	int W, H, N;
	cin >> W >> H >> N;
	int xf = 0;
	int yf = 0;
	for(int i = 0;i < N;i++){
		int x, y, a;
		cin >> x >> y >> a;
		if(a == 1){
			W -= x - xf;
			xf += x - xf;
		}
		else if(a == 2){
			if(W + xf > x){
			W = x - xf;
			}
		}
		else if(a == 3){
			H -= y - yf;
			yf += y - yf;
		}
		else if(a == 4){
			if(H + yf > y){
			H = y - yf;
			}
		}
	}
	if(W < 1 || H < 1){
		cout << 0 << endl;
		return 0;
	}
	cout << W*H << endl;
}#include <bits/stdc++.h>
using namespace std;

int main() {
	int W, H, N;
	cin >> W >> H >> N;
	int xf = 0;
	int yf = 0;
	for(int i = 0;i < N;i++){
		int x, y, a;
		cin >> x >> y >> a;
		if(a == 1){
			W -= x - xf;
			xf += x - xf;
		}
		else if(a == 2){
			if(W + xf > x){
			W = x - xf;
			}
		}
		else if(a == 3){
			H -= y - yf;
			yf += y - yf;
		}
		else if(a == 4){
			if(H + yf > y){
			H = y - yf;
			}
		}
	}
	if(W < 1 || H < 1){
		cout << 0 << endl;
		return 0;
	}
	cout << W*H << endl;
}

Compiler output:
a.cc:36:2: error: stray '#' in program
   36 | }#include <bits/stdc++.h>
      |  ^
a.cc:71:2: error: stray '#' in program
   71 | }#include <bits/stdc++.h>
      |  ^
a.cc:36:3: error: 'include' does not name a type
   36 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:39:5: error: redefinition of 'int main()'
   39 | int main() {
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main() {
      |     ^~~~
a.cc:71:3: error: 'include' does not name a type
   71 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:74:5: error: redefinition of 'int main()'
   74 | int main() {
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main() {
      |     ^~~~
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)*(shang-xia)<=0)
    {
        cout<<0<<endl;
        return 0;
    }
    cout<<(you-zuo)*(shang-xia)<<endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:16: error: invalid type argument of unary '*' (have 'int')
   23 |     if(you-zuo)*(shang-xia)<=0)
      |                ^~~~~~~~~~~~
Language: C++

// バケット法による解
#include <iostream>
#include <string>
using namespace std;

int main() {
    int W, H, N;
    cin >> W >> H >> N;
    int XY[N][3];
    for (int i = 0; i < N; ++i) cin >> XY[i][0] >> XY[i][1] >> XY[i][2];

    int a[4] = {0};  // バケット
    a[0] = 0; // left
    a[1] = W; // right
    a[2] = 0; // bottom
    a[3] = H; // top
    for (int i = 0; i < N; ++i) {
        if (XY[i][2]==0+1 & a[0]<=XY[i][0]) a[0] = XY[i][0];
        if (XY[i][2]==1+1 & a[1]>=XY[i][0]) a[1] = XY[i][0];
        if (XY[i][2]==2+1 & a[2]<=XY[i][1]) a[2] = XY[i][1];
        if (XY[i][2]==3+1 & a[3]>=XY[i][1]) a[3] = XY[i][1];
    }
    
    for (int i = 0; i < 4; ++i) {
        //cout << a[i] << endl;
    }
    int area = (a[1] - a[0]) * (a[3] - a[2])
    if (a[1] - a[0] <=0 | a[3] - a[2]) area = 0;
    cout << (a[1] - a[0]) * (a[3] - a[2]) << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: expected ',' or ';' before 'if'
   28 |     if (a[1] - a[0] <=0 | a[3] - a[2]) area = 0;
      |     ^~
Language: C++

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

int main (void) {
  int W=0, H=0, N=0;
  cin >> W >> H >> N;
  int x=0,y=0,a=0;
  int W1=0, W2=0, H1=0, H2=0; 
  for (int i=0; i<N; i++) {
    cin >> x >> y >> a;
    switch (a) {
      case 1:
        W1=max(W1,x);
        break;
      case 2:
        W2=max(W2,W-x);
        break;
      case 3:
        H1=max(H1,y);
        break;
      case 4:
        H2=max(H2,H-y);
        break;   
    }
  }
  int ans = max(0,(W-W1-W2)*(H-H1-H2));
  cout << ans;
  }
}

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

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

int main (void) {
  int W=0, H=0, N=0;
  cin >> W >> H >> N;
  int x,y,a=0;
  int W1=0, W2=0, H1=0, H2=0; 
  for (int i=0; i<N; i++) {
    cin >> x >> y >> a;
    switch (a) {
      case 1:
        W1=max(W1,x);
        break;
      case 2:
        W2=max(W2,W-x);
        break;
      case 3:
        H1=max(H1,y);
        break;
      case 4:
        H2=max(H2,H-y);
        break;   
    }
  }
  int ans = (W-W1-W2)*(H-H1-H2);
  if (ans　<=　0) {
    ans =0;
    cout  << ans;
  }
  if (ans >0 ){
  cout << ans;
  }
}

Compiler output:
a.cc:31:7: error: extended character 　 is not valid in an identifier
   31 |   if (ans　<=　0) {
      |       ^
a.cc:31:14: error: extended character 　 is not valid in an identifier
   31 |   if (ans　<=　0) {
      |              ^
a.cc: In function 'int main()':
a.cc:31:7: error: 'ans\U00003000' was not declared in this scope
   31 |   if (ans　<=　0) {
      |       ^~~~~
a.cc:31:14: error: '\U000030000' was not declared in this scope
   31 |   if (ans　<=　0) {
      |              ^~~
Language: C++

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

int main (void) {
  int W, H, N;
  cin >> W >> H >> N;
  int x,y,a=0;
  int W1=0, W2=0, H1=0, H2=0; 
  for (int i=0; i<N; i++) {
    cin >> x >> y >> a;
    switch (a) {
      case 1:
        W1=max(W1,x);
        break;
      case 2:
        W2=max(W2,W-x);
        break;
      case 3:
        H1=max(H1,y);
        break;
      case 4:
        H2=max(H2,H-y);
        break;   
    }
  }
  int ans = (W-W1-W2)*(H-H1-H2);
  if (ans<0) {
    ans =0;
    cout  << ans;
    break;
  }
  if (ans >0 ){
  cout << ans;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: break statement not within loop or switch
   34 |     break;
      |     ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int llint;

int main(){
	int w, h, n, i;
	int x[110], y[110], a[110];
	cin>>w>>h>>n;
	int maxx=0, minx=w, maxy=0, miny=h;
	for(i=0; i<n; i++) cin>>x[i]>>y[i]>>a[i];
	for(i=0; i<n; i++){
		if(a[i]==1 && x[i]>maxx) maxx=x[i];
		if(a[i]==2 && x[i]<minx) minx=x[i];
		if(a[i]==3 && y[i]>maxy) maxy=y[i];
		if(a[i]==4 && y[i]<miny) miny=y[i];
	}
	if((maxx-minx)>0 && (maxy-miny)>0) cout<<(maxx-minx)*(maxy-miny)<<endl;
	else cout<0<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:20: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   18 |         else cout<0<<endl;
      |                   ~^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int llint;

int main(){
	int w, h, n, i;
	int x[110], y[110], a[110];
	cin>>w>>h>>n;
	int maxx=0, minx=w, maxy=0, miny=h;
	for(i=0; i<n; i++) cin>>x[i]>>y[i]>>a[i];
	for(i=0; i<n; i++){
		if(a[i]==1 && x[i]>maxx) maxx=x[i];
		if(a[i]==2 && x[i]<minx) minx=x[i];
		if(a[i]==3 && y[i]>maxy) maxy=y[i];
		if(a[i]==4 && y[i]<miny) miny=y[i];
	}
	if((maxx-minx)>0 && (maxy-miny)>0) cout<<(maxx-minx)*(maxy-miny)<<endl;
	else cout<,0<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: error: expected primary-expression before ',' token
   18 |         else cout<,0<<endl;
      |                   ^
a.cc:18:21: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   18 |         else cout<,0<<endl;
      |                    ~^~~~~~
Language: Java

import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int W = sc.nextInt();
  int H = sc.nextInt();
  int N = sc.nextInt();
  int l = 0;int r = W;int u = H;int d = 0;
  int[] x = new int[3*N];
  for(int i = 0;i < 3*N;i += 3){
    x[i] = sc.nextInt();
    x[i+1] = sc.nextInt();
    x[i+2] = sc.nextInt();
    if(x[i+2] == 1){
      if(l <= x[i])l = x[i];
    } 
    else if(x[i+2] == 2){
      if(x[i] <= r)r = x[i];
    }
    else if(x[i+2] == 3){
      if(d <= x[i+1])d = x[i+1];
    }
    else{
      if(x[i+1] <= u)u = x[i+1];
    }
  }
  if(r-l >= 0 && u-d >= 0)System.out.println((r-l)*(u-d));
  else system.out.println("0");
}}


Compiler output:
Main.java:28: error: package system does not exist
  else system.out.println("0");
             ^
1 error
Language: Java

import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int W = sc.nextInt();
  int H = sc.nextInt();
  int N = sc.nextint();
  int l = 0;int r = W;int u = H;int d = 0;
  int[] x = new int[3*N];
  for(int i = 0;i < 3*N;i += 3){
    x[i] = sc.nextInt();
    x[i+1] = sc.nextInt();
    x[i+2] = sc.nextInt();
    if(x[i+2] == 1){
      if(l <= x[i])l = x[i];
    } 
    else if(x[i+2] == 2){
      if(x[i] <= r)r = x[i];
    }
    else if(x[i+2] == 3){
      if(d <= x[i+1])d = x[i+1];
    }
    else{
      if(x[i+1] <= u)u = x[i+1];
    }
  }
  System.out.println((r-l)*(u-d));
}}

Compiler output:
Main.java:7: error: cannot find symbol
  int N = sc.nextint();
            ^
  symbol:   method nextint()
  location: variable sc of type Scanner
1 error
Language: C++

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

int main(){
	int W, H, N;
	cin >> W >> H >> N;
	int S[H][W], x, y, a, c=0, i, j, k;
	for(i=0; i<H; i++){
		for(j=0; j<W; j++){
			S[i][j]=0;
		}
	} 
	for(k=0; k<N; k++){
		cin >> x >> y >> a;
		if(a==1){
			for(i=0; i<H; i++){
				for(j=0; j<x; j++){
					S[i][j]=1;
				}
			}
		} else if(a==2){
			for(i=0; i<H; i++){
				for(j=x; j<W; j++){
					S[i][j]=1;
				}
			}
		} else if(a==3){
			for(i=0; i<y; i++){
				for(j=0; j<W; j++){
					S[i][j]=1;
				}
			}
		} else if(a==4){
			for(i=y; i<H; i++){
				for(j=0; j<W; j++){
					S[i][j]=1;
				}
			}
		}
	for(i=0; i<H; i++){
		for(j=0; j<W; j++){
			c += S[i][j];
		}
	}
	cout << c;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:2: error: expected '}' at end of input
   47 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

int main(){
	int W, H, N;
	cin >> W >> H >> N;
	int S[H][W], x, y, a, c=0, i, j, k;
	for(i=0; i<H; i++){
		for(j=0; j<W; j++){
			S[i][j]=0;
		}
	} 
	for(k=0; k<N; k++){
		cin >> x >> y >> a;
		if(a==1){
			for(i=0; i<H; i++){
				for(j=0; j<x; j++){
					S[i][j]=1;
				}
			}
		} else if(a==2){
			for(i=0; i<H; i++){
				for(j=x; j<W; j++){
					S[i][j]=1;
				}
			}
		} else if(a==3){
			for(i=0; i<y; i++){
				for(j=0; j<W; j++){
					S[i][j]=1;
				}
			}
		} else if(a==4){
			for(i=y; i<H; i++){
				for(j=0; j<W; j++){
					S[i][j]=1;
				}
			}
		}
	cout << count(S.begin(), S.end(), '1');
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:25: error: request for member 'begin' in 'S', which is of non-class type 'int [H][W]'
   41 |         cout << count(S.begin(), S.end(), '1');
      |                         ^~~~~
a.cc:41:36: error: request for member 'end' in 'S', which is of non-class type 'int [H][W]'
   41 |         cout << count(S.begin(), S.end(), '1');
      |                                    ^~~
a.cc:42:2: error: expected '}' at end of input
   42 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C

#include<stdio.h>
int main(){
  int l=0,r,u,d=0,n=0;
  int x,y,a;
  scanf("%d%d%d",&r,&u,&n);
  for(int i=0;i<n;i++){
    scanf("%d%d%d",&x,&y,&a);
    switch(a){
      case 1:
        (x<l)?l=x;
        break;
      case 2:
        (r<x)?r=x;
        break;
      case 3:
        (y<d)?d=y;
        break;
      case 4:
        (u<y)?u=y;
        break;
    }
  }
  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:18: error: expected ':' before ';' token
   10 |         (x<l)?l=x;
      |                  ^
      |                  :
main.c:13:18: error: expected ':' before ';' token
   13 |         (r<x)?r=x;
      |                  ^
      |                  :
main.c:16:18: error: expected ':' before ';' token
   16 |         (y<d)?d=y;
      |                  ^
      |                  :
main.c:19:18: error: expected ':' before ';' token
   19 |         (u<y)?u=y;
      |                  ^
      |                  :
Language: C++

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll lx = 0, ly = 0, rx, ry, n;
  cin>>rx>>ry>>n;
  rep(i, n){
    ll a, b, c;
    cin>>a>>b>>c;
    if(c==1) chmax(lx, a);
    if(c==2) chmin(rx, a);
    if(c==3) chmax(ly, b);
    if(c==4) chmin(ry, b);
  }
  chmax(rx, lx); chmax(ry, ly);
  cout<<(rx-lx)*(ry-ly)<<endl;
  }
	return 0;
}


Compiler output:
a.cc:55:9: error: expected unqualified-id before 'return'
   55 |         return 0;
      |         ^~~~~~
a.cc:56:1: error: expected declaration before '}' token
   56 | }
      | ^
Language: C++

#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#define INF 1000000007
using namespace std;
int main(){
  int X,Y,A;
  int W1,W2,H1,H2,N;
  scanf("%d %d %d",&W1,&H1,&N);
  while(N--){
    scanf(" %d %d %d",&X,&Y,&A);
    if(A==1) W1=max(W1,X);
    if(A==2) W2=min(W2,X);
    if(A==3) H1=max(H1,Y);
    if(A==4) H2=min(H2,Y);
  }
  printf("%d\n",(W1<W2&&H1<H2?(W2-W1)*(H2-H1):0))
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:50: error: expected ';' before 'return'
   18 |   printf("%d\n",(W1<W2&&H1<H2?(W2-W1)*(H2-H1):0))
      |                                                  ^
      |                                                  ;
   19 |   return 0;
      |   ~~~~~~
Language: Java

public class Main {
   static  Scanner s = new Scanner(System.in);
    public static void main(String[] args) {

        int x,y,a;
        int left = 0;
        int under = 0;
        int width = s.nextInt();
        int height = s.nextInt();
        int n = s.nextInt();
        
        for (int i = 0; i < n; i++) {
            x = s.nextInt();
            y = s.nextInt();
            a = s.nextInt();

            switch (a) {
                case 1:
                    if (left < x) {
                        left = x;
                    }
                    break;
                case 2:
                    if (width > x) {
                        width = x;
                    }
                    break;
                case 3:
                    if (under < y) {
                        under = y;
                    }
                    break;
                case 4:
                    if (height > y) {
                        height = y;
                    }
                    break;
            }
        }

        if (width < left || height < under) {
            System.out.println(0);
        } else {
            System.out.println((width-left) * (height-under));
        }
    }
}

Compiler output:
Main.java:2: error: cannot find symbol
   static  Scanner s = new Scanner(System.in);
           ^
  symbol:   class Scanner
  location: class Main
Main.java:2: error: cannot find symbol
   static  Scanner s = new Scanner(System.in);
                           ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int w,h,n;
    cin>>w>>h>>n;
    int xlow=0,xhigh=w,ylow=0,yhigh=h;
    for(int i=0;i<n;i++){
        int x,y,a;
        cin>>x>>y>>a;
        switch(a){
        case 1:
            xlow=max(xlow,x);
            break;
        case 2:
            xhigh=min(xhigh,x);
            break;
        case 3:
            ylow=max(ylow,y);
            break;
        case 4:
            yhigh=min(yhigh,y);
            break;
        }
    }
    ans=(yhigh-ylow)*(xhigh-xlow);
    if(yhigh<ylow||xhigh<hlow){
        ans=0;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |     ans=(yhigh-ylow)*(xhigh-xlow);
      |     ^~~
      |     abs
a.cc:26:26: error: 'hlow' was not declared in this scope; did you mean 'ylow'?
   26 |     if(yhigh<ylow||xhigh<hlow){
      |                          ^~~~
      |                          ylow
Language: C

#include <stdio.h>
int main(){
  int W, H, N, i;
  int x[101],y[101],a[101];
  	int ax=W,bx=0,ay=H,by=0;
  	int i;
  	for(i=1;i<=N;i++){
  		scanf("%d %d %d",&x[i],&y[i],&a[i]);
  		switch(a[i]){
  			case 1: if(bx<=x[i])bx=x[i];
  				break;
  			case 2: if(ax>=x[i])ax=x[i];
  				break;
  			case 3: if(by<=y[i])by=y[i];
  				break;
  			case 4: if(ay>=y[i])ay=y[i];
  				break;
  		}
  	}

  	if(bx>=ax || ay<=by){
  		printf("0");
  		return 0;
  	}
  	printf("%d",(ax-bx)*(ay-by));
}


Compiler output:
main.c: In function 'main':
main.c:6:13: error: redeclaration of 'i' with no linkage
    6 |         int i;
      |             ^
main.c:3:16: note: previous declaration of 'i' with type 'int'
    3 |   int W, H, N, i;
      |                ^
Language: C++

#include<iostream>

using namespace std;

int main(){
  int W , H , N;

  cin >> W >> H >> N ;
  
  int WWL = 0 , WWR = W , WHU = 0 , WHO = H;
  for(int i = 0 ; i < N ; i++){
    int x , y , a;
    cin >> x >> y >> a;
    if( a == 1  ){
      WWL = x;
    }else if(a == 2){
      WWR = x;
    }else if(a == 3){
      WHU = y; 
    }else{
      WHO = y;
    }
    //cout << "xa=" << WWL << " xb=" << WWR << " ya=" << WHU << " yb =" << WHO << endl; 
  }
  
  int men = (WWR - WWL) *  (WHO - WHU)l;
  if ((WWR - WWL) < 0 || (WHO - WHU)<0)
    men = 0;
  cout << men << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:39: error: expected ',' or ';' before 'l'
   26 |   int men = (WWR - WWL) *  (WHO - WHU)l;
      |                                       ^
Language: C++


using namespace std;
using ll=long long;
#include <string>
#include <vector>
#include <cmath>
#include <iostream>

int main()
{
	int W, H, N;
	cin >> W >> H >> N;
	int minx = 0, miny = 0;
	for (size_t i = 0; i < N; i++)
	{
		int x, y, a;
		cin >> x >> y >> a;
		switch (a)
		{
		case 1:
			if (minx < x) minx = x;
			break;
		case 2:
			if (W > x) W = x;
			break;
		case 3:
			if (miny < y) miny = y;
			break;
		case 4:
			if (H > y) H = y;
			break;
		default:
			break;
		}
	}
	int h = (H - miny), w = (W - minx);
	if (h <= 0 || w <= 0) {
		cout << "0" << endl;
		return;
	}
	cout << (h*w) << endl;

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:39:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
   39 |                 return;
      |                 ^~~~~~
Language: C++


#include "stdafx.h"

using namespace std;
using ll=long long;
#include <string>
#include <vector>
#include <cmath>
#include <iostream>

int main()
{
	int W, H, N;
	cin >> W >> H >> N;
	int minx = 0, miny = 0;
	for (size_t i = 0; i < N; i++)
	{
		int x, y, a;
		cin >> x >> y >> a;
		switch (a)
		{
		case 1:
			if (minx < x) minx = x;
			break;
		case 2:
			if (W > x) W = x;
			break;
		case 3:
			if (miny < y) miny = y;
			break;
		case 4:
			if (H > y) H = y;
			break;
		default:
			break;
		}
	}
	int ans = (W - minx)*(H - miny);
	if (ans < 0)ans = 0;
	cout << ans << endl;

    return 0;
}



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

#include <iostream>
#include <array>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;


int main()
{
	int W, H, N, x_zero = 0, y_zero = 0;
	cin >> W >> H >> N;
	for (size_t i = 0; i < N; i++)
	{
		int xi, yi, ai;
		cin >> xi >> yi >> ai;
		if (ai == 1 && x_zero < xi) { x_zero = xi; }
		if (ai == 2 && W > xi) { W = xi; }
		if (ai == 3 && y_zero < yi) { y_zero = yi; }
		if (ai == 4 && H > yi) { H = yi; }
	}
	int h = H - y_zero, w = W - x_zero;
	if (h <= 0 || w <= 0){ cout << "0" << endl; return 0};
	cout << (h*w) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:61: error: expected ';' before '}' token
   24 |         if (h <= 0 || w <= 0){ cout << "0" << endl; return 0};
      |                                                             ^
      |                                                             ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){
bool flg[100][100];
REP(i,100) REP(j,100) flg[i][j] = true;
int w,h,n;
cin >> w >> h >> n;
REP(i,n){
int a,x,y;
cin >> x >> y >> a;
if(a == 1){
REP(i,x) REP(j,h) flg[i][j] = false;
}else if(a == 2){
FOR(i,x,w) REP(j,h) flg[i][j] = false;
}else if(a == 3){
REP(i,y) REP(j,w) flg[j][i] = false;
}else{
FOR(i,y,h) REP(j,w) flg[j][i] = false;
}
int ans = 0;
REP(i,w) REP(j,h) if(flg[i][j]) ans++;
cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:2: error: expected '}' at end of input
   39 | }
      |  ^
a.cc:18:11: note: to match this '{'
   18 | int main(){
      |           ^
Language: C++

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

int b[114][514];

int main(){
	int w,h,n;
	cin>>w>>h>>n;
	for(int Z=0;Z<n;Z++){
		int x,y,a;
		cin>>x>>y>>a;
		if(a==1){
			for(int i=0;i<x;i++){
				for(int j=0;j<h;j++){b[i][j]=1;}
				}
			}
		else if(a==2){
			for(int i=x;x<w;x++){
				for(int j=0;j<h;j++)b[i][j]=1;
				}
			}
		else if(a==3){
			for(int i=0;i<w;i++)
			for(int j=0;j<y;j++)b[i][j]=1;
			}
		else{
			for(int i=0;i<w;i++)
			for(int j=y;j<ha;j++)b[i][j]=1;
			}			
		}
		
	int ans=0;
	for(int i=0;i<w;i++)
	for(int j=0;j<h;j++)ans+=b[i][j];	
	cout<<ans<<endl;
	return 0;
	}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:39: error: 'ha' was not declared in this scope; did you mean 'a'?
   28 |                         for(int j=y;j<ha;j++)b[i][j]=1;
      |                                       ^~
      |                                       a
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
 int w,h,n;
 cin>>w>>h>>n;
 int x,y,a;
 int b[100][100]={};
int minx=100,my=100; 
 while(1){
  if(n==0)break;
  cin>>x>>y>>a;
  if(a==1)
   if(minx>w-x)minx=w-x;
  else if(a==2)
   if(minx>x)minx=x;
  else if(a==3)
   if(miny>h-y)miny=h-y;
  else if(a==4)
   if(miny>y)miny=y;
 }
 cout<<minx*miny<<endl;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: 'miny' was not declared in this scope; did you mean 'minx'?
   17 |    if(miny>h-y)miny=h-y;
      |       ^~~~
      |       minx
a.cc:21:13: error: 'miny' was not declared in this scope; did you mean 'minx'?
   21 |  cout<<minx*miny<<endl;
      |             ^~~~
      |             minx
Language: C++

#include<iostream>
 
using namespace std;
 
int main()
{
int w, h, n, a, b, c, d;
 cin>>w>>h>>n;
 a =0, b = w, c =0, d = h;
while( n--)
{
int x, y, m;
 cin>>x>>y>>m;
if( m ==1) a = max( a, x );
if( m ==2) b = min( b, x );
if( m ==3) c = max( c, y );
if( m ==4) d = min( d, y );
}
 w =(b-a<0?0:b-a);
 h =(d-c<0?0:d-c);
 cout<<w*h<<endl;
return 0;
}

Compiler output:
a.cc:2:1: error: extended character   is not valid in an identifier
    2 |  
      | ^
a.cc:4:1: error: extended character   is not valid in an identifier
    4 |  
      | ^
a.cc:2:1: error: '\U000000a0' does not name a type
    2 |  
      | ^
a.cc:4:1: error: '\U000000a0' does not name a type
    4 |  
      | ^
Language: Java

import java.util.Scanner;
public class Bquestion {

	public static void main(String[] args) {
		int w,h,n;
		Scanner sc=new Scanner(System.in);
		w=sc.nextInt();
		h=sc.nextInt();
		n=sc.nextInt();
		
		int[]x=new int[n];
		int[]y=new int[n];
		int[]a=new int[n];
		
		for(int i=0;i<n;i++){
			x[i]=sc.nextInt();
			y[i]=sc.nextInt();
			a[i]=sc.nextInt();
		}
		
		int x_max=w;
		int x_min=0;
		int y_max=h;
		int y_min=0;
		
		for(int i=0;i<n;i++){
			switch(a[i]){
			case 1:x_min=x[i];break;
			case 2:x_max=x[i];break;
			case 3:y_min=y[i];break;
			case 4:y_max=y[i];break;
			}
		}
		if(x_max>x_min && y_max>y_min)System.out.println((x_max-x_min)*(y_max-y_min));
		else System.out.println(0);
	}

}


Compiler output:
Main.java:2: error: class Bquestion is public, should be declared in a file named Bquestion.java
public class Bquestion {
       ^
1 error
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
const int INF = 1e9;
#define MAX 100
int main(void) {
	int w, h, n, x, y, a, minx = 0, miny = 0, maxx, maxy;
	cin >> w >> h >> n;
	maxx = w;
	maxy = h;
	for (int i = 0; i < n; ++i)
	{
		cin >> x >> y >> a;
		switch (a)
		{
		case 1:
			minx = max(minx, x);
			break;
		case 2:
			maxx = min(maxx, x);
			break;
		case 3:
			miny = max(miny, y);
			break;
		case 4:
			maxy = min(maxy, y);
			break;
		default:
			break;
		}
	}
	int a = (maxx - minx) > 0 ? maxx - minx : 0;
	int b = (maxy - miny) > 0 > maxy - miny : 0;
	cout << a * b<< endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:13: error: redeclaration of 'int a'
   37 |         int a = (maxx - minx) > 0 ? maxx - minx : 0;
      |             ^
a.cc:12:28: note: 'int a' previously declared here
   12 |         int w, h, n, x, y, a, minx = 0, miny = 0, maxx, maxy;
      |                            ^
a.cc:38:49: error: expected ',' or ';' before ':' token
   38 |         int b = (maxy - miny) > 0 > maxy - miny : 0;
      |                                                 ^
Language: C++


yutaro at debian in ~/program/atcoder/abc042/A 
$ ls
mainA.cpp

yutaro at debian in ~/program/atcoder/abc042/A 
$ ./a.out
5 5 7
YES

yutaro at debian in ~/program/atcoder/abc042/A 
$ ./a.out
7 7 5
NO

yutaro at debian in ~/program/atcoder/abc042/A 
$ ..

yutaro at debian in ~/program/atcoder/abc042 
$ B

yutaro at debian in ~/program/atcoder/abc042/B 
$ exe-test
./test1:
axxcxxdxx

yutaro at debian in ~/program/atcoder/abc042/B 
$ ..

yutaro at debian in ~/program/atcoder/abc042 
$ ..

yutaro at debian in ~/program/atcoder 
$ ./mkfile.sh abc043

yutaro at debian in ~/program/atcoder 
$ cd abc043/

yutaro at debian in ~/program/atcoder/abc043 
$ ls
A/  B/  C/  D/

yutaro at debian in ~/program/atcoder/abc043 
$ A

yutaro at debian in ~/program/atcoder/abc043/A 
$ ..

yutaro at debian in ~/program/atcoder/abc043 
$ ..

yutaro at debian in ~/program/atcoder 
$ ./mkfile.sh abc047

yutaro at debian in ~/program/atcoder 
$ cd abc047/

yutaro at debian in ~/program/atcoder/abc047 
$ A

yutaro at debian in ~/program/atcoder/abc047/A 
$ exe-test 

yutaro at debian in ~/program/atcoder/abc047/A 
$ ..

yutaro at debian in ~/program/atcoder/abc047 
$ B

yutaro at debian in ~/program/atcoder/abc047/B 
$ exe-test
./test1:
4
./test2:
-3
./test3:
32

yutaro at debian in ~/program/atcoder/abc047/B 
$ exe-test
./test1:
4
./test2:
3
./test3:
32

yutaro at debian in ~/program/atcoder/abc047/B 
$ cat test1
5 4 2
2 1 1
3 3 4

yutaro at debian in ~/program/atcoder/abc047/B 
$ exe-test
./test1:
2,4 0,2
4
./test2:
2,1 0,3
3
./test3:
1,9 1,5
32

yutaro at debian in ~/program/atcoder/abc047/B 
$ exe-test
./test1:
2,5 0,3
9
./test2:
2,1 0,3
3
./test3:
1,9 1,9
64

yutaro at debian in ~/program/atcoder/abc047/B 
$ exe-test
./test1:
2,5 0,3
9
./test2:
2,1 0,3
0
./test3:
1,9 1,9
64

yutaro at debian in ~/program/atcoder/abc047/B 
$ 


Compiler output:
a.cc:2:1: error: 'yutaro' does not name a type
    2 | yutaro at debian in ~/program/atcoder/abc042/A
      | ^~~~~~