Language: C++

#include <bits/stdc++.h>

//{{{ bit.hpp
#ifndef INCLUDE_BIT_HPP
#define INCLUDE_BIT_HPP
#include <vector>
namespace orislib {
namespace ds {
template<typename T>
struct BIT {
  std::vector<T> A;
  BIT(int n):A(n, 0){}
  T query(int l,int r){
    if (l) return sum(0,j)-sum(0,i-1);
    T S=0;
    for(;r>=0;r=(r&r+1)-1)S+=A[r];
    return S;
  }
  void add(int k,T a){
    for(int last=a.size();k<last;k|=k+1)A[k]+=a;
  }
};
}
}
#endif
//}}}

using namespace orislib::ds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;
//{{{ templates
#define TMPINL_(...) template<__VA_ARGS__>inline
#define TT_ TMPINL_(typename T)
#define TTF_ TMPINL_(typename T,typename F)
#define TTTS_ TMPINL_(typename T,typename...Ts)
#define TITS_ TMPINL_(size_t I=0,typename...Ts)
TT_ T sq(T x){return x*x;}
TT_ T In(){T x;cin>>x;return x;}
TT_ void Out(T&x){cout<<x;}
TT_ void sort(T&v){sort(begin(v),end(v));}
TT_ void revs(T&v){reverse(begin(v),end(v));}
TT_ void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT_ int ubnd(T&v,typename T::value_type&x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT_ int lbnd(T&v,typename T::value_type&x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF_ void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF_ void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
TITS_ typename enable_if<I==tuple_size<tuple<Ts...>>::value-1,string>::type join(string s,tuple<Ts...>t){return to_string(get<I>(t));}
TITS_ typename enable_if<I<tuple_size<tuple<Ts...>>::value-1,string>::type join(string s,tuple<Ts...>t){return to_string(get<I>(t))+s+join<I+1>(s,t);}
TT_ string join(string s,T t){return to_string(t);}
TTTS_ string join(string s,T t,Ts...ts){return join(s,t)+s+join(s,ts...);}

inline void fast_io(){ios::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}
inline int puts(const string&s){ return puts(s.c_str()); }
//}}} priority_queue queue deque front stringstream max_element min_element insert count make_tuple
const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000 + 0;

int main()
{
  BIT seg(100000);
  int n, q;
  n = in(), q = in();
  for (int i = 0; i < q; i++){
    int a, b, c;
    a = in(), b = in(), c = in();
    if (a) printf("%d\n", seg.query(b, c + 1));
    else seg.add(b, c);
  }
  return 0;
}

Compiler output:
a.cc: In member function 'T orislib::ds::BIT<T>::query(int, int)':
a.cc:14:25: error: 'j' was not declared in this scope
   14 |     if (l) return sum(0,j)-sum(0,i-1);
      |                         ^
a.cc:14:19: error: there are no arguments to 'sum' that depend on a template parameter, so a declaration of 'sum' must be available [-fpermissive]
   14 |     if (l) return sum(0,j)-sum(0,i-1);
      |                   ^~~
a.cc:14:19: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc:14:34: error: 'i' was not declared in this scope
   14 |     if (l) return sum(0,j)-sum(0,i-1);
      |                                  ^
a.cc:14:28: error: there are no arguments to 'sum' that depend on a template parameter, so a declaration of 'sum' must be available [-fpermissive]
   14 |     if (l) return sum(0,j)-sum(0,i-1);
      |                            ^~~
a.cc: In function 'int main()':
a.cc:67:17: error: class template argument deduction failed:
   67 |   BIT seg(100000);
      |                 ^
a.cc:67:17: error: no matching function for call to 'BIT(int)'
a.cc:12:3: note: candidate: 'template<class T> BIT(int)-> orislib::ds::BIT<T>'
   12 |   BIT(int n):A(n, 0){}
      |   ^~~
a.cc:12:3: note:   template argument deduction/substitution failed:
a.cc:67:17: note:   couldn't deduce template parameter 'T'
   67 |   BIT seg(100000);
      |                 ^
a.cc:10:8: note: candidate: 'template<class T> BIT(orislib::ds::BIT<T>)-> orislib::ds::BIT<T>'
   10 | struct BIT {
      |        ^~~
a.cc:10:8: note:   template argument deduction/substitution failed:
a.cc:67:17: note:   mismatched types 'orislib::ds::BIT<T>' and 'int'
   67 |   BIT seg(100000);
      |                 ^