GIVEAWAY  Give Away
You are given a 1indexed array X, consisting of N integers, and a set of Q queries. There are two kinds of queries:
 0 a b c
Here you are required to return the number of elements with indices in [a,b]
greater than or equal to c  1 a b
Here you are required to change the a^{th} element of array to b.
Input Format:
First line contains N, the number of elements in the array X. The next line contains N space separated integers representing the elements of X. The third line of input contains a single integer, Q, the number of queries. The next Q lines of input each contain queries of two kinds as described above.
Output Format:
Q lines with the ith line contains the answer for the i^{th} query
Constraints:
1 ≤ N ≤ 5*10^5
1 ≤ Q ≤ 10^5
1 ≤ X[i] ≤ 10^9
1 ≤ a ≤ b ≤ N for query type 0
1 ≤ a ≤ 10^5, 1 < b ≤ 10^9 for query type 1
1 ≤ c ≤ 10^9
Example
Sample Input: 5 1 2 3 4 5 3 0 1 5 10 1 2 20 0 1 3 10 Sample Output: 0 1
Problem Setter: Pulkit Goel and Vidit Gupta
hide comments
pikku:
20141005 16:55:00
Even using Segment tree Getting TLE @ 10th test case.. 

Archit Jain:
20140718 21:46:30
TLE using segmented tree Last edit: 20140718 21:51:44 

Bhavik:
20140602 20:10:18
what ds to use?any suggestions... 

anurag garg:
20140509 15:13:04
nice.... 

Ryuzaki:
20140218 11:55:29
Will a TREAP won't work in this case ?? 
Added by:  darkshadows 
Date:  20140128 
Time limit:  1s2s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 