Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using int = in64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
#define REP(i,a,b) for(in i=(in)(a);i<(in)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const in inf=1e9+7;
using P=pair<in,in>;
vector<in> dx={0,1,-1,0};
vector<in> dy={1,0,0,-1};

//探索、更新にO(log n)
struct segment_tree{
    in init ; //　空いてる値はこれになる
    in n; //　n個のデータ
    vector<in> data; // データ置き場・n-1~2n-1に元データ

    //(個数、初期値)
    //初期化　nを2の累乗に直す  初期値は最も選ばれない値にする
    segment_tree(in a, in b) : init(b) {
        n = 1;
        while( n < a ) n *= 2;
        data.assign(n * 2 - 1,init);
    }

    //+とかにしてもいい、結合法則はいる
    //選ぶ方の決め方（ここでは小さい方）
    in which(in a, in b){
        // if(a > b) return b;
        // else return a;
        return a+b;
    }

    // k番目をaに更新
    void update(in k, in a){
        k += n-1;
        data[k] = a;

        //下から上に更新
        while( k > 0 ){
            k = (k - 1) / 2;
            data[k] = which( data[k*2+1] , data[k*2+2] );
        }
    }

    // [a, b)の最小値を求める
    // 後ろのほうの引数は、計算の簡単のための引数。
    // kは節点の番号、l, rはその節点が[l, r)に対応づいていることを表す。
    // したがって、外からはquery(a, b, 0, 0, n)として呼ぶ。
    in query( in a, in b, in k, in l, in r){

        // [a, b)と[l, r)が交差しなければ、MAX_in
        if(r <= a || b <= l) return init;

        // [a, b)が[l, r)を完全に含んでいれば、この節点の値
        if(a <= l && r <= b) return data[k];

        // そうでなければ、2つの子の最小値
        in vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        in vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return which( vl, vr );
    }

    // 外から呼ぶとき用
    // [a, b)の最小値を求める
    in query( in a, in b){
        return query( a, b, 0, 0, n);
    }

    // a番目のデータを見る
    // query(a,a+1)で良くね？
    in look(in a){
        return data[a+n-1];
    }
};

int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in n,q;
    cin>>n>>q;
    vector<in> a(n);
        rep(i,n) cin>>a.at(i);
    
    segment_tree sg(n,0);
    rep(i,n) sg.update(i,a[i]);
    in x,y,z;
    rep(i,q){
        cin>>x>>y>>z;
        if(x){
            cout<<sg.query(y,z)<<endl;
        }
        else{
            sg.update(y,sg.look(y)+z);
        }
    }
}/*
./problem.exe
*/

Compiler output:
a.cc:5:7: error: expected nested-name-specifier before 'int'
    5 | using int = in64_t;
      |       ^~~
a.cc:15:7: error: 'in' does not name a type; did you mean 'int'?
   15 | const in MOD = 1000000007;
      |       ^~
      |       int
a.cc:16:7: error: 'in' does not name a type; did you mean 'int'?
   16 | const in INF=1e18+7;
      |       ^~
      |       int
a.cc:17:7: error: 'in' does not name a type; did you mean 'int'?
   17 | const in inf=1e9+7;
      |       ^~
      |       int
a.cc:18:14: error: 'in' was not declared in this scope; did you mean 'yn'?
   18 | using P=pair<in,in>;
      |              ^~
      |              yn
a.cc:18:17: error: 'in' was not declared in this scope; did you mean 'yn'?
   18 | using P=pair<in,in>;
      |                 ^~
      |                 yn
a.cc:18:19: error: template argument 1 is invalid
   18 | using P=pair<in,in>;
      |                   ^
a.cc:18:19: error: template argument 2 is invalid
a.cc:19:8: error: 'in' was not declared in this scope; did you mean 'yn'?
   19 | vector<in> dx={0,1,-1,0};
      |        ^~
      |        yn
a.cc:19:10: error: template argument 1 is invalid
   19 | vector<in> dx={0,1,-1,0};
      |          ^
a.cc:19:10: error: template argument 2 is invalid
a.cc:19:12: error: scalar object 'dx' requires one element in initializer
   19 | vector<in> dx={0,1,-1,0};
      |            ^~
a.cc:20:8: error: 'in' was not declared in this scope; did you mean 'yn'?
   20 | vector<in> dy={1,0,0,-1};
      |        ^~
      |        yn
a.cc:20:10: error: template argument 1 is invalid
   20 | vector<in> dy={1,0,0,-1};
      |          ^
a.cc:20:10: error: template argument 2 is invalid
a.cc:20:12: error: scalar object 'dy' requires one element in initializer
   20 | vector<in> dy={1,0,0,-1};
      |            ^~
a.cc:24:5: error: 'in' does not name a type; did you mean 'int'?
   24 |     in init ; //　空いてる値はこれになる
      |     ^~
      |     int
a.cc:25:5: error: 'in' does not name a type; did you mean 'int'?
   25 |     in n; //　n個のデータ
      |     ^~
      |     int
a.cc:26:12: error: 'in' was not declared in this scope; did you mean 'yn'?
   26 |     vector<in> data; // データ置き場・n-1~2n-1に元データ
      |            ^~
      |            yn
a.cc:26:14: error: template argument 1 is invalid
   26 |     vector<in> data; // データ置き場・n-1~2n-1に元データ
      |              ^
a.cc:26:14: error: template argument 2 is invalid
a.cc:30:20: error: expected ')' before 'a'
   30 |     segment_tree(in a, in b) : init(b) {
      |                 ~  ^~
      |                    )
a.cc:38:5: error: 'in' does not name a type; did you mean 'int'?
   38 |     in which(in a, in b){
      |     ^~
      |     int
a.cc:45:17: error: 'in' has not been declared
   45 |     void update(in k, in a){
      |                 ^~
a.cc:45:23: error: 'in' has not been declared
   45 |     void update(in k, in a){
      |                       ^~
a.cc:60:5: error: 'in' does not name a type; did you mean 'int'?
   60 |     in query( in a, in b, in k, in l, in r){
      |     ^~
      |     int
a.cc:76:5: error: 'in' does not name a type; did you mean 'int'?
   76 |     in query( in a, in b){
      |     ^~
      |     int
a.cc:82:5: error: 'in' does not name a type; did you mean 'int'?
   82 |     in look(in a){
      |     ^~
      |     int
a.cc: In member function 'void segment_tree::update(int, int)':
a.cc:46:14: error: 'n' was not declared in this scope; did you mean 'yn'?
   46 |         k += n-1;
      |              ^
      |              yn
a.cc:47:13: error: invalid types 'int[int]' for array subscript
   47 |         data[k] = a;
      |             ^
a.cc:52:17: error: invalid types 'int[int]' for array subscript
   52 |             data[k] = which( data[k*2+1] , data[k*2+2] );
      |                 ^
a.cc:52:34: error: invalid types 'int[int]' for array subscript
   52 |             data[k] = which( data[k*2+1] , data[k*2+2] );
      |                                  ^
a.cc:52:48: error: invalid types 'int[int]' for array subscript
   52 |             data[k] = which( data[k*2+1] , data[k*2+2] );
      |                                                ^
a.cc:52:23: error: 'which' was not declared in this scope
   52 |             data[k] = which( data[k*2+1] , data[k*2+2] );
      |                       ^~~~~
a.cc: In function 'int main()':
a.cc:90:5: error: 'in' was not declared in this scope; did you mean 'yn'?
   90 |     in n,q;
      |     ^~
      |     yn
a.cc:91:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   91 |     cin>>n>>q;
      |          ^
      |          yn
a.cc:91:13: error: 'q' was not declared in this scope
   91 |     cin>>n>>q;
      |             ^
a.cc:92:14: error: template argument 2 is invalid
   92 |     vector<in> a(n);
      |              ^
a.cc:93:13: error: expected ';' before 'i'
   93 |         rep(i,n) cin>>a.at(i);
      |             ^
a.cc:6:27: note: in definition of macro 'rep'
    6 | #define rep(i, n) for (in i = 0; i < (in)(n); i++)
      |                           ^
a.cc:93:13: error: 'i' was not declared in this scope
   93 |         rep(i,n) cin>>a.at(i);
      |             ^
a.cc:6:34: note: in definition of macro 'rep'
    6 | #define rep(i, n) for (in i = 0; i < (in)(n); i++)
      |                                  ^
a.cc:93:25: error: request for member 'at' in 'a', which is of non-class type 'int'
   93 |         rep(i,n) cin>>a.at(i);
      |                         ^~
a.cc:96:9: error: expected ';' before 'i'
   96 |     rep(i,n) sg.update(i,a[i]);
      |         ^
a.cc:6:27: note: in definition of macro 'rep'
    6 | #define rep(i, n) for (in i = 0; i < (in)(n); i++)
      |                           ^
a.cc:96:9: error: 'i' was not declared in this scope
   96 |     rep(i,n) sg.update(i,a[i]);
      |         ^
a.cc:6:34: note: in definition of macro 'rep'
    6 | #define rep(i, n) for (in i = 0; i < (in)(n); i++)
      |                                  ^
a.cc:97:7: error: expected ';' before 'x'
   97 |     in x,y,z;
      |       ^~
      |       ;
a.cc:98:9: error: expected ';' before 'i'
   98 |     rep(i,q){
      |         ^
a.cc:6:27: note: in definition of macro 'rep'
    6 | #define rep(i, n) for (in i = 0; i < (in)(n); i++)
      |                           ^
a.cc:98:9: error: 'i' was not declared in this scope
   98 |     rep(i,q){
      |         ^
a.cc:6:34: note: in definition of macro 'rep'
    6 | #define rep(i, n) for (in i = 0; i < (in)(n); i++)
      |                                  ^
a.cc:99:14: error: 'x' was not declared in this scope
   99 |         cin>>x>>y>>z;
      |              ^
a.cc:99:17: error: 'y' was not declared in this scope
   99 |         cin>>x>>y>>z;
      |                 ^
a.cc:99:20: error: 'z' was not declared in this scope
   99 |         cin>>x>>y>>z;
      |                    ^
a.cc:101:22: error: 'struct segment_tree' has no member named 'query'
  101 |             cout<<sg.query(y,z)<<endl;
      |                      ^~~~~
a.cc:104:28: error: 'struct segment_tree' has no member named 'look'
  104 |             sg.update(y,sg.look(y)+z);
      |                            ^~~~