Maximum possible size of subset following the given constraints – GeeksforGeeks
#include <bits/stdc++.h>using namespace std; bool is_possible(unordered_map<int, int>& mpp, int mid){ bool flag1 = false; bool flag2 = false; bool flag = false; for (auto it : mpp) { if (it.second >=…