Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define for(i, m, n) for(ll i = m;i < n;i++)

int main() {
  cin.tie(0); ios::sync_with_stdio(false);

  int n, m, q;
  int grid[510][510];

  cin >> n >> m >> q;

  int l, r;
  rep(i, m) {
    cin >> l >> r;
    grid[l-1][r-1]++;
  }

  rep(i, n) {
    rep(j, n) {
      grid[i][j+1] += grid[i][j];
    }
  }

  cout << endl;
  rep(i, n) {
    rep(j, n) {
      cout << grid[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;

  int p, q;
  rep(i, q) {
    cin >> p >> q;
    int ans = 0;
    for(j, p-1, q) {
      ans += grid[j][q-1] - grid[j][max(0, p-2)];
      cout << ans << endl;
    }
    cout << ans << endl;
  }
}

Compiler output:
a.cc:16:11: error: macro "for" requires 3 arguments, but only 1 given
   16 |   rep(i, m) {
      |           ^
a.cc:5:9: note: macro "for" defined here
    5 | #define for(i, m, n) for(ll i = m;i < n;i++)
      |         ^~~
a.cc:21:11: error: macro "for" requires 3 arguments, but only 1 given
   21 |   rep(i, n) {
      |           ^
a.cc:5:9: note: macro "for" defined here
    5 | #define for(i, m, n) for(ll i = m;i < n;i++)
      |         ^~~
a.cc:22:13: error: macro "for" requires 3 arguments, but only 1 given
   22 |     rep(j, n) {
      |             ^
a.cc:5:9: note: macro "for" defined here
    5 | #define for(i, m, n) for(ll i = m;i < n;i++)
      |         ^~~
a.cc:28:11: error: macro "for" requires 3 arguments, but only 1 given
   28 |   rep(i, n) {
      |           ^
a.cc:5:9: note: macro "for" defined here
    5 | #define for(i, m, n) for(ll i = m;i < n;i++)
      |         ^~~
a.cc:29:13: error: macro "for" requires 3 arguments, but only 1 given
   29 |     rep(j, n) {
      |             ^
a.cc:5:9: note: macro "for" defined here
    5 | #define for(i, m, n) for(ll i = m;i < n;i++)
      |         ^~~
a.cc:37:11: error: macro "for" requires 3 arguments, but only 1 given
   37 |   rep(i, q) {
      |           ^
a.cc:5:9: note: macro "for" defined here
    5 | #define for(i, m, n) for(ll i = m;i < n;i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:16:13: error: expected '(' before '{' token
   16 |   rep(i, m) {
      |             ^
      |             (
a.cc:16:13: error: expected primary-expression before '{' token
a.cc:4:19: error: expected primary-expression before 'for'
    4 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                   ^~~
a.cc:21:3: note: in expansion of macro 'rep'
   21 |   rep(i, n) {
      |   ^~~
a.cc:19:4: error: expected ';' before 'for'
   19 |   }
      |    ^
      |    ;
a.cc:4:19: error: expected primary-expression before 'for'
    4 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                   ^~~
a.cc:21:3: note: in expansion of macro 'rep'
   21 |   rep(i, n) {
      |   ^~~
a.cc:19:4: error: expected ')' before 'for'
   19 |   }
      |    ^
      |    )
a.cc:16:13: note: to match this '('
   16 |   rep(i, m) {
      |             ^
a.cc:21:13: error: expected '(' before '{' token
   21 |   rep(i, n) {
      |             ^
      |             (
a.cc:21:13: error: expected primary-expression before '{' token
a.cc:4:19: error: expected primary-expression before 'for'
    4 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                   ^~~
a.cc:28:3: note: in expansion of macro 'rep'
   28 |   rep(i, n) {
      |   ^~~
a.cc:27:16: error: expected ')' before 'for'
   27 |   cout << endl;
      |                ^
      |                )
a.cc:21:13: note: to match this '('
   21 |   rep(i, n) {
      |             ^
a.cc:28:13: error: expected '(' before '{' token
   28 |   rep(i, n) {
      |             ^
      |             (
a.cc:28:13: error: expected primary-expression before '{' token
a.cc:36:3: error: expected primary-expression before 'int'
   36 |   int p, q;
      |   ^~~
a.cc:34:16: error: expected ')' before 'int'
   34 |   cout << endl;
      |                ^
      |                )
   35 | 
   36 |   int p, q;
      |   ~~~           
a.cc:28:13: note: to match this '('
   28 |   rep(i, n) {
      |             ^
a.cc:37:13: error: expected '(' before '{' token
   37 |   rep(i, q) {
      |             ^
      |             (
a.cc:37:13: error: expected primary-expression before '{' token
a.cc:46:1: error: expected primary-expression before '}' token
   46 | }
      | ^
a.cc:45:4: error: expected ';' before '}' token
   45 |   }
      |    ^
      |    ;
   46 | }
      | ~   
a.cc:46:1: error: expected primary-expression before '}' token
   46 | }
      | ^
a.cc:45:4: error: expected ')' before '}' token
   45 |   }
      |    ^
      |    )
   46 | }
      | ~   
a.cc:37:13: note: to match this '('
   37 |   rep(i, q) {
      |             ^
a.cc:46:1: error: expected primary-expression before '}' token
   46 | }
      | ^