1 #include <bits/stdc++.h>
2 #define Maxn 100007
3 using namespace std;
4 int read()
5 {
6 int x=0,f=1;char ch=getchar();
7 while (ch<‘0‘||ch>‘9‘){if (ch==‘-‘) f=-1;ch=getchar();}
8 while (ch>=‘0‘&&ch<=‘9‘){x=x*10+ch-‘0‘;ch=getchar();}
9 return x*f;
10 }
11 struct fraction
12 {
13 int dx,dy;
14 };
15 bool operator >(fraction a, fraction b)
16 {
17 return (1LL*a.dx*b.dy>1LL*a.dy*b.dx);
18 }
19 bool operator >=(fraction a, fraction b)
20 {
21 return (1LL*a.dx*b.dy>=1LL*a.dy*b.dx);
22 }
23 bool operator <(fraction a, fraction b)
24 {
25 return (1LL*a.dx*b.dy<1LL*a.dy*b.dx);
26 }
27 bool operator <=(fraction a, fraction b)
28 {
29 return (1LL*a.dx*b.dy<=1LL*a.dy*b.dx);
30 }
31 int n,m;
32 struct seg
33 {
34 int lx,rx,cnt;
35 fraction hmax;
36 };
37 seg tree[Maxn*4];
38 void build(int node, int l, int r)
39 {
40 tree[node].lx=l,tree[node].rx=r,tree[node].cnt=0;
41 tree[node].hmax=(fraction){0,1};
42 if (tree[node].lx==tree[node].rx) return;
43 int mid=(l+r)/2;
44 build(node*2,l,mid),build(node*2+1,mid+1,r);
45 }
46 int calc(int node, fraction h)
47 {
48 if (tree[node].hmax<=h) return 0;
49 if (tree[node].lx==tree[node].rx) return 1;
50 if (tree[node*2].hmax<=h) return calc(node*2+1,h);
51 else return tree[node].cnt-tree[node*2].cnt+calc(node*2,h);
52 }
53 void update(int node, int pos, fraction h)
54 {
55 if (tree[node].rx<pos) return;
56 if (tree[node].lx>pos) return;
57 if (tree[node].lx==tree[node].rx)
58 {
59 tree[node].hmax=h;
60 tree[node].cnt=1;
61 return;
62 }
63 update(node*2,pos,h),update(node*2+1,pos,h);
64 tree[node].hmax=max(tree[node*2].hmax,tree[node*2+1].hmax);
65 tree[node].cnt=tree[node*2].cnt+calc(node*2+1,tree[node*2].hmax);
66 }
67 int main()
68 {
69 n=read(),m=read();
70 build(1,1,n);
71 while (m--)
72 {
73 int x=read(),y=read();
74 update(1,x,(fraction){y,x});
75 printf("%d\n",tree[1].cnt);
76 }
77 return 0;
78 }