Language: C++

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <string.h>
#include <stack>
#include <list>
#include <vector>

using namespace std;
int N, R;
bool **cover;
int dx[4] = {0,1,0,-1};
int dy[4] = {-1,0,1,0};
int main(){
  cover = new bool*[10002];
  for(int i=0; i<10002; ++i){
    cover[i] = new bool[10002];
  }
  for(int j=0; j<10002; ++j){
    for(int i=0; i<10002; ++i){
      cover[j][i] = false;
    }
  }
  while(cin >> N >> R && N){
    int a,b,c,d;
    for(int k=0; k<N; ++k){
      cin >> a >> b >> c >> d;
      for(int j=b+1; j<d+1; ++j){
        for(int i=a+1; i<c+1; ++i){
          
          cover[j][i] = true;
        }
      }
    }
    int area_c = 0;
    int len = 0;
    for(int j=1; j<10001; ++j){
      for(int i=1; i<10001; ++i){
            
        if(cover[j][i] == true){
          area_c++;
          for(int a = 0; a<4; ++a){
            int nx = i+dx[a];
            int ny = j+dy[a];
            if(cover[ny][nx] == false) len++;
          }
        }
      }
    }
    cout << area_c << endl;
    if(R==2) cout << len << endl;
  }
  
  for(int i=0; i<10001; ++i){
    delete[] cover[i];
  }
  delete[] cover;
  return 0;
}#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <string.h>
#include <stack>
#include <list>
#include <vector>

using namespace std;
int N, R;
bool **cover;
int dx[4] = {0,1,0,-1};
int dy[4] = {-1,0,1,0};
int main(){
  cover = new bool*[10002];
  for(int i=0; i<10002; ++i){
    cover[i] = new bool[10002];
  }
  for(int j=0; j<10002; ++j){
    for(int i=0; i<10002; ++i){
      cover[j][i] = false;
    }
  }
  while(cin >> N >> R && N){
    int a,b,c,d;
    for(int k=0; k<N; ++k){
      cin >> a >> b >> c >> d;
      for(int j=b+1; j<d+1; ++j){
        for(int i=a+1; i<c+1; ++i){
          
          cover[j][i] = true;
        }
      }
    }
    int area_c = 0;
    int len = 0;
    for(int j=1; j<10001; ++j){
      for(int i=1; i<10001; ++i){
            
        if(cover[j][i] == true){
          area_c++;
          for(int a = 0; a<4; ++a){
            int nx = i+dx[a];
            int ny = j+dy[a];
            if(cover[ny][nx] == false) len++;
          }
        }
      }
    }
    cout << area_c << endl;
    if(R==2) cout << len << endl;
  }
  
  for(int i=0; i<10001; ++i){
    delete[] cover[i];
  }
  delete[] cover;
  return 0;
}

Compiler output:
a.cc:60:2: error: stray '#' in program
   60 | }#include <cstdio>
      |  ^
a.cc:60:3: error: 'include' does not name a type
   60 | }#include <cstdio>
      |   ^~~~~~~
a.cc:70:5: error: redefinition of 'int N'
   70 | int N, R;
      |     ^
a.cc:11:5: note: 'int N' previously declared here
   11 | int N, R;
      |     ^
a.cc:70:8: error: redefinition of 'int R'
   70 | int N, R;
      |        ^
a.cc:11:8: note: 'int R' previously declared here
   11 | int N, R;
      |        ^
a.cc:71:8: error: redefinition of 'bool** cover'
   71 | bool **cover;
      |        ^~~~~
a.cc:12:8: note: 'bool** cover' previously declared here
   12 | bool **cover;
      |        ^~~~~
a.cc:72:5: error: redefinition of 'int dx [4]'
   72 | int dx[4] = {0,1,0,-1};
      |     ^~
a.cc:13:5: note: 'int dx [4]' previously defined here
   13 | int dx[4] = {0,1,0,-1};
      |     ^~
a.cc:73:5: error: redefinition of 'int dy [4]'
   73 | int dy[4] = {-1,0,1,0};
      |     ^~
a.cc:14:5: note: 'int dy [4]' previously defined here
   14 | int dy[4] = {-1,0,1,0};
      |     ^~
a.cc:74:5: error: redefinition of 'int main()'
   74 | int main(){
      |     ^~~~
a.cc:15:5: note: 'int main()' previously defined here
   15 | int main(){
      |     ^~~~