1 program rrr(input,output);
2 type
3 treetype=record
4 l,r,s:longint;
5 max:double;
6 end;
7 var
8 a:array[0..400040]of treetype;
9 n,m,i,x,y:longint;
10 function max(a,b:double):double;
11 begin
12 if a>b then exit(a) else exit(b);
13 end;
14 procedure build(k,l,r:longint);
15 var
16 mid:longint;
17 begin
18 a[k].l:=l;a[k].r:=r;a[k].max:=0;a[k].s:=0;
19 if l=r then exit;
20 mid:=(l+r)>>1;
21 build(k+k,l,mid);build(k+k+1,mid+1,r);
22 end;
23 function count(k:longint;x:double):longint;
24 var
25 i:longint;
26 begin
27 if a[k].l=a[k].r then begin if a[k].max>x then exit(1) else exit(0); end;
28 i:=k+k;
29 if a[i].max>x then exit(a[k].s-a[i].s+count(i,x))
30 else exit(count(i+1,x));
31 end;
32 procedure change(k,x:longint;y:double);
33 var
34 mid,i:longint;
35 begin
36 if a[k].l=a[k].r then begin a[k].s:=1;a[k].max:=y;exit; end;
37 mid:=(a[k].l+a[k].r)>>1;i:=k+k;
38 if x<=mid then change(i,x,y) else change(i+1,x,y);
39 a[k].max:=max(a[i].max,a[i+1].max);
40 a[k].s:=a[i].s+count(i+1,a[i].max);
41 end;
42 begin
43 assign(input,‘r.in‘);assign(output,‘r.out‘);reset(input);rewrite(output);
44 readln(n,m);
45 build(1,1,n);
46 for i:=1 to m do
47 begin
48 readln(x,y);
49 change(1,x,y/x);
50 writeln(a[1].s);
51 end;
52 close(input);close(output);
53 end.