Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vl;

class SegmentTree {
private:
    vl st, lazy, A;
    int n;
    int leftc(int p) { return (p << 1) + 1; }
    int rightc(int p) { return (p << 1) + 2; }
    ll join(ll a, ll b) { return a + b; }

    void build(int p, int L, int R) {
        if (L == R) { st[p] = A[L]; }
        else {
            int c = (L + R)/2, p1 = leftc(p), p2 = rightc(p);
            build(p1, L, c);
            build(p2, c + 1, R);
            st[p] = join(st[p1], st[p2]);
        }
    }

    ll query(int p, int L, int R, int i, int j) {
        if (i == L && j == R) { return st[p]; }
        int c = (L + R)/2, p1 = leftc(p), p2 = rightc(p);
        push(p, L, R); //delete this for no using lazy part
        if ( j <= c ) { return query(p1, L, c, i, j); }
        if ( i > c ) { return query(p2, c + 1, R, i, j); }
        ll q1 = query(p1, L, c, i, c), q2 = query(p2, c + 1, R, c + 1, j);
        return join(q1, q2);
    }

    //The Lazy part
    inline void push(int p, int L, int R) {
        if(lazy[p]) {
           int c = (L + R)/2, p1 = leftc(p), p2 = rightc(p);
           st[p1] += (c - L + 1)*lazy[p];
           st[p2] += (R - c)*lazy[p];
           lazy[p1] += lazy[p];
           lazy[p2] += lazy[p];
           lazy[p] = 0;
        }
    }

    void update(int p, int L, int R, int i, int j, ll v) {
        if (i == L && j == R) { st[p] += (R - L + 1)*v; lazy[p] += v; return; }
        int c = (L + R)/2, p1 = leftc(p), p2 = rightc(p);
        push(p, L, R);
        if ( j <= c ) { update(p1, L, c, i, j, v); }
        else if ( i > c ) { update(p2, c + 1, R, i, j, v); }
        else { update(p1, L, c, i, c, v); update(p2, c + 1, R, c + 1, j, v); }
        st[p] = join(st[p1], st[p2]);
    }
public:
    SegmentTree(const vi &_A) {
        A = _A; n = (int)A.size();
        st.assign(4 * n, 0);
        lazy.assign(4 * n, 0);
        build(0, 0, n - 1);
    }
    ll query(int i, int j) { return query(0, 0, n - 1, i, j); }
    void update(int i, int j, ll v) { update(0, 0, n - 1, i, j, v); }
};

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n, q, t, a, b;
	ll v;
    cin>>n>>q;
    vi ceros(n);
    SegmentTree st(ceros);

    for(int i = 0; i < q; ++i) {
        cin>>t>>a>>b;
        a--; b--;
        if(t) { cout<<st.query(a,b)<<"\n"; continue; }
        cin>>v;
        st.update(a, b, v);
    }

    return 0;
}



Compiler output:
a.cc: In constructor 'SegmentTree::SegmentTree(const vi&)':
a.cc:63:13: error: no match for 'operator=' (operand types are 'vl' {aka 'std::vector<long long int>'} and 'const vi' {aka 'const std::vector<int>'})
   63 |         A = _A; n = (int)A.size();
      |             ^~
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'const vi' {aka 'const std::vector<int>'} to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'const vi' {aka 'const std::vector<int>'} to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'const vi' {aka 'const std::vector<int>'} to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~