A dangerous Deal !

0

0 votes
Problem

Ryuzaki is very good in Maths and yeah he equally love chocolates alot. His father was really annoyed with his habit. So he decided to make a deal. If Ryuzaki is not able to solve the problem he'll quit eating chocolates forever, else his father will never ever ask him to stop eating chocolates.

PROBLEM STATEMENT

Ryuzaki is given N boxes of chocolates. There will be some queries. Basically of 2 type. 1. sum of chocolates from L to R boxes ( L and R inclusive) 2. eat all the chocolates and throw the ith box away. ( then N will reduce to N-1)
I am big fan of this guy, please help him friends :D

INPUT
First line contains T, number of test cases
next line contains N and Q, N-> number of boxes , Q number of queries.
Next N lines contains N integers greater than 0 representing number of chocolates in each box.
Q lines will follow
For type 1 query , 1 L R
1<=l<=r<=N
For type 2 query 2 X
1<=x<=N

OUTPUT
For each query of type 1, answer sum of chocolates

CONSTRAINTS
1<=T<=10^2
1<=N<=10^6
Number of chocolates will be less than 10^7 in each box.
1<=Q<=10^6

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?