Language: C++

#include <cassert>// c
#include <iostream>// io
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>// container
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <algorithm>// other
#include <complex>
#include <numeric>
#include <functional>
using namespace std;

typedef int32_t i32;typedef int64_t i64;typedef i64 ll;typedef uint32_t uint;typedef uint64_t ull;

#define ALL(c) (begin(c)),(end(c))
#define REP(i,n) FOR(i,0,n)
#define REPr(i,n) FORr(i,0,n)
#define FOR(i,l,r) for(int i=(int)(l);i<(int)(r);++i)
#define FORr(i,l,r) for(int i=(int)(r)-1;i>=(int)(l);--i)
#define EACH(it,o) for(__typeof((o).begin()) it = (o).begin(); it != (o).end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

//debug
#define DUMP(x)  cerr << #x << " = " << (x)
#define DUMPLN(x)  DUMP(x) <<endl
#define DEBUG(x) DUMP(x) << LINE() << " " << __FILE__
#define DEBUGLN(x) DEBUG(x)<<endl
#define LINE()    cerr<< " (L" << __LINE__ << ")"
#define LINELN()    LINE()<<endl
#define CHECK(exp,act)  if(exp!=act){DUMPLN(exp);DEBUGLN(act);}
#define STOP(e)  CHECK(e,true);if(!(e)) exit(1);

class range {
private:
    struct Iter{
        int v;
        int operator*(){return v;}
        bool operator!=(Iter& itr) {return v < itr.v;}
        void operator++() {++v;}
    };
    Iter i, n;
public:
    range(int n) : i({0}), n({n}) {}
    range(int i, int n) : i({i}), n({n}) {}
    Iter& begin() {return i;}
    Iter& end() {return n;}
};

//output
template<typename T> ostream& operator << (ostream& os, const vector<T>& as){REP(i,as.size()){if(i!=0)os<<" "; os<<as[i];}return os;}
template<typename T> ostream& operator << (ostream& os, const vector<vector<T> >& as){REP(i,as.size()){if(i!=0)os<<endl; os<<as[i];}return os;}
template<typename T> ostream& operator << (ostream& os, const set<T>& ss){EACH(a,ss){if(a!=ss.begin())os<<" "; os<<a;}return os;}
template<typename T1,typename T2> ostream& operator << (ostream& os, const pair<T1,T2>& p){os<<p.first<<" "<<p.second;return os;}
template<typename K,typename V> ostream& operator << (ostream& os, const map<K,V>& m){bool isF=true;EACH(p,m){if(!isF)os<<endl;os<<p;isF=false;}return os;}

//input
char tmp[1000];
#define nextInt(n) scanf("%d",&n)
#define nextLong(n) scanf("%lld",&n) //I64d
#define nextDouble(n) scanf("%lf",&n) 
#define nextChar(n) scanf("%c",&n)
#define nextString(n) scanf("%s",tmp);n=tmp

// values
template<class T> T INF(){assert(false);};
template<> int INF<int>(){return 2147483647;};
template<> ll INF<ll>(){return 1LL<<58;};
template<> double INF<double>(){return 1e16;};


namespace Fenwicks{
    template<typename T> class Fenwick{
    public:
        int size;vector<T> bit;
        Fenwick():Fenwick(0){}
        Fenwick(int n):size(n){bit = vector<T>(n+1);}
        T sum(int n){// [0,n)
            T s=0;
            while(n>0){
                s+=bit[n];
                n-=n&-n;//low
            }
            return s;
        }
        void add(int i,T x){//[0,...i...,n)
            i++;
            while(i<=size){
                bit[i]+=x;
                i+=i & -i;//next
            }
        }
        
        //lib
        T sum(int a,int b){// [a,b)
            return sum(b)-sum(a);
        }
    };
}
using namespace Fenwicks;

namespace Fenwicks{

    // [l,r)に v を足す
    //↑[l,r)のsumに対して d(x)=v*(x-l)+v=v*x -v*l+v のグラフを加算する．
    //↑　sum(l)の傾き+=v．sum(l)の値+=-v*l+v． 直線を足す．
    //      sum(r)の傾き-=v．sum(r)の値-=-v*r+v．  直線を引く．
    // (足された後の変化) sum(r)の値+=d(r)　値を足す．

    // [l,r)のsumに加算するグラフの基底が定まれば同様の手法で書ける．

    // ex [l,r)に 0*v,2*v,4*v,6*v, ... 2*(r-l-1)*v を加える．
    // ↑[l,r)のsumに対して d(x)=v*(x-l)(x-l+1) のグラフを加算する．
    //    [l,r)のsumに対して d(x)=v* x^2 + v*(-2*l+1)x +v*(l^2 - l)を加算．
    // ↑sum(l)の二次係数+=v sum(r)の二次係数-=v
    //    sum(l)の一次係数+=v*(-2*l+1) sum(r)の一次係数-=v*(-2*l+1)
    //    sum(l)の値+=v*(l^2 - l) sum(r)の値-=v*(l^2-l)
    // (足された後の変化) sum(r)の値+=d(r)　値を足す．
    // 二次関数を足す　→　二次関数を引く　→　値を足す．
    template<typename T> class FenwickLen{
    public:
        int size;
        Fenwick<T> bit1,bit0;
        FenwickLen(int n):size(n){
            bit0=Fenwick<T>(n);bit1=Fenwick<T>(n);
        }
        T sum(int n){// [0,n)
            return bit1.sum(n)*n+bit0.sum(n);
        }
        T sum(int a,int b){// [a,b)
            return sum(b)-sum(a);
        }
        void add(int l,int r,T v){// [l,r)
            bit1.add(l,v);bit1.add(r,-v);
            bit0.add(l,-v*l+v);bit0.add(r,-(-v*r+v));
            bit0.add(r,v*(r-l)+v);
        }
    };
}
using namespace Fenwicks;

stringstream ss;
class Main{
    public:
    void run(){
        int n,m;cin >> n >> m;
        FenwickLen<int> fen(n);
        REP(i,m){
            int t,x,y;cin >> t >> x >> y;
            if(t==0){
                fen.add(x,x+1,y);
            }else{
                cout << fen.sum(x,y+1)<<endl;
            }
        }
    }
};

int main(){
 cout <<fixed<<setprecision(20);
 cin.tie(0);
 ios::sync_with_stdio(false);
 Main().run();
 return 0;
}

Compiler output:
a.cc:18:64: error: 'uint32_t' does not name a type
   18 | typedef int32_t i32;typedef int64_t i64;typedef i64 ll;typedef uint32_t uint;typedef uint64_t ull;
      |                                                                ^~~~~~~~
a.cc:16:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   15 | #include <functional>
  +++ |+#include <cstdint>
   16 | using namespace std;
a.cc:18:86: error: 'uint64_t' does not name a type
   18 | typedef int32_t i32;typedef int64_t i64;typedef i64 ll;typedef uint32_t uint;typedef uint64_t ull;
      |                                                                                      ^~~~~~~~
a.cc:18:86: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'