Code snippet for C++ programming

code snippet for C++ programming

Prompt

#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t; cin >> t; while (t--){ long long n; cin >> n; map<long long,long long> tb; for (int i = 0; i < n; ++i){ long long x; cin >> x; tb[x]++; } vector<long long> skills; for (auto &p : tb){ skills.push_back(p.second); } sort(skills.begin(),skills.end()); long long l = -1; long long r = n; while (l < r - 1){ long long m = (l + r)/2; bool ok = true; auto it =