For this Question: Given a binary tree of N nodes with root 1. Initially all nodes have value 0.
You have two type of queries
1 u x  - add x to all nodes in subtree of  node u
2 u - print the value of node uFirst line contains the integer N and Q, denoting the number of nodes in the binary tree and the number of queries respectively.
Next N lines contains two integers denoting the left and right child of the i'th node respectively. 
If the node doesn't have a left or right child, it is denoted by '-1'
Next Q lines contains queries of two types:
1 u x 
2 x
1 <= N, Q <= 5000
1 <= u <= N
1 <= x <= 5000For each query of type 2 print a single line containing the answerSample Input 1:
9 5
2 4
5 3
6 -1
-1 7
-1 -1
-1 -1
9 8
-1 -1
-1 -1
1 2 5
1 1 3
2 7
1 4 2
2 6
Sample output 1:
3
8

Explanation: Given binary tree 
                1
               /  \
             2     4
            / \     \
          5    3    7
                /    / \
              6     9  8 
Query 1: add all nodes in subtree of 2 with 5
Query 2: add all nodes in subtree of 1 with 3
Query 3: value of node 7 is 3 now
Query 4: add all nodes in subtree of 4 with 2
Query 5: value of node 6 is 8 now, I have written this Solution Code: #include "bits/stdc++.h"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int l[N], r[N], d[N];

void dfs(int u, int x){
	if(u == -1)	return;
	d[u] += x;
	dfs(l[u], x);
	dfs(r[u], x);
}

void solve(){
	int n, q;	cin >> n >> q;
	for(int i = 1; i <= n; i++)
		cin >> l[i] >> r[i];
	while(q--){
		int t, x, y;
		cin >> t;
		if(t == 1){
			cin >> x >> y;
			dfs(x, y);
		}
		else{
			cin >> x;
			cout << d[x] << endl;
		}
	}
}

signed main() {
	IOS;
		clock_t start = clock();
	
	int Test = 1;	
	// cin >> Test;
	for(int tt = 0; tt < Test; tt++){


		solve();
	}

	cerr << (double)(clock() - start)*1000/CLOCKS_PER_SEC << " ms" << endl;
	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?