Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>

#define rep(i, initial_value, max_value) for (uint64_t i{initial_value}; i < max_value; ++i)
#define fore(i, a) for(auto &i:a)
#define each(i, c) \
    for( \
        __typeof((c).begin()) i{(c).begin()}, __typeof((c).end()) end{(c).end()}; \
        i != end; \
        ++i \
    )
#define dbg(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()

using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
using i64 = int64_t; using i32 = int32_t; using u64 = unsigned long long; using u32 = unsigned long;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<class T>bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }

// ===

void _main() {
  u32 n;
  u32 m;

  cin >> n >> m;

  u32 L[m];
  u32 R[m];

  rep(i, 0, m) cin >> L[i] >> R[i];

//  sort(L, L + m, greater<u32>());
//  sort(R, R + m);

  u32 maxL{1};
  u32 minR{n};

  rep(i, 0, m) {
    max(maxL, L[i]);
    min(minR, R[i]);
  }

//  u32 r = R[0];
//  chmin(r, n);
//
//  u32 ans = r - L[0] + 1;
//  chmax(ans, (u32)0);

  u32 ans = minR - maxL + 1;
  ans = max(ans, 0);

  cout << ans << endl;
}

Compiler output:
a.cc: In function 'void _main()':
a.cc:7:47: error: 'uint64_t' was not declared in this scope
    7 | #define rep(i, initial_value, max_value) for (uint64_t i{initial_value}; i < max_value; ++i)
      |                                               ^~~~~~~~
a.cc:34:3: note: in expansion of macro 'rep'
   34 |   rep(i, 0, m) cin >> L[i] >> R[i];
      |   ^~~
a.cc:6:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    5 | #include <cmath>
  +++ |+#include <cstdint>
    6 | 
a.cc:34:7: error: 'i' was not declared in this scope
   34 |   rep(i, 0, m) cin >> L[i] >> R[i];
      |       ^
a.cc:7:74: note: in definition of macro 'rep'
    7 | #define rep(i, initial_value, max_value) for (uint64_t i{initial_value}; i < max_value; ++i)
      |                                                                          ^
a.cc:7:87: error: expected ')' before ';' token
    7 | #define rep(i, initial_value, max_value) for (uint64_t i{initial_value}; i < max_value; ++i)
      |                                              ~                                        ^
a.cc:34:3: note: in expansion of macro 'rep'
   34 |   rep(i, 0, m) cin >> L[i] >> R[i];
      |   ^~~
a.cc:34:7: error: 'i' was not declared in this scope
   34 |   rep(i, 0, m) cin >> L[i] >> R[i];
      |       ^
a.cc:7:91: note: in definition of macro 'rep'
    7 | #define rep(i, initial_value, max_value) for (uint64_t i{initial_value}; i < max_value; ++i)
      |                                                                                           ^
a.cc:7:47: error: 'uint64_t' was not declared in this scope
    7 | #define rep(i, initial_value, max_value) for (uint64_t i{initial_value}; i < max_value; ++i)
      |                                               ^~~~~~~~
a.cc:42:3: note: in expansion of macro 'rep'
   42 |   rep(i, 0, m) {
      |   ^~~
a.cc:7:47: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    7 | #define rep(i, initial_value, max_value) for (uint64_t i{initial_value}; i < max_value; ++i)
      |                                               ^~~~~~~~
a.cc:42:3: note: in expansion of macro 'rep'
   42 |   rep(i, 0, m) {
      |   ^~~
a.cc:7:87: error: expected ')' before ';' token
    7 | #define rep(i, initial_value, max_value) for (uint64_t i{initial_value}; i < max_value; ++i)
      |                                              ~                                        ^
a.cc:42:3: note: in expansion of macro 'rep'
   42 |   rep(i, 0, m) {
      |   ^~~
a.cc:54:12: error: no matching function for call to 'max(u32&, int)'
   54 |   ans = max(ans, 0);
      |         ~~~^~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:54:12: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'int')
   54 |   ans = max(ans, 0);
      |         ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided