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

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

int n, m, q, p[502][502];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m >> q;
    for(int i = 1; i <= m; i++){
        int l, r;
        cin >> l >> r;
        p[l][r]++;
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            p[i][j] += p[i][j-1];
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            p[i][j] += p[i-1][j];
        }
    }
    for(int i = 1; i <= q; i++){
        int p, q;
        cin >> p >> q;
        int ans = p[r][r] + p[l-1][l-1] - p[l-1][r] - p[r][l-1];
        cout << ans << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:21: error: 'r' was not declared in this scope
   28 |         int ans = p[r][r] + p[l-1][l-1] - p[l-1][r] - p[r][l-1];
      |                     ^
a.cc:28:31: error: 'l' was not declared in this scope
   28 |         int ans = p[r][r] + p[l-1][l-1] - p[l-1][r] - p[r][l-1];
      |                               ^
Language: C++

#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx")

#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cassert>

using namespace std;

using int64 = long long;
template<class T> ostream& operator<<(ostream& os, vector<T>& _) { os << '{'; for (T& x : _) { os << x; if (&x != &_.back()) os << ','; } os << '}'; return os; }
template<class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#else
#define debug(_) 1728
#endif

template <typename T>
class CumulativeSum2D {
 public:
  CumulativeSum2D(const std::vector<vector<T>>& vec)
      : vec_(vec), height_(vec.size()), width_(vec[0].size()) {
    Build();
  }
  // return sum of [sx, gx] * [sy, gy]
  T Get(int sx, int sy, int gx, int gy) {
    assert(sx <= gx && sy <= gy);
    assert(0 <= sx && sx < height_ && 0 <= gx && gx < height_ && 0 <= sy &&
          sy < width_ && 0 <= gy && gy < width_);
    return sum_[gx + 1][gy + 1] - sum_[gx + 1][sy] - sum_[sx][gy + 1] +
          sum_[sx][sy];
  }

 private:
  size_t height_;
  size_t width_;
  std::vector<vector<T>> vec_;
  std::vector<vector<T>> sum_;
  void Build() {
    sum_.assign(height_ + 1, vector<T>(width_ + 1, static_cast<T>(0)));
    for (size_t i = 0; i < height_; ++i) {
      for (size_t j = 0; j < width_; ++j) {
        sum_[i + 1][j + 1] = sum_[i + 1][j] + vec_[i][j];
      }
    }
    for (size_t i = 0; i < width_; ++i) {
      for (size_t j = 0; j < height_; ++j) {
        sum_[j + 1][i + 1] += sum_[j][i + 1];
      }
    }
  }
};

void ABC106_D() {
  int n, m, query; scanf("%d %d %d", &n, &m, &query);
  vector<vector<int>> board(n, vector<int>(n));
  for (int i = 0; i < m; ++i) {
    int l, r; scanf("%d %d", &l, &r); --l; --r;
    ++board[l][r];
  }

  CumulativeSum2D<int> cs2(board);

  for (int i = 0; i < query; ++i) {
    int p, q; scanf("%d %d", &p, &q);
    --p; --q;
    //cout << cs2.Get(p, p, q, q) << '\n';
    printf("%d\n", cs2.Get(p, p, q, q));
  }  
}

int main() {
  //ios_base::sync_with_stdio(false);
  //cin.tie(nullptr);

  ABC106_D();

  return 0;
}


Compiler output:
a.cc:13:19: error: 'ostream' does not name a type
   13 | template<class T> ostream& operator<<(ostream& os, vector<T>& _) { os << '{'; for (T& x : _) { os << x; if (&x != &_.back()) os << ','; } os << '}'; return os; }
      |                   ^~~~~~~
a.cc:14:28: error: 'ostream' does not name a type
   14 | template<class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
      |                            ^~~~~~~
Language: C++


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

    int N, M, Q;
    std::cin >> N >> M >> Q;

    vector<vector<int>> table(N + 1, vector<int>(N + 1, 0));
    REP(i, M) {
        int l, r;
        std::cin >> l >> r;
        table[l][r]++;
    }

    REP(flag, 2) {
        for(int i = 1; i <= N; i++) {
            for(int j = 1; j <= N; j++) {
                table[i][j] += flag ? table[i - 1][j] : table[i][j - 1];
            }
        }
    }

    REP(i, Q) {
        int p, q;
        std::cin >> p >> q;
        std::cout << table[q][q] + table[p - 1][p - 1] -
                     table[p - 1][q] - table[q][p - 1] << std::endl;
    }

    return 0;
}


Compiler output:
a.cc:2:5: error: 'cin' does not name a type
    2 |     cin.tie(0);
      |     ^~~
a.cc:3:5: error: 'ios' does not name a type
    3 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:6:10: error: 'cin' in namespace 'std' does not name a type
    6 |     std::cin >> N >> M >> Q;
      |          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | 
a.cc:8:5: error: 'vector' does not name a type
    8 |     vector<vector<int>> table(N + 1, vector<int>(N + 1, 0));
      |     ^~~~~~
a.cc:9:8: error: expected constructor, destructor, or type conversion before '(' token
    9 |     REP(i, M) {
      |        ^
a.cc:15:8: error: expected constructor, destructor, or type conversion before '(' token
   15 |     REP(flag, 2) {
      |        ^
a.cc:23:8: error: expected constructor, destructor, or type conversion before '(' token
   23 |     REP(i, Q) {
      |        ^
a.cc:30:5: error: expected unqualified-id before 'return'
   30 |     return 0;
      |     ^~~~~~
a.cc:31:1: error: expected declaration before '}' token
   31 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
typedef pair<long long, long long> pll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

//N M Q
//M本の電車区間
//Qの範囲に収まるM
int main() {

    ll N,M,Q;

    cin >> N >> M >> Q;

    vector <pll> LR(M);
    REP(i,M)
    {
        cin >> LR[i].first >> LR[i].second;
    }

    //vector <pair<pll,ll>> PQ(Q);
    vector <pll> PQ(Q);
    REP(i,M)
    {
//        cin >> PQ[i].first.first >> PQ[i].first.second;
//        PQ[i].second = i;
        cin >> PQ[i].first >> PQ[i].second;
    }

    sort(LR.begin(),LR.end());
    sort(PQ.begin(),PQ.end());
    //ソートすることで

    REP(i,Q)
    {
        ll cnt = 0;
        REP(j,M)
        {
            //条件
            if(PQ[i].first <= LR[j].first && PQ[i].second >= LR[j].second)
            {
                ++cnt;
            }
            //はやめに抜ける
            if(PQ[i].first > LR.first)break;
            if(PQ[i].second < LR.second)break;
        }
        cout << cnt << endl;
    }

    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:33: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
   58 |             if(PQ[i].first > LR.first)break;
      |                                 ^~~~~
a.cc:59:34: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
   59 |             if(PQ[i].second < LR.second)break;
      |                                  ^~~~~~
Language: C++

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

int n, m, Q;

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

vector<vector<int>> sum;
int buildSumTable(vector<int> L, vector<int> R) {
    sum = vector<vector<int>>(n+1, vector<int>(n+1, 0));
    rep(i, m) {
        sum[L[i]][R[i]]++;
    }

    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            sum[i][j] += sum[i-1][j];
            sum[i][j] += sum[i][j-1];
            sum[i][j] -= sum[i-1][j-1];
        }
    }
}

int main() {
    cin >> n >> m >> Q;
    vector<int> L(m);
    vector<int> R(m);
    rep(i, m) {
        cin >> L[i] >> R[i];
    }
    vector<int> p(Q);
    vector<int> q(Q);
    rep(i, Q) {
        cin >> p[i] >> q[i];
    }

    buildSumTable(L, R);

    rep(i, Q) {
        int ans = getSumRange(p[i], q[i]);
        cout << ans << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int getSumRange(int, int)':
a.cc:17:15: error: 'sum' was not declared in this scope
   17 |     int ans = sum[R][R] - sum[R][L-1] - sum[L-1][R] + sum[L-1][L-1];
      |               ^~~
a.cc: In function 'int buildSumTable(std::vector<int>, std::vector<int>)':
a.cc:35:1: warning: no return statement in function returning non-void [-Wreturn-type]
   35 | }
      | ^
Language: C++

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

int n, m, Q;
int main() {
    cin >> n >> m >> Q;
    vector<int> L(m);
    vector<int> R(m);
    rep(i, m) {
        cin >> L[i] >> R[i];
    }
    vector<int> p(Q);
    vector<int> q(Q);
    rep(i, Q) {
        cin >> p[i] >> q[i];
    }

    buildSumTable(L, R);

    rep(i, Q) {
        int ans = getSumRange(p[i], q[i]);
        cout << ans << endl;
    }

    return 0;
}

vector<vector<int>> sum;
int buildSumTable(vector<int> L, vector<int> R) {
    sum = vector<vector<int>>(n+1, vector<int>(n+1, 0));
    rep(i, m) {
        sum[L[i]][R[i]]++;
    }

    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            sum[i][j] += sum[i-1][j];
            sum[i][j] += sum[i][j-1];
            sum[i][j] -= sum[i-1][j-1];
        }
    }
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: 'buildSumTable' was not declared in this scope
   28 |     buildSumTable(L, R);
      |     ^~~~~~~~~~~~~
a.cc:31:19: error: 'getSumRange' was not declared in this scope
   31 |         int ans = getSumRange(p[i], q[i]);
      |                   ^~~~~~~~~~~
a.cc: In function 'int buildSumTable(std::vector<int>, std::vector<int>)':
a.cc:52:1: warning: no return statement in function returning non-void [-Wreturn-type]
   52 | }
      | ^
Language: C++

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

int main() {
  int sum,p,q,N,M,Q,L[200009],R[200009],X[509][509],C[509][509];
	cin>>N>>M>>Q;
	for(int i=1;i<M+1;i++){
		cin>>L[i]>>R[i];X[L[i]][R[i]]++;
	}
	for(int i=1;i<N+1;i++){
		for(int j=1;j<N+1;j++){
          C[i][j]=C[i][j-1]+X[i][j];
	}
	for(int i=1;i<Q+1;i++){
      cin>>p>>q;
		sum=0;
		for(int j=p;j<q+1;j++){
          sum+=C[j][q]-C[j][p-1];
        }
		cout<<sum<<endl;
	}
}

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

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}

signed main()
{
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<vector<int>> C(N, vector<int>(N, 0));
  for (int i = 0; i < M; i++)
  {
    int L, R;
    cin >> L >> R;
    N.at(L - 1).at(R - 1)++;
  }
  
  for (int i = 1; i < N; i++)
  {
    for (int j = 0; j < i; j++)
    {
      C.at(j).at(j + i) += C.at(j).at(j + i - 1) + C.at(j + 1).at(j + i) - C.at(j + 1).at(j + i - 1);
    }
  }
  
  for (int i = 0; i < Q; i++)
  {
    int p, q;
    cin >> p >> q;
    cout << C.at(p - 1).at(q - 1) << endl;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:7: error: request for member 'at' in 'N', which is of non-class type 'long long int'
   24 |     N.at(L - 1).at(R - 1)++;
      |       ^~
Language: C++

#include <iostream>
#include <tuple>

using namespace std;

int main() {
    cout.sync_with_stdio(false);
    cin.sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m, q;
    cin >> n >> m >> q;

    vector<pair<int, int>> train(m);
    vector<pair<int, int>> range(q);

    for (int i = 0; i < m; i++) { cin >> train[i].first >> train[i].second; }

    for (int i = 0; i < q; i++) { cin >> range[i].first >> range[i].second; }

    for (int i = 0; i < q; i++) { cout << 0 << endl; }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'vector' was not declared in this scope
   14 |     vector<pair<int, int>> train(m);
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <tuple>
a.cc:14:25: error: expected primary-expression before '>' token
   14 |     vector<pair<int, int>> train(m);
      |                         ^~
a.cc:14:28: error: 'train' was not declared in this scope
   14 |     vector<pair<int, int>> train(m);
      |                            ^~~~~
a.cc:15:25: error: expected primary-expression before '>' token
   15 |     vector<pair<int, int>> range(q);
      |                         ^~
a.cc:15:28: error: 'range' was not declared in this scope
   15 |     vector<pair<int, int>> range(q);
      |                            ^~~~~
Language: C++

#include <iostream>



int main()
{

  cout <<

    "Reminder for myself : I'll solve this on Friday.\n"

      << endl;

  

}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |   cout <<
      |   ^~~~
      |   std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:12:10: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   12 |       << 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++

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

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

    int N, M, Q; cin >> N >> M >> Q;
    set<int> l[N], r[N], lr[N][N];

    for (int i = 0; i < M; ++i) {
        int left, right; cin >> left >> right;
        --left; --right;
        l[left].insert(i); r[right].insert(i);
    }

    for (int i = 0; i < N - 1; ++i) {
        l[i + 1].insert(l[i].begin(), l[i].end());
    }

    for (int i = N - 1; i > 0; --i) {
        r[i - 1].insert(r[i].begin(), r[i].end());
    }

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            set_union(l[i].begin(), l[i].end(),
                    r[j].begin(), r[j].end(),
                    lr[i][j].begin());
        }
    }

    for (int i = 0; i < Q; ++i) {
        int p, q; cin >> p >> q; --p; --q;
        int ans = M;

        if (p > 0 && q < N - 1) {
            ans -= (int) lr[p - 1][q + 1].size();
        } else if (p > 0){
            ans -= (int) l[p - 1].size();
        } else if (q < N - 1) {
            ans -= (int) r[q + 1].size();
        }

        cout << ans << '\n';
    }

    return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_OutputIterator std::__set_union(_InputIterator1, _InputIterator1, _InputIterator2, _InputIterator2, _OutputIterator, _Compare) [with _InputIterator1 = _Rb_tree_const_iterator<int>; _InputIterator2 = _Rb_tree_const_iterator<int>; _OutputIterator = _Rb_tree_const_iterator<int>; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:5112:41:   required from '_OIter std::set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter) [with _IIter1 = _Rb_tree_const_iterator<int>; _IIter2 = _Rb_tree_const_iterator<int>; _OIter = _Rb_tree_const_iterator<int>]'
 5112 |       return _GLIBCXX_STD_A::__set_union(__first1, __last1,
      |                                         ^
a.cc:27:22:   required from here
   27 |             set_union(l[i].begin(), l[i].end(),
      |             ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   28 |                     r[j].begin(), r[j].end(),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~
   29 |                     lr[i][j].begin());
      |                     ~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5047:25: error: assignment of read-only location '__result.std::_Rb_tree_const_iterator<int>::operator*()'
 5047 |               *__result = *__first1;
      |               ~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5052:25: error: assignment of read-only location '__result.std::_Rb_tree_const_iterator<int>::operator*()'
 5052 |               *__result = *__first2;
      |               ~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5057:25: error: assignment of read-only location '__result.std::_Rb_tree_const_iterator<int>::operator*()'
 5057 |               *__result = *__first1;
      |               ~~~~~~~~~~^~~~~~~~~~~
Language: C++

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

int main(){
  int N, M, Q;cin>>N>>M>>Q;
  int dp[N+1][N+1];
  memset(dp,0, sizeof(dp));
  
  for (int i=0;i<M;++i){
    int l, r;cin>>l>>r;
    dp[l][r]++; 
  }

  int l_cumsum[N+1][N+1];
  memset(l_cumsum, 0, sizeof(l_cumsum));

  for (int i=0;i<N;++i){
    l_cumsum[l][i+1]=l_cumsum[l][i]+dp[l][i+1];
  }

  int cumsum[N+1][N+1];
  memset(cumsum, 0, sizeof(cumsum));

  for (int i=0;i<N;++i){
    cumsum[i+1][r]=cumsum[i][r]+dp[i+1][r];
  }

  for (int i=0;i<Q;++i){
    int p,q;cin>>p>>q;
    cout << cumsum[N][q]-cumsum[p-1][p] << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: 'l' was not declared in this scope
   18 |     l_cumsum[l][i+1]=l_cumsum[l][i]+dp[l][i+1];
      |              ^
a.cc:25:17: error: 'r' was not declared in this scope
   25 |     cumsum[i+1][r]=cumsum[i][r]+dp[i+1][r];
      |                 ^
Language: C++

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

int main(){
  int N, M, Q;cin>>N>>M>>Q;
  int dp[N+1][N+1];
  memset(dp,0, sizeof(dp));
  
  for (int i=0;i<M;++i){
    int l, r;cin>>l>>r;
    dp[l][r]++; 
  }

  int l_cumsum[N+1][N+1];
  memset(l_cumsum, 0, sizeof(l_cumsum));

  for (int i=0;i<N;++i){
    l_cumsum[l][i+1]=l_cumsum[l][i]+dp[l][i+1];
  }

  int cumsum[N+1][N+1];
  memset(cumsum, 0, sizeof(cumsum));

  for (int i=0;i<N;++i){
    cumsum[i+1][r]=cumsum[i][r]+dp[i+1][r];
  }

  for (int i=0;i<Q;++i){
    int p,q;cin>>p>>q;
    cout << cumsum[N][q]-cumsum[p-1][p] << endl;
  }

  return 0;
}

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

#include <iostream>
#include <string>
#include <vector>

int main() {
    int n, m, q;
    std::vector<std::vector<int>> vec;

    std::cin >> n >> m >> q;
    vec.resize(n);

    for(int i = 0; i < m; ++i) {
        int l, r;

        std::cin >> l >> r;

        --l, --r;

        vec[l].push_back(r);
    }

    for(int i = 0; i < n; ++i) {
        std::sort(vec[i].begin(), vec[i].end());
    }

    for(int i = 0; i < q; ++i) {
        int p, q;

        std::cin >> p >> q;
        --p, --q;

        int cnt = 0;
        for(int j = p; j <= q; ++j) {
            //std::cout << j << std::endl;
            cnt += std::upper_bound(vec[j].begin(), vec[j].end(), q) - vec[j].begin();
        }

        std::cout << cnt << std::endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   23 |         std::sort(vec[i].begin(), vec[i].end());
      |              ^~~~
      |              qsort
a.cc:35:25: error: 'upper_bound' is not a member of 'std'; did you mean 'lower_bound'?
   35 |             cnt += std::upper_bound(vec[j].begin(), vec[j].end(), q) - vec[j].begin();
      |                         ^~~~~~~~~~~
      |                         lower_bound
Language: C++

#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T &a){int t = 0;for(auto itr :a){if(t++)cout << " "; cout << itr;} cout <<endl; }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
template <class T>
class Cumulative2DSum {
public:
    vector<vector<T>>sum;
    T e;
    Cumulative2DSum(vector<vector<T>>&v,T e) {
        int W = v.size();
        int H = v.front().size();
        ++H , ++W;
        sum = vector<vector<T>>(H,vector<T>(W,e));
        
        for(int i = 0; i < v.size(); ++i){
            for(int j = 0; j < v[i].size(); ++j){
                sum[i + 1][j + 1] +=  v[i][j];
            }
        }
        for(int i = 1; i < sum.size(); ++i){
            for(int j = 1; j < sum[i].size();++j){
                sum[i][j] += sum[i][j - 1] + sum[i - 1][j] - sum[i - 1][j - 1];
            }
        }
    }
    auto query(int sx,int sy,int gx,int gy){
        return sum[gx][gy] - sum[sx][gy] - sum[gx][sy] + sum[sx][sy];
    }
};

signed main(){
    int n,m,Q;
    cin >> n >> m >> Q;
    vector<vector<int>>grid(n,vector<int>(n,0LL));
    rep(_,m){
        int l,r; cin >> l >> r;
        --l,--r;
        grid[l][r]++;
    }
    auto dcm = Cumulative2DSum<int>(grid,0LL);
    rep(_,Q){
        int l,r; cin >> l >> r;
        --l,--r;
        cout << dcm.query(l,l,r+1,r+1) <<endl;
    }
}


å


Compiler output:
a.cc:68:1: error: '\U000000e5' does not name a type
   68 | å
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main(){

	int N, M, Q;N>>M>>Q;
 	int table[N+1][N+1];
	for (int i=0;i<=N;++i){
		for (int j=0;j<=N;++j){
			dp[i][j]=0;
		}
	}

	for (int i=0;i<M;i++){
		int L, R;cin>>L>>R;
		table[L][R]++;
	}

	for (int l=0;l<N;++l){
		for (int r=1;r<=N;++r){
			table[l+1][r]=table[l][r];
		}
	}

	for (int l=1;l<=N;++l){
		for (int r=0;r<N;++r){
			table[l][r+1]=table[l][r];
		}
	}

	for (int i=0;i<Q;++i){
		int p,q;cin>>p>>q;
		int ans=table[q][q]+table[p-1][p-1]-table[q][p-1]-table[p-1][q];
		cout << ans << endl;
	}

	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   12 |                         dp[i][j]=0;
      |                         ^~
      |                         dup
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main(){

	int N, M, Q;N>>M>>Q;
	vvi table(N+1, vi(N+1, 0));

	for (int i=0;i<M;i++){
		int L, R;cin>>L>>R;
		table[L][R]++;
	}

	for (int l=0;l<N;++l){
		for (int 1=0;r<=N;++r){
			table[l+1][r]=table[l][r];
		}
	}

	for (int l=1;l<=N;++l){
		for (int r=0;r<N;++r){
			table[l][r+1]=table[l][r];
		}
	}

	for (int i=0;i<Q;++i){
		int p,q;cin>>p>>q;
		int ans=table[q][q]+table[p-1][p-1]-table[q][p-1]-table[p-1][q];
		cout << ans << endl;
	}

	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:26: error: expected unqualified-id before numeric constant
   17 |                 for (int 1=0;r<=N;++r){
      |                          ^
a.cc:17:25: error: expected ';' before numeric constant
   17 |                 for (int 1=0;r<=N;++r){
      |                         ^~
      |                         ;
a.cc:17:26: error: lvalue required as left operand of assignment
   17 |                 for (int 1=0;r<=N;++r){
      |                          ^
a.cc:17:30: error: 'r' was not declared in this scope
   17 |                 for (int 1=0;r<=N;++r){
      |                              ^
a.cc:17:34: error: expected ')' before ';' token
   17 |                 for (int 1=0;r<=N;++r){
      |                     ~            ^
      |                                  )
a.cc:17:37: error: 'r' was not declared in this scope
   17 |                 for (int 1=0;r<=N;++r){
      |                                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	vvi table(N+1, vi(N+1, 0));

	int N, M, Q;N>>M>>Q;

	for (int i=0;i<M;i++){
		int L, R;cin>>L>>R;
		table[L][R]++;
	}

	for (int l=0;l<N;++l){
		for (int r=0;r<=N;++r){
			table[l+1][r]=table[l][r];
		}
	}

	for (int l=0;l<=N;++l){
		for (int r=0;r<N;++r){
			table[l][r+1]=table[l][r];
		}
	}

	for (int i=0;i<Q;++i){
		int p,q;cin>>p>>q;
		int ans=table[q][q]+table[q-1][q-1]-table[p][q-1]-table[q-1][p];
		cout << ans << endl;
	}

	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:19: error: 'N' was not declared in this scope
    6 |         vvi table(N+1, vi(N+1, 0));
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;

int bit_sum(vvi& table, int l, int r){
  int s=0;
  while(l>0){
    while(r>0){
      s+=table[l][r];
      r-=r&-r;
    }
    l-=l&-l;
  }
  return s;
}

void bit_add(vvi& table, int l, int r, int x){
  int N=table.size()-1;
  while(l<=N){
    while(r<=N){
      table[l][r]+=x;
    }
    r+=r&-r;
  }
  l+=l&-l;
}

int main(){
  int N, M, Q;cin>>N>>M>>Q;
  vi L, R;
  
  for (int i=0;i<M;++i){
    int l, r;cin>>l>>r;
    L.push_back(l);
    R.push_back(r);
  }

  vi p,q;
  for (int i=0;i<Q;++i){
    int p_,q_;cin>>p_>>q_;
    p.push_back(p_);
    q.push_back(q_);
  }

  vvi table(N+1, vi(N+1,0));

  for (int i=0;i<M;++i){
    int l=L[i];
    int r=R[i];
    bit_add(table, l, r, 1);
  }

  for (int i=0;i<Q;++i){
    int ans=0;
    ans+=bit_sum[N][q[i]];
    ans-=bit_sum[p[i]][q[i]];
    cout << ans << endl;
  }

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:56:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |     ans+=bit_sum[N][q[i]];
      |                   ^
a.cc:56:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |     ans+=bit_sum[N][q[i]];
      |                         ^
a.cc:56:8: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |     ans+=bit_sum[N][q[i]];
      |     ~~~^~~~~~~~~~~~~~~~~~
a.cc:56:25: error: invalid conversion from 'int (*)(vvi&, int, int)' {aka 'int (*)(std::vector<std::vector<int> >&, int, int)'} to 'int' [-fpermissive]
   56 |     ans+=bit_sum[N][q[i]];
      |                         ^
      |                         |
      |                         int (*)(vvi&, int, int) {aka int (*)(std::vector<std::vector<int> >&, int, int)}
a.cc:57:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   57 |     ans-=bit_sum[p[i]][q[i]];
      |                      ^
a.cc:57:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   57 |     ans-=bit_sum[p[i]][q[i]];
      |                            ^
a.cc:57:8: error: invalid operands of types 'int' and 'int (*)(vvi&, int, int)' {aka 'int (*)(std::vector<std::vector<int> >&, int, int)'} to binary 'operator-'
   57 |     ans-=bit_sum[p[i]][q[i]];
      |     ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:57:8: note:   in evaluation of 'operator-=(int, int (*)(vvi&, int, int) {aka int (*)(class std::vector<std::vector<int> >&, int, int)})'
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;

int bit_sum(vvi& table, int l, int r){
  int s=0;
  while(l>0){
    while(r>0){
      s+=table[l][r];
      r-=r&-r;
    }
    l-=l&-l;
  }
  return s;
}

void bit_add(vvi& table, int l, int r, int x){
  int N=table.size();
  while(l<=N){
    while(r<=N){
      table[l][r]+=x;
    }
    r+=r&-r;
  }
  l+=l&-l;
}

int main(){
  int N, M, Q;cin>>N>>M>>Q;
  vi L, R;
  
  for (int i=0;i<M;++i){
    int l, r;cin>>l>>r;
    L.push_back(l);
    R.push_back(r);
  }

  vi p,q;
  for (int i=0;i<Q;++i){
    int p_,q_;cin>>p_>>q_;
    p.push_back(p_);
    q.push_back(q_);
  }

  vvi table(N, vi(N,0));

  for (int i=0;i<M;++i){
    int l=L[i];
    int r=R[i];
    bit_add(table, l, r, 1);
  }

  for (int i=0;i<Q;++i){
    int ans=0;
    ans+=bit_sum[N][q[i]];
    ans-=bit_sum[p[i]][q[i]];
    cout << ans << endl;
  }

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:56:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |     ans+=bit_sum[N][q[i]];
      |                   ^
a.cc:56:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |     ans+=bit_sum[N][q[i]];
      |                         ^
a.cc:56:8: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |     ans+=bit_sum[N][q[i]];
      |     ~~~^~~~~~~~~~~~~~~~~~
a.cc:56:25: error: invalid conversion from 'int (*)(vvi&, int, int)' {aka 'int (*)(std::vector<std::vector<int> >&, int, int)'} to 'int' [-fpermissive]
   56 |     ans+=bit_sum[N][q[i]];
      |                         ^
      |                         |
      |                         int (*)(vvi&, int, int) {aka int (*)(std::vector<std::vector<int> >&, int, int)}
a.cc:57:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   57 |     ans-=bit_sum[p[i]][q[i]];
      |                      ^
a.cc:57:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   57 |     ans-=bit_sum[p[i]][q[i]];
      |                            ^
a.cc:57:8: error: invalid operands of types 'int' and 'int (*)(vvi&, int, int)' {aka 'int (*)(std::vector<std::vector<int> >&, int, int)'} to binary 'operator-'
   57 |     ans-=bit_sum[p[i]][q[i]];
      |     ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:57:8: note:   in evaluation of 'operator-=(int, int (*)(vvi&, int, int) {aka int (*)(class std::vector<std::vector<int> >&, int, int)})'
Language: C++

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

using namespace std;

int main() {
	int N, M, Q;

	cin >> N >> M >> Q;
	vector<vector<int>> cities,csum;
	vector<int> ans;

	cities.resize(N + 1);
	csum.resize(N + 1);
	for (int i = 0; i <= N; i++) {
		cities[i].resize(N + 1);
		csum[i].resize(N + 1);
		for (int j = 0; j <= N; j++) {
			cities[i][j] = 0;
			csum[i][j] = 0;
		}
	}

	for (int i = 0; i < M; i++) {
		int l, r;
		cin >> l >> r;
		cities[l][r]++;
	}

	//２次元累積和の計算
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			csum[i][j] = csum[i][j - 1] + csum[i - 1][j] + cities[i][j]
				- csum[i - 1][j - 1];
		}
	}

	for (int i = 0; i < Q; i++) {
		int p, q;
		int p, q;
		cin >> p >> q;

		ans.push_back(csum[q][q] - csum[p-1][q] - csum[q][p-1] +csum[p-1][p-1]);
	}

	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i] << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:21: error: redeclaration of 'int p'
   41 |                 int p, q;
      |                     ^
a.cc:40:21: note: 'int p' previously declared here
   40 |                 int p, q;
      |                     ^
a.cc:41:24: error: redeclaration of 'int q'
   41 |                 int p, q;
      |                        ^
a.cc:40:24: note: 'int q' previously declared here
   40 |                 int p, q;
      |                        ^
Language: C++

#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x3f3f3f3f
using namespace std;

int a[505][505], f[505][505];

int main()
{
	int n, m, q, l, r;
	scanf("%d%d%d", &n, &m, &q);
	for (int i = 1; i <= m; ++i) 
	{
		scanf("%d%d", &l, &r);
		a[l][r]++;
	}
	for (int i = 1; i <= n; ++i) f[i][i] = a[i][i];
	for (int i = 1; i <= n - 1; ++i) f[i][i + 1] = a[i][i + 1] + f[i + 1][i + 1] + f[i][i];
	for (int k = 2; k <= n - 1; ++k)
		for (int i = 1; i <= n - k; ++i) 
			f[i][i + k] = a[i][i + k] + f[i][i + k - 1] + f[i + 1][i + k] - f[i + 1][i + k - 1];
	for (int i = 1; i <= q; ++i)
	{
		scanf_s("%d%d", &l, &r);
		printf("%d\n", f[l][r]);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   33 |                 scanf_s("%d%d", &l, &r);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
vector<vector<int> > LR;
vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));

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

	ll N,M,Q;
	cin>>N>>M>>Q;
	int C[509][509];
	LR=vector<vector<int> >(N+1, vector<int>(N+1,0));
	REP(i,M){
		int a,b;
		cin>>a>>b;
		LR[a][b]++;
	}
	FOR(i,1,N+1){
		REP(i,N+1)C[i][j]=C[i][j-1]+LR[i][j];
	}
	FOR(i,1,Q+1){
		int a,b;
		cin>>a>>b;
		ll ans=0;
		FOR(j,a,b+1)
				ans+=C[j][b]-C[j][a-1];
		cout<<ans<<endl;
	}
				
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:32: error: 'j' was not declared in this scope
   40 |                 REP(i,N+1)C[i][j]=C[i][j-1]+LR[i][j];
      |                                ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>

using namespace std;
using lli = long long int;
// #define DEBUG
#ifdef DEBUG
#define debug(var) cout << (#var) << ": " << (var) << endl;
template<class T> void dump_array_impl(const T& a) {
  bool first = true;
  for (auto&& x : a) {
    if (!first) cout << ", "; else first = false;
    cout << x;
  }
}
#define debug_array(a) cout<<(#a)<<": ";dump_array_impl(a);cout<<endl
#else
#define debug(var) {}
#define debug_array(a) {}
#endif
template<class T> void read_n(vector<T>& v, size_t n) {
  v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i];
}
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int n, m, q;
int mat[501][501];
int main() {
  memset(mat, 0, sizeof(decltype(mat[0][0]))*501*501);
  cin >> n >> m >> q;
  for (int i=0; i<m; ++i) {
    int a, b; cin >> a >> b;
    mat[b][a]++;
  }
  for (int y=2; y<=n; ++y) {
    for (int i=1, j=y; j<=n; ++i, ++j) {
      mat[j][i] += mat[j-1][i] + mat[j][i+1] - mat[j-1][i+1];
    }
  }
  for (int i=0; i<q; ++i) {
    int a, b;
    cin >> a >> b;
    cout << mat[b][a] << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:3: error: 'memset' was not declared in this scope
   39 |   memset(mat, 0, sizeof(decltype(mat[0][0]))*501*501);
      |   ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include <utility>
  +++ |+#include <cstring>
   12 |
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>

using namespace std;
using lli = long long int;
// #define DEBUG
#ifdef DEBUG
#define debug(var) cout << (#var) << ": " << (var) << endl;
template<class T> void dump_array_impl(const T& a) {
  bool first = true;
  for (auto&& x : a) {
    if (!first) cout << ", "; else first = false;
    cout << x;
  }
}
#define debug_array(a) cout<<(#a)<<": ";dump_array_impl(a);cout<<endl
#else
#define debug(var) {}
#define debug_array(a) {}
#endif
template<class T> void read_n(vector<T>& v, size_t n) {
  v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i];
}
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int n, m, q;
int mat[501][501];
int main() {
  memset(mat, 0, sizeof(decltype(mat[0][0]))*501*501);
  cin >> n >> m >> q;
  for (int i=0; i<m; ++i) {
    int a, b; cin >> a >> b;
    mat[b][a]++;
  }
  for (int y=2; y<=n; ++y) {
    for (int i=1, j=y; j<=n; ++i, ++j) {
      mat[j][i] += mat[j-1][i] + mat[j][i+1] - mat[j-1][i+1];
    }
  }
  for (int i=0; i<q; ++i) {
    int a, b;
    cin >> a >> b;
    cout << mat[b][a] << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:3: error: 'memset' was not declared in this scope
   38 |   memset(mat, 0, sizeof(decltype(mat[0][0]))*501*501);
      |   ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <utility>
  +++ |+#include <cstring>
   11 |
Language: C++

#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

// Fenwick Tree
int n;
int bit[100000]; 

void add( int a, int x ){
	for( int i = a; i <= n; i += ( i & -i ) ) bit[i] += x;
}

int sum( int a ){
	int res = 0;
	for( int i = a; i > 0; i -= ( i & -i ) ) res += bit[i];
	return res;
}

struct abschnitt{
	int link;
	int recht;
	bool art; // query wenn true, zug wenn false
	int nummer;
};
	
int main(){
	
	vector<abschnitt> v;
	map<int, int> karte;
	int m, q; cin >> n >> m >> q;
	
	for( int i = 0; i < m; ++i ){
		int l, r; cin >> l >> r;
		v.push_back( (abschnitt){ l, r, false, 0 } );
	}
	for( int i = 0; i < q; ++i ){
		int l, r; cin >> l >> r;
		v.push_back( (abschnitt){ l, r, true, i } );
	}
	
	sort(
		v.begin(), v.end(),
		[]( const abschnitt x, const abschnitt y ){
			return ( x.recht == y.recht ) ? ( y.art ) : ( x.recht < y.recht );
		}
	);
	
	for( int i = 0; i < m+q; ++i ){
		// cout << v[i].link << " " << v[i].recht << " " << v[i].art <<  " " << v[i].nummer << endl;
		v[i].art	?	karte.emplace( v[i].nummer, sum( v[i].recht ) - sum( v[i].link - 1 ) )
					:	add( v[i].link, 1 );
	}
	
	for ( int i = 0; i < q; ++i ) cout << karte.at(i) << endl;
	return 0;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:54: error: third operand to the conditional operator is of type 'void', but the second operand is neither a throw-expression nor of type 'void'
   53 |                 v[i].art        ?       karte.emplace( v[i].nummer, sum( v[i].recht ) - sum( v[i].link - 1 ) )
      |                                         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

NR == 1{
  N = $1
  M = $2
  Q = $3
}
NR >= 2 && NR <= 1 + M{
  ++m[$1, $2 - $1]
}
NR >=3 && NR > 1 + M{
  ans = 0
  for(left = $1; left <= $2; ++left){
    for(len = 0; len <= $2 - $1 - (left - $1); ++len){
      ans += m[left, len]
    }
  }
  print ans
}

Compiler output:
a.cc:1:1: error: 'NR' does not name a type
    1 | NR == 1{
      | ^~
a.cc:6:1: error: 'NR' does not name a type
    6 | NR >= 2 && NR <= 1 + M{
      | ^~
a.cc:9:1: error: 'NR' does not name a type
    9 | NR >=3 && NR > 1 + M{
      | ^~
Language: C++

#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

int main(void) {
	int n,m,q;
	cin >> n >> m >> q;
	int l,r,train[501][501];
	for(int i=0; i<=n; i++){
		for(int j=0; j<=n; j++){
		train[i][j]=0;
		ans[i][j]=0;
		}
	}
	for(int i=0; i<m; i++){
		cin >> l >> r;
		train[l][r]++;
	}
	for(int i=1; i<=n; i++){
		for(int j=1; j<=n; j++){
			train[i][j]+=train[i][j-1]+sum[i-1][j]-sum[i-1][j-1];
		}
	}
	for(int i=0; i<q; i++){
		cin >> l >> r;
		cout << train[l][r]-train[l][r-1]-train[l-1][r]+train[l-1][r-1] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |                 ans[i][j]=0;
      |                 ^~~
      |                 abs
a.cc:28:52: error: 'sum' was not declared in this scope
   28 |                         train[i][j]+=train[i][j-1]+sum[i-1][j]-sum[i-1][j-1];
      |                                                    ^~~
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 999999999
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};
int dx[]={1, -1, 0, 0};

int main(){

  int n,m,q;
  cin>>n>>m>>q;
  int trainL[n+1],trainR[n+1];
  trainL[0] = 0;
  trainR[0] = 0;
  REP(i,m){
    int l,r;
    scanf("%d %d",&l,&r);
    trainL[l]++;
    trainR[r]++;
  }
  int sumL[n+1],sumR[n+1];
  sumL[0] = 0;
  sumR[0] = 0;
  for(int i=1,i<=n,i++){
    sumL[i] = sumL[i-1] + trainL[i];
    sumR[i] = sumR[i-1] + trainR[i];
  }
  REP(i,q){
    int l,r;
    scanf("%d %d",&l,&r);
    printf("%d",sumR[r] - sumL[l]);
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:16: error: expected ';' before '<=' token
   36 |   for(int i=1,i<=n,i++){
      |                ^~
      |                ;
a.cc:36:16: error: expected primary-expression before '<=' token
   36 |   for(int i=1,i<=n,i++){
      |                ^~
a.cc:36:23: error: expected ';' before ')' token
   36 |   for(int i=1,i<=n,i++){
      |                       ^
      |                       ;
Language: C++

#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int l[300000];
int r[300000];
int p[300000];
int q[300000];
vector<int> fd[301];
vector<int> ld[301];
int main() {
  int n, m, Q;
  scanf("%d%d%d", n, m, Q)
  cin >> n >> m >> Q;
  rep(i, m){
    cin >> l[i] >> r[i];
  }
  reps(i, n){
    rep(j, m){
      if(r[j] > i) fd[i].push_back(j);
    }
  }
  reps(i, n){
    rep(j, m){
      if(l[j]<i) ld[i].push_back(j);
    }
  }
  rep(i, Q){
    int sum = 0;
    cin >> p[i] >> q[i];
    scanf("%d%d", p[i], q[i]);
    set<int> st;
    for(auto at : ld[p[i]]){
      st.insert(at);
    }
    for(auto at : fd[q[i]]){
      st.insert(at);
    }
    cout << m - st.size() << endl;
  }


  return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:27: error: expected ';' before 'cin'
   39 |   scanf("%d%d%d", n, m, Q)
      |                           ^
      |                           ;
   40 |   cin >> n >> m >> Q;
      |   ~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int l[200000];
int r[200000];
int p[100000];
int q[100000];
vector<int> fd[101];
vector<int> ld[101];
int main() {
  int n, m, Q;
  cin >> n >> m >> Q;
  rep(i, m){
    cin >> l[i] >> r[i];
  }
  reps(i, n){
    rep(j, m){
      if(r[j] > n) fd[i].push_back(j);
    }
  }
  reps(i, n){
    rep(j, m){
      if!(l[j]<l) ld[i].push_back(j);
    }
  }
  rep(i, Q){
    int sum = 0;
    cin >> p[i] >> q[i];
    set<int> st;
    for(auto at : ld[p[i]]){
      st.insert(at);
    }
    for(auto at : fd[q[i]]){
      st.insert(at);
    }
    cout << n - st.size() << endl;
  }


  return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:9: error: expected '(' before '!' token
   50 |       if!(l[j]<l) ld[i].push_back(j);
      |         ^
      |         (
Language: C++


#include<bits/stdc++.h>
using namespace std;
int n,m,q,sum[517][517],dp[517][517],x[100010],y[100010];
int main()
{
	scanf("%d%d%d",&n,&m,&q);
	for (int i=1;i<=m;i++) {scanf("%d%d",&x[i],&y[i]); sum[x[i]][y[i]]++; }
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++) dp[i][j]=dp[i-1][j]+sum[x[i]][y[i]];
	for (int i=1;i<=q;i++)
	{
		int x,y,res=0;
		scanf("%d%d",&x,&y);
		for (int j=xlj<=y;j++){
			res+=dp[j][y];
		}
		printf("%d\n",res);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:28: error: 'xlj' was not declared in this scope
   15 |                 for (int j=xlj<=y;j++){
      |                            ^~~
a.cc:15:38: error: expected ';' before ')' token
   15 |                 for (int j=xlj<=y;j++){
      |                                      ^
      |                                      ;