Advertisement
Ankit_132

B

Apr 13th, 2024
932
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll     long long
  5. #define _test   int _TEST; cin>>_TEST; while(_TEST--)
  6. #define ff     first
  7. #define ss     second
  8. #define pb     push_back
  9.  
  10. int main()
  11. {
  12.     _test
  13.     {
  14.         int n;
  15.         cin >> n;
  16.         map <int, int> cnt;
  17.         for(int i = 0; i < n; i++) {
  18.           int x;
  19.           cin >> x;
  20.           cnt[x] += 1;
  21.         }
  22.         int ans = 0;
  23.         for(auto [x, freq] : cnt) {
  24.           if(freq > 1) {
  25.             ++ans;
  26.           }
  27.         }
  28.         cout << ans << endl;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement