明明是线段树的水题吖…我居然还wa了三次
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define db double
#define ll long long
#define rep(i,x,y) for(ll i=(x);i<=(y);i++)
#define repl(i,x,y) for(ll i=(x);i<(y);i++)
#define repd(i,x,y) for(ll i=(x);i>=(y);i--)
using namespace std;
const ll N=1e5+5;
ll n,m,pos;db val;
struct node {
ll ans;
db slope;
}tree[N<<3];
inline ll read() {
ll x=0;char ch=getchar();bool f=0;
while(ch>'9'||ch<'0'){if(ch=='-')f=1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
return f?-x:x;
}
#define lson (p<<1)
#define rson (p<<1|1)
#define mid (x+y>>1)
ll calc(ll p,ll x,ll y,db slope) {
if(x==y) return tree[p].slope>slope;
if(tree[lson].slope<=slope) return calc(rson,mid+1,y,slope);
return calc(lson,x,mid,slope)+tree[p].ans-tree[lson].ans;
}
void update(ll p,ll x,ll y) {
if(x==y) {
tree[p].ans=1;
tree[p].slope=val;return ;
}
if(pos<=mid) update(lson,x,mid);
else update(rson,mid+1,y);
tree[p].slope=max(tree[lson].slope,tree[rson].slope);
tree[p].ans=tree[lson].ans+calc(rson,mid+1,y,tree[lson].slope);
}
int main() {
n=read(),m=read();
rep(i,1,m) {
ll x=read(),y=read();pos=x;val=(db)y/x;
update(1,1,n);printf("%lld\n",tree[1].ans);
}
return 0;
}