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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    4 |   cin>>n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:14:3: error: expected ',' or ';' before 'for'
   14 |   for(int i=0;i<n;i++){
      |   ^~~
a.cc:14:15: error: 'i' was not declared in this scope
   14 |   for(int i=0;i<n;i++){
      |               ^
a.cc:42:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   42 |   cout<<s<<endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:42:12: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   42 |   cout<<s<<endl;
      |            ^~~~
      |            std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

ew,eh,n=[int(x) for x in input().rstrip().split()]
fw=0
fh=0
ansx=0
ansy=0
for i in range(n):
    x,y,a=[int(x) for x in input().rstrip().split()]
    if(a==1):
        fw=max(fw,x)
    elif(a==2):
        ew=min(ew,x)
    elif (a==3):
        fh=max(fh,y)
    elif (a==4):
        eh=min(eh,y)

if(ew-fw<0):
    ansx=0
elif(eh-fh<0):
    ansy=0
else:

    ansx=ew-fw
    ansy=eh-fh

print(ansx*ansy)

Compiler output:
a.cc:1:1: error: 'ew' does not name a type
    1 | ew,eh,n=[int(x) for x in input().rstrip().split()]
      | ^~
Language: C

#include<stdio.h>
int main(void)
{
  int left=0,right,up,down=0,x,y,num,a;
  char str[100];
  fgets(str,sizeof(str),stdin);
  sscanf(str,"%d %d %d",&right,&up,&num);
  
  for(int i=0;i<num;i++)
  {
    fgets(str,sizeof(str),stdin);
    sscanf(str,"%d %d %d",&x,&y,&a);
    
    switch(a)
    {
      case 1:
        if(left<x) left=x;
        break;
      case 2:
        if(right>x) right = x;
        break;
      case 3:
        if(down<y) down = y;
        break;
      default:
        if(up > y) up = y;
        break;
    }
  }
  if((right>left)&&(up>down))
  {
    ans = (right-left) * (up-down);
  }else
  {
    ans = 0;
  }
  
  printf("%d",ans);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:32:5: error: 'ans' undeclared (first use in this function)
   32 |     ans = (right-left) * (up-down);
      |     ^~~
main.c:32:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int w,h,n;
  cin >> w >> h >> n;
  int xmax,xmin,ymax,ymin;
  for(int i=0;i<N;i++){
    int x = 0;
    int y = 0;
    int a = 0;
  cin >> x >> y >> a;
  if(a == 1){
    if(xmin < x){
      xmin = x;
    }
  }else if(a == 2){
    if(xmax > x){
      xmax = x;
    }
  }else if(a == 3){ 
    if(ymin < y){
      ymin = y;
    }
  }else if(a == 4){
    if(ymax > y){
      ymax = y;
    }
  }
  }
  
  if((xmin <= xmax) && (ymin <= ymax)){
    cout << (xmax - xmin)*(ymax -ymin) << endl;
  }else{
    cout << 0 << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: 'N' was not declared in this scope
    8 |   for(int i=0;i<N;i++){
      |                 ^
Language: C++

#include<iostream>
#include<vector>

int main() {
  int width, height, N;
  std::cin >> width >> height >> N;
  std::vector<std::vector<int>> data(height,std::vector<int>(width));
  for (int i=0; i<N; i++) {
    int temp_x,temp_y,flag;
    std::cin >> temp_x >> temp_y >> flag;
    if (a == 1) {
      for (int y = 0; y < height; y++) {
        for (int x = 0; x < temp_x; x++) {
          data.at(y).at(x) = 1;
        }
      }
    }
    else if (a == 2) {
      for (int y = 0; y < height; y++) {
        for (int x = temp_x; x < width; x++) {
          data.at(y).at(x) = 1;
        }
      }
    }
    else if (a == 3) {
      for (int y = 0; y < temp_y; y++) {
        for (int x = 0; x < width; x++) {
          data.at(y).at(x) = 1;
        }
      }
    }
    else if (a == 4) {
      for (int y = temp_y; y < height; y++) {
        for (int x = 0; x < width; x++) {
          data.at(y).at(x) = 1;
        }
      }
    }
  }
  int sum = 0;
  for (int y=0; y < height; y++) {
    for (int x=0; x < width; x++) {
      if (data.at(y).at(x) == 0) {
        sum++;
      }
    }
  }
  std::cout << sum << std::endl;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'a' was not declared in this scope
   11 |     if (a == 1) {
      |         ^
Language: C++

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

int main() {
  int square[105][105];
  int w, h, n;
  cin >> w >> h >> n;
  for(int i=0; i<n; i++){
    int x, y, func;
    cin >> x >> y >> func;
    switch(func) {
      case 1:
        for(int X=0; X<x; X++)
          for(int Y=0; Y<105; Y++)
            square[Y][X] = 1;
        break;
      case 2:
        for(int X=x; X<105; X++)
          for(int Y=0; Y<105; Y++)
            square[Y][X] = 1;
        break;
      case 3:
        for(int X=0; X<105; X++)
          for(int Y=0; Y<y; Y++)
            square[Y][X] = 1;
        break;
      case 4:
        for(int X=0; X<105; X++)
          for(int Y=y; Y<105; Y++)
            square[Y][X] = 1;
        break;
    }
  }
  int cnt = 0;
  for(int i=0; i<h; i++)
    for(int j=0; j<w; j++)
      if(square[i][j] == 0)
        cnt++;
  cout << cnt << endl;
  return 0;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope
    8 |   cin >> w >> h >> n;
      |   ^~~
a.cc:40:3: error: 'cout' was not declared in this scope
   40 |   cout << cnt << endl;
      |   ^~~~
a.cc:40:18: error: 'endl' was not declared in this scope
   40 |   cout << cnt << endl;
      |                  ^~~~
Language: C++

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

int main() {
  int square[105][105];
  int w, h, n;
  cin >> w >> h >> n;
  for(int i=0; i<n; i++){
    int x, y, func;
    cin >> x >> y >> func;
    switch(func) {
      case 1:
        for(int X=0; X<x; X++)
          for(int Y=0; Y<105; Y++)
            square[Y][X] = 1;
        break;
      case 2:
        for(int X=x; X<105; X++)
          for(int Y=0; Y<105; Y++)
            square[Y][X] = 1;
        break;
      case 3:
        for(int X=0; X<105; X++)
          for(int Y=0; Y<y; Y++)
            square[Y][X] = 1;
        break;
      case 4:
        for(int X=0; X<105; X++)
          for(int Y=y; Y<105; Y++)
            square[Y][X] = 1;
        break;
    }
  }
  int cnt = 0;
  for(int i=0; i<h; i++)
    for(int j=0; j<w; j++)
      if(square[i][j] == 0)
        cnt++;
  cout << cnt << endl;
  return 0;
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | y#include <iostream>
      |  ^
a.cc:1:1: error: 'y' does not name a type
    1 | y#include <iostream>
      | ^
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope
    8 |   cin >> w >> h >> n;
      |   ^~~
a.cc:40:3: error: 'cout' was not declared in this scope
   40 |   cout << cnt << endl;
      |   ^~~~
a.cc:40:18: error: 'endl' was not declared in this scope
   40 |   cout << cnt << 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);
  }
  
   vector<int>p(4);
   p.at(0) = 0;
   p.at(1)=0;
      p.at(2)=W;
      p.at(4)=H;
      
      for(int i = 0; i < N; i ++){
        if(a.at(i) == 1){
          if(x.at(i) > p.at(0)){
            p.at(0) = x.at(i);
          }
        }else if(a.at(i) == 2){
          if(x.at(i) < p.at(2)){
            p.at(2) = x.at(i);
          }
        }else if(a.at(i) == 3 && y.at(i) > p.at(1){
          p.at(1) = y.at(i);
        }else if(a.at(i) == 4 && y.at(i) < p.at(3)){
             p.at(3) = y.at(i);
        }
      }
      
      int s;
      s = (p.at(2) - p.at(0)) * (p.at(3) - p.at(1));
      
      cout << s << endl;
     }

Compiler output:
a.cc: In function 'int main()':
a.cc:29:51: error: expected ')' before '{' token
   29 |         }else if(a.at(i) == 3 && y.at(i) > p.at(1){
      |                 ~                                 ^
      |                                                   )
a.cc:34:7: error: expected primary-expression before '}' token
   34 |       }
      |       ^
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);
  }
  
   vector<int>p(4);
   p.at(0) = 0;
   p.at(1)=0;
      p.at(2)=W;
      p.at(4)=H;
      
      for(int i = 0; i < N; i ++){
        if(a.at(i) == 1){
          if(x.at(i) > p.at(0)){
            p.at(0) = x.at(i);
          }
        }else if(a.at(i) == 2){
          if(x.at(i) < p.at(2)){
            p.at(2) = x.at(i);
          }
        }else if(a.at(i) == 3 && y.at(i) > p.at(1){
          p.at(1) = y.at(i);
        }else if(a.at(i) == 4 && y.at(i) < p.at(3)){
             p.at(3) = y.at(i);
        }
      }
      
      int s;
      s = (p.at(2) - p.at(0)) * (p.at(3) - p.at(1));
      
      cout << s << endl;
     }

Compiler output:
a.cc: In function 'int main()':
a.cc:10:6: error: expected '(' before '{' token
   10 |   for{int i = 0;i < N;i ++){
      |      ^
      |      (
a.cc:10:6: error: expected primary-expression before '{' token
a.cc:40:7: error: expected primary-expression at end of input
   40 |      }
      |       ^
a.cc:40:7: error: expected ';' at end of input
   40 |      }
      |       ^
      |       ;
a.cc:40:7: error: expected primary-expression at end of input
a.cc:40:7: error: expected ')' at end of input
   40 |      }
      |       ^
      |       )
a.cc:10:6: note: to match this '('
   10 |   for{int i = 0;i < N;i ++){
      |      ^
a.cc:40:7: error: expected statement at end of input
   40 |      }
      |       ^
a.cc:40:7: error: expected '}' at end of input
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:6: error: expected '(' before '{' token
   10 |   for{int i = 0;i < N;i ++){
      |      ^
      |      (
a.cc:10:6: error: expected primary-expression before '{' token
a.cc:40:7: error: expected primary-expression at end of input
   40 |      }
      |       ^
a.cc:40:7: error: expected ';' at end of input
   40 |      }
      |       ^
      |       ;
a.cc:40:7: error: expected primary-expression at end of input
a.cc:40:7: error: expected ')' at end of input
   40 |      }
      |       ^
      |       )
a.cc:10:6: note: to match this '('
   10 |   for{int i = 0;i < N;i ++){
      |      ^
a.cc:40:7: error: expected statement at end of input
   40 |      }
      |       ^
a.cc:40:7: error: expected '}' at end of input
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll =long long;
using db = double;
using vll = vector<long long>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;

//ここから書き始める

struct point{ll x; ll y;};
int main()
{
	cout << setprecision(10);
	ll w, h, n;
	cin >> w >> h >> n;
	vector<point> xy(n);
	vector<ll> one_four(n);
	rep(i,n){
		cin >> xy[i].x >> xy[i].y >>one_four[i];
	}
	ll x1 = 0, x2 = w, y1 = 0, y2 = h;
	rep(i,n){
		if(one_four[i] ==1){
			chmax(x1,xy[i].x);
		}
		else if(one_four[i] == 2){
			chmin(x2,xy[i].x);
		}
		else if(one_four[i] == 3){
			chmax(y1,xy[i].y);
		}
		else if(one_four[i] == 4){
			chmin(y2,xy[i].y);
		}
	}
	ll xrange = max((ll)0,x2-x1);
	ll yrange = max((ll)0,y2-y1);
	ll ans =  0 ;
	//xrange, yrangeどっちかが負だったら処理しないようにする
	if(xrange>=0&&yrange>=0){
		ans = max( xrange * yrange , (ll)0);
	cout << ans << endl;

	
}


Compiler output:
a.cc: In function 'bool coY()':
a.cc:18:32: warning: no return statement in function returning non-void [-Wreturn-type]
   18 | bool coY() {cout <<"Yes"<<endl;}
      |                                ^
a.cc: In function 'bool coN()':
a.cc:19:30: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | bool coN(){cout <<"No"<<endl;}
      |                              ^
a.cc: In function 'int main()':
a.cc:60:2: error: expected '}' at end of input
   60 | }
      |  ^
a.cc:27:1: note: to match this '{'
   27 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
  
int main() {
    int W, H, N;
    cin >> W >> H >> N;
    int minx = 0; maxx = W; miny = 0; maxy = H;
    for (int i = 0; i < N; i++) {
        int x, y, a;
        cin >> x >> y >> a;
        if (a == 1) {
            minx = max(x, minx);
        }
        if (a == 2) {
            maxx = min(x, maxx);
        }
        if (a == 3) {
            miny = max(y, maxy);
        }
        if (a == 4) {
            maxy = min(y, miny);
        }
    }
    cout << max(maxx - minx, 0) * max(0, maxy - miny) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: 'maxx' was not declared in this scope
   11 |     int minx = 0; maxx = W; miny = 0; maxy = H;
      |                   ^~~~
a.cc:11:29: error: 'miny' was not declared in this scope; did you mean 'minx'?
   11 |     int minx = 0; maxx = W; miny = 0; maxy = H;
      |                             ^~~~
      |                             minx
a.cc:11:39: error: 'maxy' was not declared in this scope
   11 |     int minx = 0; maxx = W; miny = 0; maxy = H;
      |                                       ^~~~
Language: C++

#include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())

    typedef long long ll;


    bool compare_first(pair<int,int>a,pair<int,int >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }


    ll min(ll a,ll b)
    {
        if(a>b)return b;
        return a;
    }
     ll max(ll a,ll b)
    {
        if(a>b)return a;
        return b;
    }

    ll toINT(string s)
    {
        ll a=0;
        for(ll index=0;index<s.size();index++)
            a=a*10+(s[index]-'0');
        return a;
    }



    int main() {
      ios::sync_with_stdio(false);


int w,h,n;
cin>>w>>h>>n;

int xmn=0,ymn=0,xmx=w,ymx=h;
while(n--)
{
    int x,y,a;
    cin>>x>>y>>a;

    if(a==1)
        xmn=max(x,xmn);
    else if(a==2)
        xmx=min(x,xmn);
    else if(a==3)
        ymn=max(y,ymn);
    else if(a==4)
        ymx=min(y,ymx);
}

cout<<max(0, maxx - minx) * max(0, maxy - miny)<<endl;
return 0;
    }

/*

 }
 */


Compiler output:
a.cc: In function 'int main()':
a.cc:84:14: error: 'maxx' was not declared in this scope; did you mean 'max'?
   84 | cout<<max(0, maxx - minx) * max(0, maxy - miny)<<endl;
      |              ^~~~
      |              max
a.cc:84:21: error: 'minx' was not declared in this scope; did you mean 'min'?
   84 | cout<<max(0, maxx - minx) * max(0, maxy - miny)<<endl;
      |                     ^~~~
      |                     min
a.cc:84:36: error: 'maxy' was not declared in this scope; did you mean 'max'?
   84 | cout<<max(0, maxx - minx) * max(0, maxy - miny)<<endl;
      |                                    ^~~~
      |                                    max
a.cc:84:43: error: 'miny' was not declared in this scope; did you mean 'min'?
   84 | cout<<max(0, maxx - minx) * max(0, maxy - miny)<<endl;
      |                                           ^~~~
      |                                           min
Language: C++

#include <cstdio>
#include <bitset>

using namespace std;

int main( int argc, char *argv[] ){

  int W,H,N ;

  scanf("%d%d%d",&W,&H,&N) ;

  int x,y,a ;
  int Wl,Hl,Wu,Hu ;
  Wl = 0;
  Hl = 0;
  Wu = W;
  Hu = H;

  for(int i=0; i<N; i++){
    scanf("%d%d%d",&x,&y,&a) ;
    if     (a==1&x>Wl){Wl=x;}
    else if(a==2&x<Wu){Wu=x;}
    else if(a==3&y>Hl){Hl=y;}
    else if(a==4&y<Hu){Hu=y;}
  }

  if((Wu-Wl)<0|(Hu-Hl)<0){printf("%d",0);}
  else   {printf("%d",(Wu-Wl)*(Hu-Hl););}
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:28:38: error: expected ')' before ';' token
   28 |   else   {printf("%d",(Wu-Wl)*(Hu-Hl););}
      |                 ~                    ^
      |                                      )
a.cc:28:39: error: expected primary-expression before ')' token
   28 |   else   {printf("%d",(Wu-Wl)*(Hu-Hl););}
      |                                       ^
Language: C++

#include<stdc++.h>
using namespace std;
#define ll long long
int main() {
  ll W,H,N,x,y,a;
  cin >> W >> H >> N;
  vector<vector<ll>> vec;
  ll w_=W, h_=H;
  while(cin >> x >> y >> a) {
	if (a==1) w_ -= x;
    else if (a==2) w_ -= W-x;
	else if (a==3) h_ -= y;
	else h_ -= H-y;
  }
  if (w_ < 0) w_ = 0;
  if (h_ < 0) h_ = 0;
  cout << w_*h_ << endl;
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int w,h,n;
  cin>>w>>h>>n;
  int minx=0,maxx=w,miny=0,maxy=h;
  vector<int> x(n),y(n);a(n);
  rep(i,n) cin>>x[i]>>y[i]>>a[i];
  rep(i,n){
    if(a[i]==1){
      minx=max(minx,x[i]);
    }
    if(a[i]==2){
      maxx=min(maxx,x[i]);
    }
    if(a[i]==3){
      miny=max(miny,y[i]);
    }
    if(a[i]==4){
      maxy=min(maxy,y[i]);
    }
  }
  int ans=(maxx-minx)*(maxy-miny);
  if(ans<=0){
    cout<<0<<endl;
  }else{
    cout<<ans<<endl;
  }
  
}
///////////////////////////

Compiler output:
a.cc: In function 'int main()':
a.cc:73:25: error: 'a' was not declared in this scope
   73 |   vector<int> x(n),y(n);a(n);
      |                         ^
Language: C++

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

int main (){
    int W,H,N,number1,number2,number3,number4,ans;
    cin >> W;
    cin >> H;
    cin >> N;
    number2 = W;
    number4 = H;
    vector<int> x(N);
    vector<int> y(N);
    vector<int> a(N);
    for(int i = 0;i < N;i++){
        cin >> x.at(i);
        cin >> y.at(i);
        cin >> a.at(i);
        if(a.at(i) == 1 && number1 <= x.at(i)){
            number1 = x.at(i);
        }
        else if(a.at(i) == 2 && number2 >= x.at(i)){
            number2 = x.at(i);
        }
        else if(a.at(i) == 3 && number3 <= y.at(i)){
            number3 = y.at(i);
        }
        else if(a.at(i) == 4 && number4 >= y.at(i)){
            number4 = y.at(i);
        }
    }
    if(number2 - number1 <= 0 || number4 - number3 <= 0){
        ans = 0;
    }
    else{
        ans = (W - (W - number2 + number1)) * (H-(H-number4 + number3));
    }
    cout << ans;
}
                
                  
    #include <bits/stdc++.h>
using namespace std;

int main (){
    int W,H,N,number1,number2,number3,number4,ans;
    cin >> W;
    cin >> H;
    cin >> N;
    number2 = W;
    number4 = H;
    vector<int> x(N);
    vector<int> y(N);
    vector<int> a(N);
    for(int i = 0;i < N;i++){
        cin >> x.at(i);
        cin >> y.at(i);
        cin >> a.at(i);
        if(a.at(i) == 1 && number1 <= x.at(i)){
            number1 = x.at(i);
        }
        else if(a.at(i) == 2 && number2 >= x.at(i)){
            number2 = x.at(i);
        }
        else if(a.at(i) == 3 && number3 <= y.at(i)){
            number3 = y.at(i);
        }
        else if(a.at(i) == 4 && number4 >= y.at(i)){
            number4 = y.at(i);
        }
    }
    if(number2 - number1 <= 0 || number4 - number3 <= 0){
        ans = 0;
    }
    else{
        ans = (W - (W - number2 + number1)) * (H-(H-number4 + number3));
    }
    cout << ans;
}
                
     

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

    vector<int> a(N);
    for(int i = 0;i < N;i++){
        cin >> x.at(i);
        cin >> y.at(i);
        cin >> a.at(i);
        if(a.at(i) == 1 && number1 <= x.at(i)){
            number1 = x.at(i);
        }
        else if(a.at(i) == 2 && number2 >= x.at(i)){
            number2 = x.at(i);
        }
        else if(a.at(i) == 3 && number3 <= y.at(i)){
            number3 = y.at(i);
        }
        else if(a.at(i) == 4 && number4 >= y.at(i)){
            number4 = y.at(i);
        }
    }
    if(number2 - number1 <= 0 || number4 - number3 <= 0){
        ans = 0;
    }
    else{
        ans = (W - (W - number2 + number1)) * (H-(H-number4 + number3));
    }
    cout << ans;
}
                
                     
    

Compiler output:
a.cc:1:5: error: 'vector' does not name a type
    1 |     vector<int> a(N);
      |     ^~~~~~
a.cc:2:5: error: expected unqualified-id before 'for'
    2 |     for(int i = 0;i < N;i++){
      |     ^~~
a.cc:2:19: error: 'i' does not name a type
    2 |     for(int i = 0;i < N;i++){
      |                   ^
a.cc:2:25: error: 'i' does not name a type
    2 |     for(int i = 0;i < N;i++){
      |                         ^
a.cc:19:5: error: expected unqualified-id before 'if'
   19 |     if(number2 - number1 <= 0 || number4 - number3 <= 0){
      |     ^~
a.cc:22:5: error: expected unqualified-id before 'else'
   22 |     else{
      |     ^~~~
a.cc:25:5: error: 'cout' does not name a type
   25 |     cout << ans;
      |     ^~~~
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

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

int main (){
    int W,H,N,number1,number2,number3,number4,ans;
    cin >> W;
    cin >> H;
    cin >> N;
    number2 = W;
    number4 = H;
    vector<int> x(N);
    vector<int> y(N);
    vector<int> a(N);
    for(int i = 0;i < N;i++){
        cin >> x.at(i);
        cin >> y.at(i);
        cin >> a.at(i);
        if(a.at(i) == 1 && number1 <= x.at(i)){
            number1 = x.at(i);
        }
        else if(a.at(i) == 2 && number2 >= x.at(i)){
            number2 = x.at(i);
        }
        else if(a.at(i) == 3 && number3 <= y.at(i)){
            number3 = y.at(i);
        }
        else if(a.at(i) == 4 && number4 >= y.at(i)){
            number4 = y.at(i);
        }
    }
    if(number2 - number1 <= 0 || number4 - number3 <= 0){
        ans = 0;
    }
    else{
        ans = (W - (W - number2 + number1) * (H-(H-number4 + number3);
    }
    cout << ans;
}
                
    

Compiler output:
a.cc: In function 'int main()':
a.cc:35:70: error: expected ')' before ';' token
   35 |         ans = (W - (W - number2 + number1) * (H-(H-number4 + number3);
      |                                              ~                       ^
      |                                                                      )
a.cc:35:70: error: expected ')' before ';' token
   35 |         ans = (W - (W - number2 + number1) * (H-(H-number4 + number3);
      |               ~                                                      ^
      |                                                                      )
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <queue>
#include <array>
#include <random>

using namespace std;
#define rep(i, a, n) for (int i = a; i < n; ++i)
#define per(i, a, n) for (int i = n - 1; i >= a; --i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef int64_t i64;
typedef uint64_t ui64;
typedef pair<int, int> pi;

struct custom_hash {
    static ui64 splitmix64(ui64 x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(ui64 x) const {
        static const ui64 FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T, class U>
inline ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << p.first << ' ' << p.second;
    return os;
}
template <class T, class U>
inline istream& operator>>(istream& os, pair<T, U>& p) {
    os >> p.first >> p.second;
    return os;
}
template <class T>
inline ostream& operator<<(ostream& os, const vector<T>& v) {
    if (v.empty())
        return os;
    if (v.begin() != v.end())
        os << v.front();
    for (auto it = ++v.begin(); it != v.end(); ++it)
        os << ' ' << *it;
    return os;
}
template <class T>
inline istream& operator>>(istream& is, vector<T>& v) {
    for (auto& i : v)
        is >> i;
    return is;
}

void Solve(istream& is, ostream& os) {
    int x_start = 0, y_start = 0, x_end, y_end, n;
    is >> x_end >> y_end >> n;
    
    while (n--) {
        int x, y, type;
        is >> x >> y >> type;
        switch (type) {
            case 1:
                x_start = max(x_start, x);
                break;
            case 2:
                x_end = min(x_end, x);
                break;
            case 3:
                y_start = max(y_start, y);
                break;
            case 4:
                y_end = min(y_end, y);
                break;
            default:
                throw runtime_error("impossible");
        }
    }
    os << max(x_end - x_start, 0) * max(y_end - y_start, 0);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << setprecision(20) << fixed;
    Solve(cin, cout);
    return 0;
}


Compiler output:
a.cc: In member function 'size_t custom_hash::operator()(ui64) const':
a.cc:39:42: error: 'chrono' has not been declared
   39 |         static const ui64 FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
      |                                          ^~~~~~
Language: C++

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

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

    int p = 0;
    int q = w;
    int r = 0;
    int s = h;

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

        if(a == 1 && p < x){
            p = x;
        }
        else if(a == 2 && x < w){
            q = x;
        }
        else if(a == 3 && r < y){
            r = y;
        }
        else if(a == 4 && y < s){
            s = y;
        }
    }

    if(p >= q || r >= s){
        cout << 0 << endl;
    }
    else{
        int ans = (q - p) * (s - r);
        cout << ans << endl;
    }
    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> w >> h >> n;
      |     ^~~
a.cc:32:9: error: 'cout' was not declared in this scope
   32 |         cout << 0 << endl;
      |         ^~~~
a.cc:32:22: error: 'endl' was not declared in this scope
   32 |         cout << 0 << endl;
      |                      ^~~~
a.cc:36:9: error: 'cout' was not declared in this scope
   36 |         cout << ans << endl;
      |         ^~~~
a.cc:36:24: error: 'endl' was not declared in this scope
   36 |         cout << ans << endl;
      |                        ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int W,H,N;
  cin >> W >> H >> N;
  int w1=0,w2=W,h1=0,h2=H;
  int x,y,a;
  while(cin >> 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);}
  }
  if(w1>=w2 || h1>=h2){cout << 0 << emdl;}
  else{cout << (w2-w1)*(h2-h1) << endl;}
}




Compiler output:
a.cc: In function 'int main()':
a.cc:15:37: error: 'emdl' was not declared in this scope
   15 |   if(w1>=w2 || h1>=h2){cout << 0 << emdl;}
      |                                     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int W,H,N;
  cin >> W >> H >> N;
  int w1=0,w2=W,h1=0,h2=H;
  while(cin >> 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);}
  }
  cout << (w2-w1)*(h2-h1) << endl;
}



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

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int W,H,N;
  cin >> W >> H >> N;
  vector<vector<int>> G(2,vector<int>(110,0));
  for(int i=W+1;i<110;i++){G.at(0).at(i)++;}
  for(int i=H+1;i<110;i++){G.at(1).at(i)++;}
  int x[N],y[N],a[N];
  rep(i,N){
    cin >> x[i] >> y[i] >> a[i];
    if(a==2){for(int j=x+1;j<110;j++){G.at(0).at(j)++;}}
    if(a==1){for(int j=0;j<x;j++){G.at(0).at(j)++;}}
    if(a==4){for(int j=y+1;j<110;j++){G.at(1).at(j)++;}}
    if(a==3){for(int j=0;j<y;j++){G.at(1).at(j)++;}}
  }
  int res=0,rem=0;;
  for(int s;s<110;s++){if(G.at(0).at(s)==0)res++;}
  for(int t;t<110;t++){if(G.at(1).at(t)==0)rem++;}
  cout << res*rem << endl;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |     if(a==2){for(int j=x+1;j<110;j++){G.at(0).at(j)++;}}
      |        ~^~~
a.cc:13:25: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   13 |     if(a==2){for(int j=x+1;j<110;j++){G.at(0).at(j)++;}}
      |                        ~^~
      |                         |
      |                         int*
a.cc:14:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |     if(a==1){for(int j=0;j<x;j++){G.at(0).at(j)++;}}
      |        ~^~~
a.cc:14:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |     if(a==1){for(int j=0;j<x;j++){G.at(0).at(j)++;}}
      |                          ~^~
a.cc:15:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |     if(a==4){for(int j=y+1;j<110;j++){G.at(1).at(j)++;}}
      |        ~^~~
a.cc:15:25: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   15 |     if(a==4){for(int j=y+1;j<110;j++){G.at(1).at(j)++;}}
      |                        ~^~
      |                         |
      |                         int*
a.cc:16:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |     if(a==3){for(int j=0;j<y;j++){G.at(1).at(j)++;}}
      |        ~^~~
a.cc:16:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |     if(a==3){for(int j=0;j<y;j++){G.at(1).at(j)++;}}
      |                          ~^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int W,H,N;
  cin >> W >> H >> N;
  vector<vector<int>> G(2,vector<int>(110,0));
  for(int i=W+1;i<110;i++){G.at(0).at(i)++;}
  for(int i=H+1;i<110;i++){G.at(1).at(i)++;}
  rep(i,N){
    int x[i],y[i],a[i];
    cin >> x[i] >> y[i] >> a[i];
    if(a==2){for(int j=x+1;j<110;j++){G.at(0).at(j)++;}}
    if(a==1){for(int j=0;j<x;j++){G.at(0).at(j)++;}}
    if(a==4){for(int j=y+1;j<110;j++){G.at(1).at(j)++;}}
    if(a==3){for(int j=0;j<y;j++){G.at(1).at(j)++;}}
  }
  int res=0,rem=0;;
  for(int s;s<110;s++){if(G.at(0).at(s)==0)res++;}
  for(int t;t<110;t++){if(G.at(1).at(t)==0)rem++;}
  cout << res*rem << endl;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |     if(a==2){for(int j=x+1;j<110;j++){G.at(0).at(j)++;}}
      |        ~^~~
a.cc:13:25: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   13 |     if(a==2){for(int j=x+1;j<110;j++){G.at(0).at(j)++;}}
      |                        ~^~
      |                         |
      |                         int*
a.cc:14:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |     if(a==1){for(int j=0;j<x;j++){G.at(0).at(j)++;}}
      |        ~^~~
a.cc:14:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |     if(a==1){for(int j=0;j<x;j++){G.at(0).at(j)++;}}
      |                          ~^~
a.cc:15:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |     if(a==4){for(int j=y+1;j<110;j++){G.at(1).at(j)++;}}
      |        ~^~~
a.cc:15:25: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   15 |     if(a==4){for(int j=y+1;j<110;j++){G.at(1).at(j)++;}}
      |                        ~^~
      |                         |
      |                         int*
a.cc:16:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |     if(a==3){for(int j=0;j<y;j++){G.at(1).at(j)++;}}
      |        ~^~~
a.cc:16:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |     if(a==3){for(int j=0;j<y;j++){G.at(1).at(j)++;}}
      |                          ~^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int W,H,N;
  cin >> W >> H >> N;
  vector<vector<int>> G(2,vector<int>(110,0));
  for(int i=W+1;i<110;i++){G.at(0).at(i)++;}
  for(int i=H+1;i<110;i++){G.at(1).at(i)++;}
  while(i<N){
    int x,y,a;
    cin >> x >> y >> a;
    if(a==2){for(int j=x+1;j<110;j++){G.at(0).at(j)++;}}
    if(a==1){for(int j=0;j<x;j++){G.at(0).at(j)++;}}
    if(a==4){for(int j=y+1;j<110;j++){G.at(1).at(j)++;}}
    if(a==3){for(int j=0;j<y;j++){G.at(1).at(j)++;}}
  }
  int res=0,rem=0;;
  for(int s;s<110;s++){if(G.at(0).at(s)==0)res++;}
  for(int t;t<110;t++){if(G.at(1).at(t)==0)rem++;}
  cout << res*rem << endl;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'i' was not declared in this scope
   10 |   while(i<N){
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int W,H,N;
  cin >> W >> H >> N;
  vector<int> G[110];
  int p,q;
  rep(i,N){
    int x,y,a;
    cin >> x >> y >> a;
    if(a==1){for(int j=x;j<=W;j++){G[p].push_back(j);}}
    if(a==2){for(int j=0;j<=x;j++){G[p].push_back(j);}}
    if(a==3){for(int j=y;j<=H;j++){G[q].push_back(j);}}
    if(a==4){for(int j=0;j<=y;j++){G[q].push_back(j);}}
  }
  cout << (G[a].size())*(G[q].size()) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: 'a' was not declared in this scope
   17 |   cout << (G[a].size())*(G[q].size()) << endl;
      |              ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

struct point {
    int x,y;
};
int main() {
    int w,h,n; cin >> w >> h >> n;
    vector<point> p(n);
    vector<int> a(n);
    rep(i,n) {
        cin >> p[i].x >> p[i].y >> a[i];
    }
    vector<string> b(h);
    rep(i,h) {
        b[i].resize(w);
        rep(j,w) b[i][j]='.';
    }
    /*
    rep(i,h) {
        cout << b[i] << endl;
    }
    */
    rep(i,n) {
        switch (a[i]) {
        case 1:
            rep(y,h) {
                for (int x = 0; x < p[i].x; x++)
                {
                    b[y][x] = '#';
                }
            }
            break;
        
        case 2:
            rep(y,h) {
                for (int x = p[i].x; x < w; x++)
                {
                    b[y][x] = '#';
                }
            }
            break;

        case 3:
            rep(x,w) {
                for (int y = 0; y < p[i].y; y++)
                {
                    b[y][x] = '#';
                }
            }
            break;

        case 4:
            rep(x,w) {
                for (int y = p[i].y; y < h; y++)
                {
                    b[y][x] = '#';
                }
            }
            break;

        default:
            break;
        }
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:75:6: error: expected '}' at end of input
   75 |     }
      |      ^
a.cc:17:12: note: to match this '{'
   17 | int main() {
      |            ^
Language: C++

#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int X[110],Y[110]

int main(){
  int W,H,N,x,y,a,ansX=0,ansY=0;
  cin>>W>>H>>N;

  for(int i=0;i<N;i++){
    cin>>x>>y>>a;
    if(a==1){
      for(int i=0;i<x;i++) X[i]=1;
    }else if(a==2){
      for(int i=x;i<W;i++) X[i]=1;
    }else if(a==3){
      for(int i=0;i<y;i++) Y[i]=1;
    }else{
      for(int i=y;i<H;i++) Y[i]=1;
    }
  }

  for(int i=0;i<W;i++) if(X[i]==0) ansX++;
  for(int i=0;i<H;i++) if(Y[i]==0) ansY++;
  cout<<ansX*ansY<<endl;
  
}


Compiler output:
a.cc:17:1: error: expected initializer before 'int'
   17 | int main(){
      | ^~~
Language: C++

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

int w, h, n;
int x, y, a;;

int main () {
  cin >> w >> h >> n;
  int x_min = 0, x_max = w, y_min = 0, y_max = h;
  //白い領域は長方形になる
  
  for (int i = 0; i < n; i++){
    cin >> x >> y >> a;
    if (a == 1) 
      x_min = max(x, x_min);
    else if (a == 2)
      x_max = min(x, x_max);
    else if (a == 3)
      y_min = max(y, y_min);
    else
      y_max = min(y, y_max);
  }
  cout << (max(0, x_max-x_min))(*max(0, y_max-y_min)) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:33: error: invalid type argument of unary '*' (have 'int')
   23 |   cout << (max(0, x_max-x_min))(*max(0, y_max-y_min)) << endl;
      |                                 ^~~~~~~~~~~~~~~~~~~~
a.cc:23:53: error: expression cannot be used as a function
   23 |   cout << (max(0, x_max-x_min))(*max(0, y_max-y_min)) << endl;
      |                                                     ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: expected ';' before 'break'
   19 |         S-=(W-x)*H
      |                   ^
      |                   ;
   20 |         break;
      |         ~~~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))

int main() {
	int W, H, N;
	int x, y, a;

	int xMin, xMax, yMin, yMax;

	scanf("%d %d %d", &W, &H, &N);
	xMin = 0;
	xMax = W;
	yMin = 0;
	yMax = H;
	for (int i = 0; i < N; i++) {
		scanf("%d %d %d", &x, &y, &a);
		if (a == 1)xMin = MAX(x, xMin);
		else if (a == 2)xMax = MIN(x, xMax);
		else if (a == 3)yMin = MAX(y, yMin);
		else if (a == 4) yMax = MIN(y, yMax);
	}
  int height = Max(xMax-xMin, 0);
  int width = Max(yMax - yMin, 0);
	printf("%d", height * width);
	return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: 'Max' was not declared in this scope; did you mean 'yMax'?
   25 |   int height = Max(xMax-xMin, 0);
      |                ^~~
      |                yMax
Language: C++

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

void op(vector<vector<int>> &square,vector<vector<int>> &s,int n,int w,int h){
  int height=h,width=w,stx=0,sty=0;
  for (int i=0;i<n ;i++){
    if (s.at(i).at(2) == 1){
      for (int y=0;y <h;y++){
        for (int x = 0;x<s.at(i).at(0);x++){
          square.at(y).at(x) = 0;
        }
      }
      width = min(width,(w-s.at(i).at(0)));
    }
    if (s.at(i).at(2) == 2){
      for (int y=0;y <h;y++){
        for (int x = 1+s.at(i).at(0);x<w;x++){
          square.at(y).at(x) = 0;
        }
      }
      stx =max(stx,s.at(i).st(0));
    }
    if (s.at(i).at(2) == 3){
      for (int y=0;y <s.at(i).at(1);y++){
        for (int x = 0;x<w;x++){
          square.at(y).at(x) = 0;
        }
      }
      height = min(height,s.at(i).at(1));
    }
    if (s.at(i).at(2) == 4){
      for (int y=1+s.at(i).at(1);y <h;y++){
        for (int x = 0;x<w;x++){
          square.at(y).at(x) = 0;
        }
      }
      sty=max(sty,s.at(i).at(1));
    }
  }
  int sum;
  if (height -sty<0 ||weigh -stx<0){
    sum = 0;
  }
  else{
    sum=(height-sty)*(weight-stx);
  }
  

  cout <<sum<<endl;
  return;
}
   

int main(){
  int w,h,n;
  cin>>w>>h>>n;
  vector<vector<int>> square(h,vector<int>(w,1));
  vector<vector<int>> s(n,vector<int>(3));
  for (int i =0;i<n;i++){
    for (int j=0;j<3;j++){
      cin>>s.at(i).at(j);
    }
  }
  op(square,s,n,w,h);
}

Compiler output:
a.cc: In function 'void op(std::vector<std::vector<int> >&, std::vector<std::vector<int> >&, int, int, int)':
a.cc:21:28: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'st'; did you mean 'at'?
   21 |       stx =max(stx,s.at(i).st(0));
      |                            ^~
      |                            at
a.cc:41:23: error: 'weigh' was not declared in this scope; did you mean 'height'?
   41 |   if (height -sty<0 ||weigh -stx<0){
      |                       ^~~~~
      |                       height
a.cc:45:23: error: 'weight' was not declared in this scope; did you mean 'height'?
   45 |     sum=(height-sty)*(weight-stx);
      |                       ^~~~~~
      |                       height
Language: C++

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


int _main() {
  double w,h; 
  int n;
  cin >> w >> h >> n;
  double x,y;
  int a;
  double max_x, max_y, min_x, min_y;
  max_x = w;
  max_y = h;
  min_x = 0;
  min_y = 0;
  for(int i = 0; i < n; ++i){
    cin >> x >> y >> a;
    if(a == 1) min_x = x;
    else if(a == 2) max_x = x;
    else if(a == 3) min_y = y;
    else if(a == 4) max_y = y;
  }
  if(max_x - min_x > 0 && max_y - min_y > 0) cout << (max_x - min_x) * (max_y - min_y) << endl;
  else cout << 0 << endl;
}

Compiler output:
a.cc: In function 'int _main()':
a.cc:25:1: warning: no return statement in function returning non-void [-Wreturn-type]
   25 | }
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

int main() {
  double w,h; 
  int n;
  cin >> w >> h >> n;
  double x,y;
  int a;
  double max_x, max_y, min_x, min_y;
  max_x = w;
  max_y = h;
  min_x = 0;
  min_y = 0;
  for(int i = 0; i < n; ++i){
    cin >> x >> y >> a;
    if(a == 1) min_x = x;
    else if(a == 2) max_x = x;
    else if(a == 3) min_y = y;
    else if(a == 4) max_y = y;
  }
  if(max_x - min_x > 0 && max_y - min_y > 0) cout << (max_x - min_x) * (max_y - min_y) << endl;
  else cout << 0 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   cin >> w >> h >> n;
      |   ^~~
a.cc:19:46: error: 'cout' was not declared in this scope
   19 |   if(max_x - min_x > 0 && max_y - min_y > 0) cout << (max_x - min_x) * (max_y - min_y) << endl;
      |                                              ^~~~
a.cc:19:91: error: 'endl' was not declared in this scope
   19 |   if(max_x - min_x > 0 && max_y - min_y > 0) cout << (max_x - min_x) * (max_y - min_y) << endl;
      |                                                                                           ^~~~
a.cc:20:8: error: 'cout' was not declared in this scope
   20 |   else cout << 0 << endl;
      |        ^~~~
a.cc:20:21: error: 'endl' was not declared in this scope
   20 |   else cout << 0 << endl;
      |                     ^~~~