### Statement

In a galaxy far, far away, there are two integer sequence a and b of length n.
b is a static permutation of 1 to n. Initially a is filled with zeroes.
There are two kind of operations:
1. add l r: add one for $a_l,a_{l+1}…a_r$
2. query l r: query $\sum_{i=l}^r \lfloor a_i / b_i \rfloor$

### Input

There are multiple test cases, please read till the end of input file.
For each test case, in the first line, two integers n,q, representing the length of a,b and the number of queries.
In the second line, n integers separated by spaces, representing permutation b.
In the following q lines, each line is either in the form ‘add l r’ or ‘query l r’, representing an operation.
$1≤n,q≤100000$, $1≤l≤r≤n$, there’re no more than 5 test cases.

### Code

#include
#define ls (p<<1)
#define rs (p<<1|1)
#define len (r-l+1)
#define mid ((l+r)>>1)
#define maxn 100100
using namespace std;
struct Node{
}tree[maxn<<2];
int n,m,b[maxn];
void pushup(int p){
tree[p].sum=tree[ls].sum+tree[rs].sum;
tree[p].maxa=max(tree[ls].maxa,tree[rs].maxa);
tree[p].minb=min(tree[ls].minb,tree[rs].minb);
}
void pushdown(int p){
}
void build(int l,int r,int p){
if (l==r){
tree[p].minb=b[l];
return;
}
build(l,mid,ls);
build(mid+1,r,rs);
pushup(p);
}
void update(int l,int r,int L,int R,int p){
if (l>R||r=L&&r<=R){
tree[p].maxa++;
if (tree[p].maxaR||r=L&&r<=R) return tree[p].sum;
return query(l,mid,L,R,ls)+query(mid+1,r,L,R,rs);
}
int main(){
ios::sync_with_stdio(false);
while(cin>>n>>m){
memset(tree,0,sizeof(tree));
for (int i=1;i<=n;i++)
cin>>b[i];
build(1,n,1);
while(m--){
string op;int x,y;
cin>>op>>x>>y;
else cout<
 
 Share Show Comments 【安利】我的音乐收藏 OneDrive 分享链接 易音论坛 缓慢更新中，更新方法是全专上传，尽量同时提供压缩包。 很久以前，我还是一个使用酷狗音乐的小屁孩。2013年我入手了最新一代的 iPod Shuffle，开始使用… 11 Oct 2018 【Quest OJ Emulate 9 / 19】Deep ♂ Dark ♂ Fantasy / 题解 比赛地址 Deep 题目描述 失败的燃烧军团想要逃回深渊，Khadgar 想要追击它们。 然而进入深渊的传送门只有一座，燃烧军团和 Khadgar 各有一些法力水晶，由 Khadgar… 20 Sep 2018 
 
 
 Topics Thought: 30 Study: 26 Selected: 26 Zepto's © 2022 Sponsor Data & privacy Contact → Published with Ghost • Theme Attila • System theme 
 $(document).ready(function () { var viewport =$(window); var post = $('.post-content'); // Responsive videos with fitVids post.fitVids(); // Format code blocks and add line numbers function codestyling() {$('pre code').each(function(i, e) { // Code highlight hljs.highlightBlock(e); // No lines for plain text blocks if (!$(this).hasClass('language-text')) { var code =$(this); // Calculate amount of lines var lines = code.html().split(/\n(?!$)/g).length; var numbers = []; if (lines > 1) { lines++; } for (i = 1; i < lines; i++) { numbers += '<span class="line" aria-hidden="true">' + i + '</span>'; } code.parent().append('<div class="lines">' + numbers + '</div>'); } }); } codestyling(); // Reading progress bar on window top function readingProgress() { var postBottom = post.offset().top + post.height(); var viewportHeight = viewport.height(); var progress = 100 - (((postBottom - (viewport.scrollTop() + viewportHeight) + viewportHeight / 3) / (postBottom - viewportHeight + viewportHeight / 3)) * 100);$('.progress-bar').css('width', progress + '%'); (progress > 100) ? $('.progress-container').addClass('complete'):$('.progress-container').removeClass('complete'); } readingProgress(); // Trigger reading progress viewport.on({ 'scroll': function() { readingProgress(); }, 'resize': function() { readingProgress(); }, 'orientationchange': function() { readingProgress(); } }); // Check if disqus is defined by code injection if (typeof disqus === 'undefined') { // hide comment section $('.post-comments').css({ 'display': 'none' }); } else {$('#show-disqus').on('click', function() { $.ajax({ type: "GET", url: "//" + disqus + ".disqus.com/embed.js", dataType: "script", cache: true });$(this).parent().addClass('activated'); }); } });