#include<iostream>#include<algorithm>using namespace std;typedef long long ll;struct q { ll id; ll num; ll col;}p[100010];bool cmp(q x, q y) { if (x.col < y.col)return 0; else if (x.col == y.col)return x.id < y.id; return 1;}ll n, m, ans = 0;bool f[100010];int main() { std::cin >...