Language: C++

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

int main() {
  int N, M;
  cin >> N >> M;
  
  set<int> answers(M);
  
  for (int i = 0; i < N; i++) {
    int K;
    cin >> K;
    
    set<int> A(K);

    for (int j = 0; j < K; j++) {
      int a;
      cin >> a;
      
      A.insert(a);
    }
    
    if (i == 0) {
      answers = A;
    } else {
      set_intersection(answers.begin(), answers.end(),
                       A.begin(), A.end(),
                       inserter(answers, answers.end()));
    }
  }
  
  cout << answers.size() << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:21: error: no matching function for call to 'std::set<int>::set(int&)'
    8 |   set<int> answers(M);
      |                     ^
In file included from /usr/include/c++/14/set:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_set.h:273:9: note: candidate: 'template<class _InputIterator> std::set<_Key, _Compare, _Alloc>::set(_InputIterator, _InputIterator, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  273 |         set(_InputIterator __first, _InputIterator __last,
      |         ^~~
/usr/include/c++/14/bits/stl_set.h:273:9: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:210:9: note: candidate: 'template<class _InputIterator> std::set<_Key, _Compare, _Alloc>::set(_InputIterator, _InputIterator, const _Compare&, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  210 |         set(_InputIterator __first, _InputIterator __last,
      |         ^~~
/usr/include/c++/14/bits/stl_set.h:210:9: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:193:9: note: candidate: 'template<class _InputIterator> std::set<_Key, _Compare, _Alloc>::set(_InputIterator, _InputIterator) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  193 |         set(_InputIterator __first, _InputIterator __last)
      |         ^~~
/usr/include/c++/14/bits/stl_set.h:193:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:267:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(std::initializer_list<_Tp>, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]'
  267 |       set(initializer_list<value_type> __l, const allocator_type& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:267:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:261:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(std::set<_Key, _Compare, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::__type_identity_t<_Alloc> = std::allocator<int>]'
  261 |       set(set&& __x, const __type_identity_t<allocator_type>& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:261:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:257:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(const std::set<_Key, _Compare, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::__type_identity_t<_Alloc> = std::allocator<int>]'
  257 |       set(const set& __x, const __type_identity_t<allocator_type>& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:257:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:253:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]'
  253 |       set(const allocator_type& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:253:33: note:   no known conversion for argument 1 from 'int' to 'const std::set<int>::allocator_type&' {aka 'const std::allocator<int>&'}
  253 |       set(const allocator_type& __a)
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_set.h:245:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(std::initializer_list<_Tp>, const _Compare&, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]'
  245 |       set(initializer_list<value_type> __l,
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:245:40: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
  245 |       set(initializer_list<value_type> __l,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_set.h:233:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(std::set<_Key, _Compare, _Alloc>&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  233 |       set(set&&) = default;
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:233:11: note:   no known conversion for argument 1 from 'int' to 'std::set<int>&&'
  233 |       set(set&&) = default;
      |           ^~~~~
/usr/include/c++/14/bits/stl_set.h:225:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(const std::set<_Key, _Compare, _Alloc>&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  225 |       set(const set&) = default;
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:225:11: note:   no known conversion for argument 1 from 'int' to 'const std::set<int>&'
  225 |       set(const set&) = default;
      |           ^~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:178:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(const _Compare&, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]'
  178 |       set(const _Compare& __comp,
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:178:27: note:   no known conversion for argument 1 from 'int' to 'const std::less<int>&'
  178 |       set(const _Compare& __comp,
      |           ~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_set.h:169:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set() [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  169 |       set() = default;
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:169:7: note:   candidate expects 0 arguments, 1 provided
a.cc:14:17: error: no matching function for call to 'std::set<int>::set(int&)'
   14 |     set<int> A(K);
      |                 ^
/usr/include/c++/14/bits/stl_set.h:273:9: note: candidate: 'template<class _InputIterator> std::set<_Key, _Compare, _Alloc>::set(_InputIterator, _InputIterator, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  273 |         set(_InputIterator __first, _InputIterator __last,
      |         ^~~
/usr/include/c++/14/bits/stl_set.h:273:9: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:210:9: note: candidate: 'template<class _InputIterator> std::set<_Key, _Compare, _Alloc>::set(_InputIterator, _InputIterator, const _Compare&, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  210 |         set(_InputIterator __first, _InputIterator __last,
      |         ^~~
/usr/include/c++/14/bits/stl_set.h:210:9: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:193:9: note: candidate: 'template<class _InputIterator> std::set<_Key, _Compare, _Alloc>::set(_InputIterator, _InputIterator) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  193 |         set(_InputIterator __first, _InputIterator __last)
      |         ^~~
/usr/include/c++/14/bits/stl_set.h:193:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:267:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(std::initializer_list<_Tp>, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]'
  267 |       set(initializer_list<value_type> __l, const allocator_type& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:267:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:261:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(std::set<_Key, _Compare, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::__type_identity_t<_Alloc> = std::allocator<int>]'
  261 |       set(set&& __x, const __type_identity_t<allocator_type>& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:261:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:257:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(const std::set<_Key, _Compare, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::__type_identity_t<_Alloc> = std::allocator<int>]'
  257 |       set(const set& __x, const __type_identity_t<allocator_type>& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:257:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:253:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]'
  253 |       set(const allocator_type& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:253:33: note:   no known conversion for argument 1 from 'int' to 'const std::set<int>::allocator_type&' {aka 'const std::allocator<int>&'}
  253 |       set(const allocator_type& __a)
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_set.h:245:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(std::initializer_list<_Tp>, const _Compare&, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]'
  245 |       set(initializer_list<value_type> __l,
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:245:40: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
  245 |       set(initializer_list<value_type> __l,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_set.h:233:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::set(std::set<_Key, _Compare, _Alloc>&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  233 |       set(set&&) = default;
      |       ^~~
/usr/includ