1 #include<cstdio>
2 #include<cstdlib>
3 #include<cstring>
4 #include<iostream>
5 #include<algorithm>
6 using namespace std;
7 #define Maxn 100010
8
9 double mymax(double x,double y) {return x>y?x:y;}
10
11 struct node
12 {
13 int l,r,lc,rc;
14 double mx;
15 int ans;
16 }tr[Maxn*2];
17 int len;
18
19 int build(int l,int r)
20 {
21 int x=++len;
22 tr[x].l=l;tr[x].r=r;tr[x].mx=0;tr[x].ans=0;
23 if(l!=r)
24 {
25 int mid=(l+r)>>1;
26 tr[x].lc=build(l,mid);
27 tr[x].rc=build(mid+1,r);
28 }
29 else tr[x].lc=tr[x].rc=0;
30 return x;
31 }
32
33 int query(int x,double mx)
34 {
35 if(tr[x].l==tr[x].r) return tr[x].mx>mx;
36 int mid=(tr[x].l+tr[x].r)>>1;
37 if(tr[tr[x].lc].mx<mx) return query(tr[x].rc,mx);
38 return tr[x].ans-tr[tr[x].lc].ans+query(tr[x].lc,mx);
39 }
40
41 void change(int x,int y,double z)
42 {
43 if(tr[x].l==tr[x].r)
44 {
45 tr[x].mx=z;
46 tr[x].ans=1;
47 return;
48 }
49 int mid=(tr[x].l+tr[x].r)>>1;
50 if(y<=mid) change(tr[x].lc,y,z);
51 else change(tr[x].rc,y,z);
52 tr[x].mx=mymax(tr[tr[x].lc].mx,tr[tr[x].rc].mx);
53 tr[x].ans=tr[tr[x].lc].ans+query(tr[x].rc,tr[tr[x].lc].mx);
54 }
55
56 int main()
57 {
58 int n,m;
59 scanf("%d%d",&n,&m);
60 build(1,n);
61 for(int i=1;i<=m;i++)
62 {
63 int x,y;
64 scanf("%d%d",&x,&y);
65 change(1,x,y*1.0/x);
66 printf("%d\n",tr[1].ans);
67 }
68 return 0;
69 }