1 #include <iostream>
2 #include <cstring>
3 #include <string>
4 #include <cstdio>
5 #include <cstdlib>
6 #include <cmath>
7 #include <algorithm>
8 #include <queue>
9 #include <stack>
10 #include <map>
11 #include <set>
12 #include <list>
13 #include <vector>
14 #include <ctime>
15 #include <functional>
16 #define pritnf printf
17 #define scafn scanf
18 #define sacnf scanf
19 #define For(i,j,k) for(int i=(j);i<=(k);(i)++)
20 #define Clear(a) memset(a,0,sizeof(a))
21 using namespace std;
22 typedef unsigned int Uint;
23 const int INF=0x3fffffff;
24 const double eps=1e-10;
25 ///==============struct declaration==============
26 struct Seg_Node{
27 int ed,length;
28 };
29 ///==============var declaration=================
30 const int MAXN=100010;
31 int n,L,R,m;
32 long double Building[MAXN];
33 Seg_Node Seg_Tree[MAXN*5],Ans;
34 ///==============function declaration============
35 void BuildTree(int o,int l,int r);
36 void Update(int o,int l,int r);
37 void Query(int o,int l,int r);
38 int Query(int o,int l,int r,double height);
39 void Modify(int o,int l,int r,int k,double h);
40 bool Equal(double a,double b){return fabs(a-b)<=1e-13;}
41 ///==============main code=======================
42 int main()
43 {
44 #define FILE__
45 #ifdef FILE__
46 freopen("input","r",stdin);
47 freopen("output","w",stdout);
48 #endif
49 scanf("%d%d",&n,&m);
50 BuildTree(1,1,n);
51 Building[0]=-10;
52 while (m--){
53 int X,Y;scanf("%d%d",&X,&Y);
54 Modify(1,1,n,X,double(Y)/X);
55 L=1,R=n;
56 printf("%d\n",Seg_Tree[1].length);
57 }
58 return 0;
59 }
60 ///================fuction code====================
61 void BuildTree(int o,int l,int r){
62 int m=(l+r)>>1,lc=o*2,rc=o*2+1;
63 if (l==r){
64 Seg_Tree[o].ed=l;
65 Seg_Tree[o].length=0;
66 return ;
67 }
68 BuildTree(lc,l,m);
69 BuildTree(rc,m+1,r);
70 Update(o,l,r);
71 }
72 void Update(int o,int l,int r){
73 int m=(l+r)>>1,lc=o*2,rc=o*2+1;
74 if (Seg_Tree[rc].length==0||Building[Seg_Tree[lc].ed]>=Building[Seg_Tree[rc].ed])
75 Seg_Tree[o]=Seg_Tree[lc];
76 else if (Seg_Tree[lc].length==0)
77 Seg_Tree[o]=Seg_Tree[rc];
78 else{
79 int Rank=Query(rc,m+1,r,Building[Seg_Tree[lc].ed]);
80 Seg_Tree[o].ed=Seg_Tree[rc].ed;
81 Seg_Tree[o].length=Seg_Tree[lc].length+Seg_Tree[rc].length-Rank;
82 }
83 }
84 int Query(int o,int l,int r,double height){///Return how many numbers Less than or equal to height
85 int m=(l+r)>>1,lc=o*2,rc=o*2+1;
86 if (height>=Building[Seg_Tree[o].ed]) return Seg_Tree[o].length;
87 if (height<Building[l]) return 0;
88 if (height<Building[Seg_Tree[lc].ed]) return Query(lc,l,m,height);
89 return Seg_Tree[lc].length+Query(rc,m+1,r,height)-(Seg_Tree[lc].length+Seg_Tree[rc].length-Seg_Tree[o].length);
90 }
91 void Modify(int o,int l,int r,int k,double h){
92 int m=(l+r)>>1,lc=o*2,rc=o*2+1;
93 if (l==r){
94 Building[l]=h;
95 if (!Equal(h,0))
96 Seg_Tree[o].length=1;
97 else
98 Seg_Tree[o].length=0;
99 }
100 else{
101 if (m>=k) Modify(lc,l,m,k,h);
102 else Modify(rc,m+1,r,k,h);
103 Update(o,l,r);
104 }
105 }