Language: C++

#include<bits/stdc++.h>
#define MAX (1<<17)
using namespace std;
int n,q;
int data[MAX*2];
void Segtree(){
	int tmp=1;
	while(tmp<n)tmp*=2;
	n=tmp;
	for(int i=0;i<n*2-1;i++)data[i]=0;
}
void update(int k,int x){
	k+=n-1;
	data[k]+=x;
	while(k>0){
		k=(k-1)/2;
		data[k]+=b;
	}
}
int find(int a,int b,int k,int l,int r){
	if(r<=a || b<=l)return 0;
	if(a<=l && r<=b)return data[k];
	int v1=find(a,b,k*2+1,l,(l+r)/2);
	int v2=find(a,b,k*2+2,(l+r)/2,r);
	return max(v1,v2);
}
int main(){
	int c,x,y;
	cin>>n>>q;
	Segtree();
	for(int i=0;i<q;i++){
		scanf("%d%d%d",&c,&x,&y);
		if(c)cout<<find(x-1,y,0,0,n)<<endl;
		else update(x,y);
	}
}

Compiler output:
a.cc: In function 'void Segtree()':
a.cc:10:33: error: reference to 'data' is ambiguous
   10 |         for(int i=0;i<n*2-1;i++)data[i]=0;
      |                                 ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:5:5: note:                 'int data [262144]'
    5 | int data[MAX*2];
      |     ^~~~
a.cc: In function 'void update(int, int)':
a.cc:14:9: error: reference to 'data' is ambiguous
   14 |         data[k]+=x;
      |         ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:5:5: note:                 'int data [262144]'
    5 | int data[MAX*2];
      |     ^~~~
a.cc:17:17: error: reference to 'data' is ambiguous
   17 |                 data[k]+=b;
      |                 ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:5:5: note:                 'int data [262144]'
    5 | int data[MAX*2];
      |     ^~~~
a.cc:17:26: error: 'b' was not declared in this scope
   17 |                 data[k]+=b;
      |                          ^
a.cc: In function 'int find(int, int, int, int, int)':
a.cc:22:32: error: reference to 'data' is ambiguous
   22 |         if(a<=l && r<=b)return data[k];
      |                                ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:5:5: note:                 'int data [262144]'
    5 | int data[MAX*2];
      |     ^~~~