Language: C++

//#define LOCAL

#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
#include <climits>
#include <set>

//#define int long long
//typedef long long ll;
using ll = long long;
//using R = double;

//#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

#define MOD 1000000007

const int INF = int(1e9);

using namespace std;

typedef vector<int> V;
typedef vector<V> VV;

//const int DAT_SIZE = (1 << 18) - 1;
//const int MAX_SIZE = 1 << 17;
const int MAX_SIZE = 4;

int N, Q;

ll data[2 * MAX_SIZE - 1], datb[2 * MAX_SIZE - 1];

void add(int a, int b, int x, int k, int l, int r)
{
    if (a <= l && r <= b) {
        data[k] += x;
    }
    else if (l < b && a < r) {
        datb[k] += (min(b, r) - max(a, l)) * x;
        add(a, b, x, k * 2 + 1, l, (l + r) / 2);
        add(a, b, x, k * 2 + 2, (l + r) / 2, r);
    }
}

ll sum(int a, int b, int k, int l, int r)
{
    if (b <= l || r <= a) {
        //printf("a = %d, b = %d, k = %d, l = %d, r = %d, ret = 0\n", a, b, k, l, r);
        return 0;
    }
    else if (a <= l && r <= b) {
        //printf("a = %d, b = %d, k = %d, l = %d, r = %d, ret = %d\n", a, b, k, l, r, data[k] * (r - l) * datb[k]);
        return data[k] * (r - l) * datb[k];
    }
    else {
        ll res = (min(b, r) - max(a, l)) * data[k];
        res += sum(a, b, k * 2 + 1, l, (l + r) / 2);
        res += sum(a, b, k * 2 + 2, (l + r) / 2, r);
        //printf("a = %d, b = %d, k = %d, l = %d, r = %d, ret = %d\n", a, b, k, l, r, res);
        return res;
    }
}

signed main()
{
    cin >> N >> Q;

    //int n_ = 1;
    //while (n_ < N) n_ *= 2;
    N = MAX_SIZE;
    int com, s, t, x;
    REP(i,Q) {
        cin >> com;
        if (com == 0) {
            cin >> s >> t >> x;
            //printf("s = %d, t = %d, x = %d\n", s, t, x);
            s--; t--;
            add(s, t + 1, x, 0, 0, N);
        } else {
            cin >> s;
            //printf("s = %d\n", s);
            s--;
            cout << sum(s, s + 1, 0, 0, N) << endl;
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'void add(int, int, int, int, int, int)':
a.cc:43:9: error: reference to 'data' is ambiguous
   43 |         data[k] += x;
      |         ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/istream:40,
                 from /usr/include/c++/14/fstream:40,
                 from a.cc:3:
/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:38:4: note:                 'll data [7]'
   38 | ll data[2 * MAX_SIZE - 1], datb[2 * MAX_SIZE - 1];
      |    ^~~~
a.cc: In function 'll sum(int, int, int, int, int)':
a.cc:60:16: error: reference to 'data' is ambiguous
   60 |         return data[k] * (r - l) * datb[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:38:4: note:                 'll data [7]'
   38 | ll data[2 * MAX_SIZE - 1], datb[2 * MAX_SIZE - 1];
      |    ^~~~
a.cc:63:44: error: reference to 'data' is ambiguous
   63 |         ll res = (min(b, r) - max(a, l)) * 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:38:4: note:                 'll data [7]'
   38 | ll data[2 * MAX_SIZE - 1], datb[2 * MAX_SIZE - 1];
      |    ^~~~