## Team Rocket solution codechef

Table of Contents

Team Rocket is back with a challenge for Ash. They promise to set Pikachu free if he is able to solve the problem

There is a 2d plane which contains zero at every point.

Ash will be given NN operations Where each operation contains three space seperated integers XX YY VV which means

- Add VV coins at position (X,Y)(X,Y)
- And after that print the golden value of the position (X,Y)(X,Y)

Golden value at (X,Y)(X,Y) = (Sum of values at all points (a,b)(a,b) where a≥Xa≥X and b≥Yb≥Y) −− (Sum of all values at (a,b)(a,b) where a<Xa<X and b<Yb<Y)

Help Ash and be let Pikachu be free

### Input:Team Rocket solution codechef

- First line will contain TT, number of testcases. Then input for TT testcases follow.
- First line of each test case is a single integer NN
- Next NN lines contain three space seperated Integers XX YY VV which represent a operation

### Output: Team Rocket solution codechef

- Print output for each operation in a new line

### Constraints Team Rocket solution codechef

- 1≤T≤101≤T≤10
- 1≤N≤1051≤N≤105
- Sum of all values of N≤105N≤105
- −5∗105≤X≤5∗105−5∗105≤X≤5∗105
- −5∗105≤Y≤5∗105−5∗105≤Y≤5∗105
- 1≤V≤1051≤V≤105

### Sample Input: Team Rocket solution codechef

```
1
6
3 4 2
2 5 6
2 -3 8
1 3 3
-4 1 7
2 2 5
```

### Sample Output:

```
2
6
16
11
18
6
```

### EXPLANATION:

We have one test case and it have 6 queries. we want to answer one by one let us assume you got first five. look at the 6th case 2 2 5

initially value at (2,2) is 0 add 5 to it

Now we have three values 2 5 and 6 which are at (3,4),(2,5),(2,2) whose x-coordinate>=2 and y-coordingate>=2

And we have only one value 7 which is at (-4,1) whose x-coordinate<2 and y-coordinate<2

So our answer is 2+5+6-7=6

# SOLUTION

# Click here

Codechef is an platform built to programmers compete against others in the community and to improve their knowledge by facing various challenges. Challenges are categorised on the basis of their difficulty level , if your rating is above 2000 you are in top tier i.e, Division 3 and if your rating is between 2000 and 1600 you will be in tier 2 i.e, Division 3 and if your rating is below that you will be in lowest tier i.e, Division 3. You can improve your rating by successful submission with minimum penalty.

- Game of Primes solution codechef
- Books and Friends solution codechef
- Run It Back solution codechef
- Buy Masks solution codechef
- How I Met Your Mother solution codechef

Also Read : Neenade Naa song lyrics with English Translation