Help me in solving LARGESTK problem

My issue

in example test case 2 , how can you say 3 is divisible by 2

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here

}

Problem Link: Largest K Practice Coding Problem

@ankitgoyal96
didn’t get your doubt .
in second test case the maximum value of k will be 3 which is divisible by the number of distinct number in the subsequence that is also 3.
plzz refer the following code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    int a[n];
	    unordered_map<int,int> mp;
	    vector<int> v;
	    
	    for(int i=0;i<n;i++)
	    {
	        cin>>a[i];
	        mp[a[i]]++;
	    }
	    
	    for(auto x:mp)
	    {
	        v.push_back(x.second);
	    }
	    
	    sort(v.begin(),v.end(),greater<int>());
	    int j=0,sm=0;
	    int ans=0;
	    for(int i=1;i<=mp.size();i++)
	    {
	        sm+=v[j];
	        int ch=sm%i;
	        ans=max(ans,sm-ch);
	        j++;
	    }
	    cout<<ans<<endl;
	}
	return 0;
}