For this Question: Shivansh wants to give chapo to Arpit, but only if he is able to solve the following problem.
As you are a dear friend of Arpit, you decide to help Arpit solve the problem.
Given an array Arr of N numbers. You have to process Q queries on that array. Queries can be of following types :
> add x to index y
> given y compute sum of (Arr[i]*(y%i)) for i from 1 to N.First Line of input contains two space separated integers N and Q.
Second Line contains N space separated integers Arr[1] Arr[2] ..... Arr[N]
Next Q lines describe one query each and can be one of the two type:

>  1 i X - Add X to index i.
>  2 Y -  compute sum of (Arr[i]*(Y%i)) for i from 1 to N.

Constraints 
1 <= N,Q <= 100000
1 <= Arr[i], X, Y <= 100000
1 <= i <= NFor each second type query output one integer per line - answer for this query.Sample input 
4 3
3 2 3 4
1 2 1
2 10
2 12

Sample output 
11
0

Explaination 
after 1st query array : 3 3 3 4
for second query ans = (3*(10%1)) +(3*(10%2))+(3*(10%3)) +(4*(10%4)) = 11  
for third query ans = (3*(12%1)) +(3*(12%2))+(3*(12%3)) +(4*(12%4)) = 0      
, I have written this Solution Code: #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountll
#define m_p make_pair
#define infi 1e18+1
#define eps 0.000000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
//////////////
auto clk=clock();
#define all(x) x.begin(),x.end()
#define se second
#define fi first
#define sz(x) ((long long)x.size())
#define int long long  
#define f80 __float128
#define pii pair<int,int>
/////////////
int seg[300000];
int n=100001;
void up(int i, int value) {  
	int in=i;
  for (seg[in += n] += i*value; in > 1; in >>= 1) seg[in>>1] = seg[in] + seg[in^1];
}

int query(int l, int r) {
	++r;
  int res = 0;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l&1) res += seg[l++];
    if (r&1) res += seg[--r];
  }
  return res;
}


signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n;
	cin>>n;
	int q;
	cin>>q;
	int tot=0;
	for(int i=1;i<=n;++i)
	{
		int d;
		cin>>d;
		tot+=d;
		up(i,d);
	}
	while(q)
	{
		--q;
		char c;
		cin>>c;
		if(c=='1')
		{
			int i,x;
			cin>>i>>x;
			up(i,x);
			tot+=x;
		}
		if(c=='2')
		{
			int y;
			cin>>y;
			int total=tot*y;
			int consumed=0;
			int l=1,r=1;
			while(1)
			{
				consumed+=(y/l)*(query(l,r));
				if(r==y)
					break;
				l=r+1;
				r=y/(y/l);
			}
			cout<<total-consumed<<"\n";
		}
	}
	#ifdef ANIKET_GOYAL
		cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
	#endif
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?