#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; template bool ord(T &x, T & y){ return x.second < y.second; } int main(){ int N, M, now=0, ans=0; cin >> N >> M; vector> AB(M); for (int i=0; i> AB[i].first >> AB[i].second; sort(AB.begin(), AB.end(), ord>); for (int i=0; i