Advertisement
Ankit_132

A

Apr 21st, 2024
606
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5.     int t;
  6.     cin>>t;
  7.    
  8.     while(t--){
  9.         int n;
  10.         cin>>n;
  11.        
  12.         vector<int> a(n);
  13.         for(auto &e: a)
  14.             cin>>e;
  15.            
  16.         map<int, int> cnt;
  17.         for(auto e: a)      cnt[e]++;
  18.        
  19.         int ans = 0;
  20.        
  21.         for(auto [x, y]: cnt)     ans += y/3;
  22.        
  23.         cout<<ans<<"\n";
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement