Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
#define INF __INT32_MAX__
#define LINF __LONG_LONG_MAX__

template<typename T>
class SegmentTree
{
    private:
        int n;
        vector<T> node, lazy;
    
    public:
        SegmentTree(vector<T> V) {
            int a = V.size();
            n = 1;
            while (n < a) {
                n *= 2;
            }
            node.resize(2 * n - 1);
            lazy.resize(2 * n - 1);

            rep(i, a) {
                node[n - 1 + i] = V[i];
            }
            for (int i = n - 2; i >= 0; i--) {
                node[i] = node[2 * i + 1] + node[2 * i + 2];
            }
        }

        void eval(int k, int l, int r) {
            if (lazy[k] != 0) {
                node[k] += lazy[k];

                if (r - l > 1) {
                    lazy[2 * k + 1] += (lazy[k] / 2);
                    lazy[2 * k + 2] += (lazy[k] / 2);
                }

                lazy[k] = 0;
            }
        }

        void add(int a, int b, ll x, int k = 0, int l = 0, int r = -1) {
            if (r < 0) r = n;
            eval(k, l, r);
            if (r <= a || b <= l) return;
            if (a <= l && r <= b) {
                lazy[k] += (r - l) * x;
                eval(k, l, r);
            }
            else {
                add(a, b, x, 2 * k + 1, l, (l + r) / 2);
                add(a, b, x, 2 * k + 2, (l + r) / 2, r);
                node[k] = node[2 * k + 1] + node[2 * k + 2];
            }
        }

        T get(int a, int b, int k = 0, int l = 0, int r = -1) {
            if (r < 0) r = n;
            if (r <= a || b <= l) return 0; 

            eval(k, l, r);

            if (a <= l && r <= b) return node[k];
            T vl = get(a, b, 2 * k + 1, l, (l + r) / 2);
            T vr = get(a, b, 2 * k + 2, (l + r) / 2, r);
            return vl + vr;
        }

        void show() {
            cout << "n: " << n << endl;
            rep(i, 2 * n - 1) {
                cout << "i: " << i << ", node[i]: " << node[i] << endl;
            }
        }

};

int main() {
    int N, M; cin >> N >> M;
    vi S(N), T(N), C(N); rep(i, N) { cin >> S[i] >> T[i] >> C[i]; }

    SegmentTree<ll> st(vl(pow(10, 5)));

    rep(i, N) {
        st.add(S[i], T[i] + 1, 1);
    }

    int n = pow(10, 5);
    int ans = -1;
    rep(i, n) {
        ans = max(ans, st.get(i, i + 1));
    }

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:99:18: error: no matching function for call to 'max(int&, long long int)'
   99 |         ans = max(ans, st.get(i, i + 1));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:99:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   99 |         ans = max(ans, st.get(i, i + 1));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:99:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   99 |         ans = max(ans, st.get(i, i + 1));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~