Language: C++

#include <bits/stdc++.h>

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef map<int, int> mint;
typedef vector<int> vint;
typedef vector<char> vch;
typedef vector<long long> vll;
typedef vector<string> vstr;


int mod(int a, int b){return (a%b+b)%b;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b){ll ans=1; rep(i, b){ans=ans*a%MOD;} return ans;}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};




template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}


vector<vint> sum;
int buildSumTable(vint L, vint R){
  sum = vector<vint>(N+1, vint(N+1, 0));

  rep(i, M){
    sum[L[i]][R[i]]++;
  }
  FOR(i, 1, N+1){
    FOR(j, 1, N+1){
      sum[i][j] += sum[i-1][j];
      sum[i][j] += sum[i][j-1];
      sum[i][j] -= sum[i-1][j-1];
    }
  }

}

int getSum(int L, int R){
  int ans = sum[R][R] - sum[R][L-1] - sum[L-1][R] + sum[L-1][L-1];
}


int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int N,M,Q;
    cin >> N >> M >> Q;
    vint L(M), R(M);
    rep(i, M){
      cin >> L[i] >> R[i];
    }

    rep(i, Q){
      cin >> p[i] >> q[i];
    }


    vector<vint> sum;
    buildSumTable(p, q);

    rep(i, Q){
      int ans = getSum(p[i], q[i]);
      ppp(ans);
    }

    return 0;
}


Compiler output:
a.cc: In function 'int buildSumTable(vint, vint)':
a.cc:74:22: error: 'N' was not declared in this scope
   74 |   sum = vector<vint>(N+1, vint(N+1, 0));
      |                      ^
a.cc:76:10: error: 'M' was not declared in this scope
   76 |   rep(i, M){
      |          ^
a.cc:8:40: note: in definition of macro 'rep'
    8 | #define rep(i, n) for (int i = 0; i < (n); ++i)
      |                                        ^
a.cc:87:1: warning: no return statement in function returning non-void [-Wreturn-type]
   87 | }
      | ^
a.cc: In function 'int getSum(int, int)':
a.cc:91:1: warning: no return statement in function returning non-void [-Wreturn-type]
   91 | }
      | ^
a.cc: In function 'int main()':
a.cc:107:14: error: 'p' was not declared in this scope
  107 |       cin >> p[i] >> q[i];
      |              ^
a.cc:107:22: error: 'q' was not declared in this scope
  107 |       cin >> p[i] >> q[i];
      |                      ^
a.cc:112:19: error: 'p' was not declared in this scope
  112 |     buildSumTable(p, q);
      |                   ^
a.cc:112:22: error: 'q' was not declared in this scope
  112 |     buildSumTable(p, q);
      |                      ^