stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



#define ll long long

#define ull unsigned long long

#define PI acos(-1.0)

#define eps 1e-12

#define fi first

#define se second

#define pb push_back

#define MEM(a,b) memset((a),(b),sizeof(a))

#define mod(x) ((x)%MOD)

#define pii pair<int,int>

#define wz cout<<"-----"<<endl;

const int INF_INT = 2147483647;

const ll INF_LL = 9223372036854775807LL;

const ull INF_ULL = 18446744073709551615Ull;

const ll P = 92540646808111039LL;



const ll maxn = 1e5 + 10, MOD = 1e9 + 7;

const int Move[4][2] = {-1,0,1,0,0,1,0,-1};

const int Move_[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};



inline int read(){

    int x=0,f=1;char ch=getchar();

    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}

    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}

    return x*f;

}





void init() {



}



vector<int>E[maxn];





int main(){

//    freopen("C:\\Users\\Administrator\\Desktop\\in.txt","r",stdin);

//    freopen("C:\\Users\\Administrator\\Desktop\\out.txt","w",stdout);

//    ios_base::sync_with_stdio(0);

    init();

    int n,m; cin >>n >>m;

    for (int i = 0; i <m; i++){

        int x, y; cin >> x >> y;

        E[x].pb(y);

        E[y].pb(x);

    }

    for (int i = 1; i <= n; i++) {

        cout << E[i].size() << endl;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 3.486702192090504x):
#include<bits/stdc++.h>

using namespace std;

int main()

{



    int k,l,a,b;

    cin>>k;

    cin>>l;



    map<int,int>s;

    for(int i = 0; i < l; i++)

    {

        cin>>a>>b;

        s[a]++;

        s[b]++;





    }

    for(int i = 1; i <= k; i++)

    {

        cout<<s[i]<<endl;

    }

}
// Slower C++ solution:
#include <iostream>

using namespace std;

int main() {

  int a, b, c, d, i;

  cin >> a >> b;

  int A[114514] = {};

  for(i=0;i<b;i++) {

    cin >> c >> d;

    A[d]++;

    A[c]++;

  }

  for(i=1;i<=a;i++) {

    cout << A[i] << endl;

  }

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4487400029977018x):
#include <bits/stdc++.h>

using namespace std;

int main() {

  int a, b, i, c;

  cin >> a >> b;

  vector<int> way(a);

  for(i=0;i<2*b;i++) {

    cin >> c;

    way.at(c-1)++;

  }

  for(i=0;i<a;i++) {

    cout << way.at(i) << endl;

  }

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<vector>

     

using namespace std;

     

const int MAXN = 3e5 + 10;

     

vector <int> adj[MAXN];

     

int main() {

    int n, m;

    cin >> n >> m;

    for(int i = 0; i < m; i++){

        int v,u;

        cin >> v >> u ;

		v--;

		u--;

        adj[v].push_back(u);

		adj[u].push_back(v);

    }

	for(int i=0 ; i<n ; i++){

		cout << adj[i].size() << endl;

	}

}

// Faster C++ solution for the same problem (measured speedup: 9.396927982634933x):
#include<iostream>

using namespace std;

int m,n,a[1001];

int main(){

	cin>>m>>n;

	for(int i=0;i<n;i++){

   int x,y;

		cin>>x>>y;

		a[x]++;

		a[y]++;

	}

	for(int i=1;i<=m;i++)cout<<a[i]<<endl;

	return 0; 

}
// Slower C++ solution:
#include <iostream>

#include <bits/stdc++.h>

#define pb push_back

#define ob pop_back

#define xx first

#define yy second

#define dob double

#define rin(i,n,k) for(int i=0;i<n;i+=k)

#define int long long int

#define ss size()

using namespace std;

const int M=1e9+7,maxn=100010;

std::vector<int> adj[maxn];

std::vector<int> v1;

int ans,n,k,m,x,y,q,par[maxn],h[maxn],mach[maxn],sk[maxn],dp[maxn];

bool mark[maxn],bpart[maxn];

string s,s1,s2;

map <string ,int> mp;

bool markchaild[maxn];

bool dfsmach(int v){

    if(v==-1) return true;

    if(mark[v]==1) return false;

    mark[v]=1;

    for(int i=0;i<adj[v].ss;i++){

        int u=adj[v][i];

        if(dfsmach(mach[u])){

            bpart[u]=((bpart[v]+1)%2);

            mach[u]=v;

            mach[v]=u;

            return true;

        }

    }

    return false;

}





int32_t main() {

    cin>>n>>m;

    for(int i=0;i<m;i++){

        cin>>x>>y;

        h[x]++;

        h[y]++;

    }

    for(int i=1;i<=n;i++)

        cout<<h[i]<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 3.527035424640849x):
#include <iostream>

#include <set>

using namespace std;



int a[51];

int main(){

	int n,m;

	int u,v;

	

	cin >> n >> m;

	while(m--){

		cin >> u >> v;

		a[u]++;

		a[v]++;

	}

	for(int i = 1;i<=n;i++){

		cout << a[i] << endl;

	}

}
// Slower C++ solution:
#define _USE_MATH_DEFINES

#include<iostream>

#include<iomanip>

#include<algorithm>

#include<cctype>

#include<cmath>

#include<cstdio>

#include<deque>

#include<list>

#include<set>

#include<stack>

#include<string>

#include<sstream>

#include<map>

#include<queue>

#include<vector>

using namespace std;



int main() {

	int a[1001] = {};

	for (int i = 1; i <= 1000; i++)

		a[i] = a[i - 1] + i;



	for (int N; cin >> N&&N;) {

		int cnt = 0;

		for (int i = 0; i <= 1000; i++)

			for (int j = i + 2; j <= 1000; j++)

				if (a[j] - a[i] == N)

					cnt++;



		cout << cnt << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3081598183376817x):
#define _USE_MATH_DEFINES

#include<iostream>

#include<iomanip>

#include<algorithm>

#include<cctype>

#include<cmath>

#include<cstdio>

#include<deque>

#include<list>

#include<set>

#include<stack>

#include<string>

#include<sstream>

#include<map>

#include<queue>

#include<vector>

using namespace std;



int main() {

	int a[1001] = {};

	for (int i = 1; i <= 1000; i++)

		a[i] = a[i - 1] + i;



	for (int N; cin >> N&&N;) {

		int cnt = 0;

		for (int i = 0; i <= 1000; i++)

			for (int j = i + 2; j <= 1000; j++)

				if (a[j] - a[i] > N)

					break;

				else if (a[j] - a[i] == N)

					cnt++;

		cout << cnt << endl;

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



int solve(int N) {

    int ans = 0;

    for (int i = 2; i <= N; ++i) {

        for (int j = 1; j <= N; ++j) {

            int sum = 0;

            for (int k = 0; k < i; ++k) {

                sum += j + k;

            }

            if (sum == N) {

                ++ans;

            }

        }

    }

    return ans;

}



int main() {

    while (1) {

        int N; cin >> N;

        if (N == 0) {

            break;

        }

        cout << solve(N) << endl;

    }

}

// Faster C++ solution for the same problem (measured speedup: 2.78168046277137x):
#include <bits/stdc++.h>



using namespace std;



int solve(int N) {

    int ans = 0;

    for (int i = 2; i <= N; ++i) { // i???

        for (int j = 1; j <= N; ++j) { // j???????§???????

            // if ( j + (j+1) + ... + (j+i-1) == N ) {

            //     ++ans;

            // }

            int sum = (2*j+i-1)*i/2;

            if (sum == N) {

                ++ans;

            }

        }

    }

    return ans;

}



int main() {

    while (1) {

        int N; cin >> N;

        if (N == 0) {

            break;

        }

        cout << solve(N) << endl;

    }

}
// Slower C++ solution:
#include <iostream>



using namespace std;



int main()

{

    int n;

    

    while(true)

    {

        scanf("%d", &n);

        

        if(n == 0) break;

        

        int ret = 0;

        

        for(int i = 1; i < n; i++)

        {

            for(int j = 2; j <= n / i; j++)

            {

                int sum = 0;

                

                for(int k = i; k < i + j; k++)

                {

                    sum += k;

                }

                

                if(sum == n) ret++;

            }

        }

        

        printf("%d\n", ret);

    }

    

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 0.7704416936980123x):
#include <cstdio>

int n;

int main() {

	while(scanf("%d", &n), n) {

		int ret = 0;

		for(int l = 1; l <= n; l++) {

			for(int r = l + 1; r <= n; r++) {

				int sum = 0;

				for(int k = l; k <= r; k++) sum += k;

				if(sum == n) ret++;

			}

		}

		printf("%d\n", ret);

	}

}
// Slower C++ solution:
#include <iostream>



using namespace std;



int main()

{

    int n;

    

    while(true)

    {

        scanf("%d", &n);

        

        if(n == 0) break;

        

        int ret = 0;

        

        for(int i = 1; i < n; i++)

        {

            for(int j = 2; j <= n / i; j++)

            {

                int sum = 0;

                

                for(int k = i; k < i + j; k++)

                {

                    sum += k;

                }

                

                if(sum == n) ret++;

            }

        }

        

        printf("%d\n", ret);

    }

    

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.424829800763404x):
#include <cstdio>

int n;

int main() {

	while(scanf("%d", &n), n) {

		int ret = 0;

		for(int l = 1; l <= n; l++) {

			int sum = l;

			for(int r = l + 1; r <= n; r++) {

				sum += r;

				if(sum == n) ret++;

			}

		}

		printf("%d\n", ret);

	}

}
// Slower C++ solution:
#include <cstdio>

int n;

int main() {

	while(scanf("%d", &n), n) {

		int ret = 0;

		for(int l = 1; l <= n; l++) {

			for(int r = l + 1; r <= n; r++) {

				int sum = 0;

				for(int k = l; k <= r; k++) sum += k;

				if(sum == n) ret++;

			}

		}

		printf("%d\n", ret);

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.993271956834408x):
#include <cstdio>

int n;

int main() {

	while(scanf("%d", &n), n) {

		int ret = 0;

		for(int l = 1; l <= n; l++) {

			int sum = l;

			for(int r = l + 1; r <= n; r++) {

				sum += r;

				if(sum == n) ret++;

			}

		}

		printf("%d\n", ret);

	}

}
// Slower C++ solution:
#include <iostream>



using namespace std;



int main()

{

    int n;

    

    while(true)

    {

        scanf("%d", &n);

        

        if(n == 0) break;

        

        int ret = 0;

        

        for(int i = 1; i < n; i++)

        {

            for(int j = 2; j <= n / i; j++)

            {

                int sum = 0;

                

                for(int k = i; k < i + j; k++)

                {

                    sum += k;

                }

                

                if(sum == n) ret++;

            }

        }

        

        printf("%d\n", ret);

    }

    

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.283276160885181x):
#include <cstdio>

int n;

int main() {

	while(scanf("%d", &n), n) {

		int ret = 0;

		for(int l = 1; l <= n; l++) {

			int sum = l;

			for(int r = l + 1; r <= n; r++) {

				sum += r;

				if(sum == n) ret++;

				if(sum > n) break;

			}

		}

		printf("%d\n", ret);

	}

}
// Slower C++ solution:
#include <cstdio>

int n;

int main() {

	while(scanf("%d", &n), n) {

		int ret = 0;

		for(int l = 1; l <= n; l++) {

			for(int r = l + 1; r <= n; r++) {

				int sum = 0;

				for(int k = l; k <= r; k++) sum += k;

				if(sum == n) ret++;

			}

		}

		printf("%d\n", ret);

	}

}

// Faster C++ solution for the same problem (measured speedup: 6.820437804161187x):
#include <cstdio>

int n;

int main() {

	while(scanf("%d", &n), n) {

		int ret = 0;

		for(int l = 1; l <= n; l++) {

			int sum = l;

			for(int r = l + 1; r <= n; r++) {

				sum += r;

				if(sum == n) ret++;

				if(sum > n) break;

			}

		}

		printf("%d\n", ret);

	}

}
// Slower C++ solution:
#include <bits/stdc++.h>

 

#define loop(n, i) for(int i=0;i<n;i++)

#define all(vec) vec.begin(),vec.end()



using namespace std;



int main(int argc, char const* argv[])

{

    while (1) {

        int N; cin >> N;

        if (!N) break;

        int ans = 0;

        loop (1001, i) loop (1001, j) if (i < j) {

            if (!i || !j) continue;

            if ((i + j) * (j - i + 1) == N * 2) ans++;

        }

        cout << ans << endl;

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.6421427109783753x):
#include <bits/stdc++.h>

 

#define loop(n, i) for(int i=0;i<n;i++)

#define all(vec) vec.begin(),vec.end()



using namespace std;



int main(int argc, char const* argv[])

{

    while (1) {

        int N; cin >> N;

        if (!N) break;

        int ans = 0;

        for (int i = 1; i <= 1000; i++) for (int j = i+1; j < 1000; j++) {

            if ((i + j) * (j - i + 1) == N * 2) ans++;

        }

        cout << ans << endl;

    }

    return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

int n, m, k;

int main() {

	int i, j;

	cin>>n>>m>>k;

	for(i=0; i<=n; i++) for(j=0; j<=m; j++) {

		if((n-i)*j + (m-j)*i == k) {cout<<"Yes"; return 0;}

	}

    cout<<"No";

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.263541399108184x):
#include <cstdio>

int n, m, k, i, j;

int main() {

	scanf("%d%d%d", &n, &m, &k);

	for(i=0; i<=n; i++) for(j=0; j<=m; j++)

		if((n-i)*j + (m-j)*i == k) return puts("Yes"), 0;

	puts("No");

}
// Slower C++ solution:
#include<iostream>

using namespace std;

typedef long long ll;

int main(){

  ll n,m,k,tmp;

  bool can[1000001]={};

  cin >> n >> m >> k;

  for(ll i=0;i<=n;i++){

    for(ll j=0;j<=m;j++){

      tmp = i*m+j*n;

      tmp -= (i*j)*2;

      can[tmp]=true;

    }

  }

  if(can[k])cout <<"Yes\n";

  else cout <<"No\n";

}


// Faster C++ solution for the same problem (measured speedup: 2.0235569112473426x):
#include<iostream>

#include<vector>

#include<algorithm>

using namespace std;

typedef long long ll;

typedef pair<ll,ll> P;

signed main(){

  ll n,m,k,tmp;

  bool can=false;

  cin >> n >> m >> k;

  for(int i=0;i<=n;i++){

    for(int j=0;j<=m;j++){

      tmp = (i*m)+(j*n)-(i*j)*2;

      if(tmp==k){

        can=true;

        break;

      }

    }

  }

  if(can){

    cout <<"Yes\n";

  }else{

    cout <<"No\n";

  }

}
// Slower C++ solution:
#include<cstdio>

#include<algorithm>

using namespace std;



struct segtree{

  int n;

  int data[262143];

  segtree(int _n){

    n = 1;

    while(n<_n) n *= 2;

    fill(data,data+2*n-1,0);

  }

  void add(int i,int x){

    i += n-2;

    data[i] += x;

    while(i>0){

      i = (i-1)/2;

      data[i] += x;

    }

  }

  int getSum(int s,int t){

    return getSum(s-1,t,0,0,n);

  }

  int getSum(int a,int b,int k,int l,int r){

    if(a<=l&&r<=b) return data[k];

    else if(a>=r||b<=l) return 0;

    else{

      int vl = getSum(a,b,2*k+1,l,(l+r)/2);

      int vr = getSum(a,b,2*k+2,(l+r)/2,r);

      return vl + vr;

    }

  }

};



int main(){

  int n,q;

  scanf("%d%d",&n,&q);

  segtree st(n);

  for(int i=0;i<q;i++){

    int cmd,x,y;

    scanf("%d%d%d",&cmd,&x,&y);

    if(cmd==0) st.add(x,y);

    else if(cmd==1) printf("%d\n",st.getSum(x,y));

  }

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1195571177703434x):
#include<cstdio>

#include<algorithm>

using namespace std;



int bit[100001];

int n,q;



void add(int i,int v){

	while(i<=n){

		bit[i] += v;

		i += i & -i;

	}

}



int sum(int i){

	int res = 0;

	while(i>0){

		res += bit[i];

		i -= i & -i;

	}

	return res;

}





int main(){

	scanf("%d %d",&n,&q);

	fill(bit,bit+n+1,0);

	for(int i=0;i<q;i++){

		int cmd,x,y;

		scanf("%d %d %d",&cmd,&x,&y);

		if(cmd==0){

			add(x,y);

		}else{

			printf("%d\n",sum(y)-sum(x-1));

		}

	}

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<vector>

#include<algorithm>

#include<climits>

using namespace std;

const int MAX_N=100000;



int n;

vector<int> dat(4*MAX_N,0);



void init(int N){

	n=1;

	while(n<N){

		n*=2;

	}

}



void add(int i, int y){

	int k;

	k=n-1+i;

	dat[k] += y;

	while(k>0){

		k=(k-1)/2;

		dat[k]+=y;

	}

}



int find(int x, int y, int k,int l,int r){

	if(r <= x || l >= y){

		return 0;

	}

	if(r <= y && l >= x){

		return dat[k];

	}else{

		int vl = find(x,y,2*k+1,l,(l+r)/2);

		int vr = find(x,y,2*k+2,(l+r)/2,r);

		return vl+vr;

	}

}



int main(){

	int N,q,command,x,y;

	

	cin >> N >> q;

	init(N);

	

	for (int i=0;i<q;i++){

		cin >> command >> x >> y;

		if(command){

			cout << find(x-1,y,0,0,n) << endl;

		}else{

			add(x-1,y);

		}

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.8628453557523972x):
#include<iostream>

#include<fstream>

#include<cstdio>

#include<string>

#include<algorithm>

#include<cmath>

#include<vector>

#include<stack>

#include<climits>

#include<cstring>

#include<queue>

#include<map>

#include<set>

#include<complex>

using namespace std;



const int MAX_N = 100000;



struct BIT{

    int bit[MAX_N + 1];

    int n;



    BIT(const int n): n(n){

        for (int i=0;i<MAX_N;i++) bit[i] = 0;

    }



    void printBIT(){

        for (int i=0;i<n;i++){

            cout << bit[i] << " ";

        }

        cout << endl;

    }



    int sum(int i){

        int S = 0;

        while(i > 0){

            S += bit[i];

            i -= i & -i;

        }

        return S;

    }



    void add(int i, int x){

        while(i <= n){

            bit[i] += x;

            i += i & -i;

        }

    }



};



int main(){

    int n, q;

    cin >> n >> q;

    BIT bit(n);

    int c, x, y;

    for (int i=0;i<q;i++){

        cin >> c >> x >> y ;

        if(c == 0){

            bit.add(x, y);

        }else{

            cout << bit.sum(y) - bit.sum(x-1) << endl;

        }

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



struct segtree {

  int id; // identity element

  vector<int> node;

  function<int(int, int)> f;

  static const int N = 1 << 18;



  segtree(int id, function<int(int, int)> f) : id(id), f(f), node(2 * N, id){}



  void init(vector<int> &v) {

    for (int i = 0; i < v.size(); ++i) {

      node[i + N - 1] = v[i];

    }

    for (int i = N - 2; i >= 0; --i) {

      node[i] = f(node[2 * i + 1], node[2 * i + 2]);

    }

  }



  int find(int a, int b, int k, int l, int r) {

    if (r <= a || b <= l) return id;

    if (a <= l && r <= b) return node[k];

    return f(

      find(a, b, 2 * k + 1, l, (l + r) / 2),

      find(a, b, 2 * k + 2, (l + r) / 2, r)

    );

  }



  int find(int a, int b) {

    return find(a, b, 0, 0, N);

  }



  void update(int k, int x) {

    k += N - 1;

    node[k] = x;

    while (k) {

      k = (k - 1) / 2;

      node[k] = f(node[2 * k + 1], node[2 * k + 2]);

    }

  }



  void add(int k, int x) {

    k += N - 1;

    node[k] += x;

    while (k) {

      k = (k - 1) / 2;

      node[k] = f(node[2 * k + 1], node[2 * k + 2]);

    }

  }

};



int main() {

  int n, q;

  cin >> n >> q;



  segtree seg(0, [&](int a, int b) { return a + b; } );

  while (q--) {

    int f, a, b;

    cin >> f >> a >> b;



    if (f) cout << seg.find(a, b + 1) << endl;

    else seg.add(a, b);

  }

}

// Faster C++ solution for the same problem (measured speedup: 3.118128326615363x):
#include <bits/stdc++.h>

using namespace std;



struct BinaryIndexedTree {

  BinaryIndexedTree() {}

  BinaryIndexedTree(int n) : n(n), v(n + 1, 0) {}



  vector<int> v;

  int n;



  int sum(int i) {

    int ret = 0;

    while (i) {

      ret += v[i];

      i -= i & -i;

    }

    return ret;

  }



  void add(int i, int x) {

    while (i <= n) {

      v[i] += x;

      i += i & -i;

    }

  }

};



int main() {

  int n, q;

  cin >> n >> q;



  BinaryIndexedTree bit(n);

  while (q--) {

    int c, x, y;

    cin >> c >> x >> y;

    if (c) {

      cout << bit.sum(y) - bit.sum(x - 1) << endl;

    } else {

      bit.add(x, y);

    }

  }

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



struct segtree {

  int id; // identity element

  vector<int> node;

  function<int(int, int)> f;

  static const int N = 1 << 18;



  segtree(int id, function<int(int, int)> f) : id(id), f(f), node(2 * N, id){}



  void init(vector<int> &v) {

    for (int i = 0; i < v.size(); ++i) {

      node[i + N - 1] = v[i];

    }

    for (int i = N - 2; i >= 0; --i) {

      node[i] = f(node[2 * i + 1], node[2 * i + 2]);

    }

  }



  int find(int a, int b, int k, int l, int r) {

    if (r <= a || b <= l) return id;

    if (a <= l && r <= b) return node[k];

    return f(

      find(a, b, 2 * k + 1, l, (l + r) / 2),

      find(a, b, 2 * k + 2, (l + r) / 2, r)

    );

  }



  int find(int a, int b) {

    return find(a, b, 0, 0, N);

  }



  void update(int k, int x) {

    k += N - 1;

    node[k] = x;

    while (k) {

      k = (k - 1) / 2;

      node[k] = f(node[2 * k + 1], node[2 * k + 2]);

    }

  }



  void add(int k, int x) {

    k += N - 1;

    node[k] += x;

    while (k) {

      k = (k - 1) / 2;

      node[k] = f(node[2 * k + 1], node[2 * k + 2]);

    }

  }

};



int main() {

  int n, q;

  cin >> n >> q;



  segtree seg(0, [&](int a, int b) { return a + b; } );

  while (q--) {

    int f, a, b;

    cin >> f >> a >> b;



    if (f) cout << seg.find(a, b + 1) << endl;

    else seg.add(a, b);

  }

}

// Faster C++ solution for the same problem (measured speedup: 3.118128326615363x):
#include <bits/stdc++.h>

using namespace std;



struct BinaryIndexedTree {

  BinaryIndexedTree(int n) : n(n), v(n + 1, 0) {}



  int n;

  vector<int> v;



  int sum(int k) {

    int ret = 0;

    for (; k; k -= k & -k) ret += v[k];

    return ret;

  }



  void add(int k, int x) {

    for (; k <= n; k += k & -k) v[k] += x;

  }

};



int main() {

  int n, q;

  cin >> n >> q;



  BinaryIndexedTree bit(n);

  while (q--) {

    int c, x, y;

    cin >> c >> x >> y;

    if (c) {

      cout << bit.sum(y) - bit.sum(x - 1) << endl;

    } else {

      bit.add(x, y);

    }

  }

}
// Slower C++ solution:
#ifndef ___Class_RMQ

#define ___Class_RMQ



#include <vector>

#include <algorithm>



template <typename Type, class Calculate> class RMQ

{

private:



	int size;



	std::vector<Type> value;



	Type _query(int a, int b, int k, int l, int r)

	{

		if (r <= a || b <= l) { return val; }

		if (a <= l && r <= b) { return value[k]; }



		Type vl = _query(a, b, 2 * k, l, (l + r) / 2);

		Type vr = _query(a, b, 2 * k + 1, (l + r) / 2, r);



		return Calculate()(vl, vr);

	}



public:



	Type val;



	RMQ(int size_, int val_) : val(val_)

	{

		for (size = 1; size < size_;) { size <<= 1; }



		value = std::vector<Type>(size * 2, val);

	}



	void update(int i, const Type& x)

	{

		i += size; value[i] += x;



		while (i > 1) { i = i / 2; value[i] = Calculate()(value[2 * i], value[2 * i + 1]); }

	}



	Type query(int s, int t) { return _query(s, t, 1, 0, size); }

};



#endif





// ------ main ------ //



#include <cstdio>

#include <functional>



#pragma warning(disable: 4996)



int n, q, com, x, y;



int main()

{

	scanf("%d", &n);

	scanf("%d", &q);



	RMQ<long long, std::plus<long long> > r(n, 0);



	for (int i = 0; i < q; i++)

	{

		scanf("%d", &com);

		scanf("%d", &x);

		scanf("%d", &y);



		if (com == 0)

		{

			r.update(x - 1, y);

		}

		if (com == 1)

		{

			printf("%lld\n", r.query(x - 1, y));

		}

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.808293804526118x):
#include <stdio.h>



int n, q, com, x, y, bit[131073];



void add(int i, int x)

{

    while(i <= n)

    {

        bit[i] += x;

        

        i += i & -i;

    }

}



int sum(int i)

{

    int ret = 0;

    

    while(i > 0)

    {

        ret += bit[i];

        

        i -= i & -i;

    }

    

    return ret;

}



int main()

{

    scanf("%d", &n);

    scanf("%d", &q);

    

    for(int i = 0; i < q; i++)

    {

        scanf("%d", &com);

        scanf("%d", &x);

        scanf("%d", &y);

        

        if(com == 0)

        {

            add(x, y);

        }

        else

        {

            printf("%d\n", sum(y) - sum(x - 1));

        }

    }

    

    return 0;

}