CF896E Welcome home, Chtholly
Description
— I... I survived.
— Welcome home, Chtholly.
— I kept my promise...
— I made it... I really made it!
After several days of fighting, Chtholly Nota Seniorious miraculously returned from the fierce battle.
As promised, Willem is now baking butter cake for her.
However, although Willem is skilled in making dessert, he rarely bakes butter cake.
This time, Willem made a big mistake — he accidentally broke the oven!
Fortunately, Chtholly decided to help him.
Willem puts $ n $ cakes on a roll, cakes are numbered from $ 1 $ to $ n $ , the $ i $ -th cake needs $ a_{i} $ seconds of baking.
Willem needs Chtholly to do $ m $ operations to bake the cakes.
Operation 1: $ 1\ l\ r\ x $
Willem asks Chtholly to check each cake in the range $ [l,r] $ , if the cake needs to be baked for more than $ x $ seconds, he would bake it for $ x $ seconds and put it back in its place. More precisely, for every $ i $ in range $ [l,r] $ , if $ a_{i} $ is strictly more than $ x $ , $ a_{i} $ becomes equal $ a_{i}-x $ .
Operation 2: $ 2\ l\ r\ x $
Willem asks Chtholly to count the number of cakes in the range $ [l,r] $ that needs to be cooked for exactly $ x $ seconds. More formally you should find number of such $ i $ in range $ [l,r] $ , that $ a_{i}=x $ .
Input Format
N/A
Output Format
N/A