Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int n;
cin >> n;
set s;
int i=1;
s.insert(n);
while(1) {
  if(n%2==0) {
    n /= 2;
  } else {
    n = 3*n+1;
  }
  i++;
  s.insert(n);
  if(s.size()!=i) break;
}
cout << i << endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: class template argument deduction failed:
   15 | set s;
      |     ^
a.cc:15:5: error: no matching function for call to 'set()'
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 _Key, class _Compare, class _Alloc, class _InputIterator> set(_InputIterator, _InputIterator, const _Alloc&)-> std::set<_Key, _Compare, _Alloc>'
  273 |         set(_InputIterator __first, _InputIterator __last,
      |         ^~~
/usr/include/c++/14/bits/stl_set.h:273:9: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:267:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(std::initializer_list<_Tp>, const _Alloc&)-> std::set<_Key, _Compare, _Alloc>'
  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, 0 provided
/usr/include/c++/14/bits/stl_set.h:261:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(std::set<_Key, _Compare, _Allocator>&&, std::__type_identity_t<_Alloc>&)-> std::set<_Key, _Compare, _Alloc>'
  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, 0 provided
/usr/include/c++/14/bits/stl_set.h:257:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(const std::set<_Key, _Compare, _Allocator>&, std::__type_identity_t<_Alloc>&)-> std::set<_Key, _Compare, _Alloc>'
  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, 0 provided
/usr/include/c++/14/bits/stl_set.h:253:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(const _Alloc&)-> std::set<_Key, _Compare, _Alloc>'
  253 |       set(const allocator_type& __a)
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:253:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:245:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(std::initializer_list<_Tp>, const _Compare&, const _Alloc&)-> std::set<_Key, _Compare, _Alloc>'
  245 |       set(initializer_list<value_type> __l,
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:245:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:233:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(std::set<_Key, _Compare, _Allocator>&&)-> std::set<_Key, _Compare, _Alloc>'
  233 |       set(set&&) = default;
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:233:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:225:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(const std::set<_Key, _Compare, _Allocator>&)-> std::set<_Key, _Compare, _Alloc>'
  225 |       set(const set&) = default;
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:225:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:210:9: note: candidate: 'template<class _Key, class _Compare, class _Alloc, class _InputIterator> set(_InputIterator, _InputIterator, const _Compare&, const _Alloc&)-> std::set<_Key, _Compare, _Alloc>'
  210 |         set(_InputIterator __first, _InputIterator __last,
      |         ^~~
/usr/include/c++/14/bits/stl_set.h:210:9: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:193:9: note: candidate: 'template<class _Key, class _Compare, class _Alloc, class _InputIterator> set(_InputIterator, _InputIterator)-> std::set<_Key, _Compare, _Alloc>'
  193 |         set(_InputIterator __first, _InputIterator __last)
      |         ^~~
/usr/include/c++/14/bits/stl_set.h:193:9: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:178:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(const _Compare&, const _Alloc&)-> std::set<_Key, _Compare, _Alloc>'
  178 |       set(const _Compare& __comp,
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:178:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:169:7: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set()-> std::set<_Key, _Compare, _Alloc>'
  169 |       set() = default;
      |       ^~~
/usr/include/c++/14/bits/stl_set.h:169:7: note:   template argument deduction/substitution failed:
a.cc:15:5: note:   couldn't deduce template parameter '_Key'
   15 | set s;
      |     ^
/usr/include/c++/14/bits/stl_set.h:96:11: note: candidate: 'template<class _Key, class _Compare, class _Alloc> set(std::set<_Key, _Compare, _Alloc>)-> std::set<_Key, _Compare, _Alloc>'
   96 |     class set
      |           ^~~
/usr/include/c++/14/bits/stl_set.h:96:11: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:970:5: note: candidate: 'template<class _Key, class _Allocator, class> std::set(initializer_list<_Tp>, _Allocator)-> set<_Key, less<_Key>, _Allocator>'
  970 |     set(initializer_list<_Key>, _Allocator)
      |     ^~~
/usr/include/c++/14/bits/stl_set.h:970:5: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:963:5: note: candidate: 'template<class _InputIterator, class _Allocator, class, class> std::set(_InputIterator, _InputIterator, _Allocator)-> set<typename iterator_traits<_Iter>::value_type, less<typename iterator_traits< <template-parameter-1-1> >::value_type>, _Allocator>'
  963 |     set(_InputIterator, _InputIterator, _Allocator)
      |     ^~~
/usr/include/c++/14/bits/stl_set.h:963:5: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_set.h:956:5: note: candidate: 'template<class _Key, class _Compare, class _Allocator, class, class> std::set(initializer_list<_Tp>, _Compare, _Allocator)-> set<_Key, _Compare, _Allocator>'
  956 |     set(initializer_list<_Key>,
      |     ^~~
/usr/include/c++/14/bits/stl_set.h:956:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_set.h:947:5: note: candidate: 'template<class _InputIterator, class _Compare, class _Allocator, class, class, class> std::set(_InputIterator, _InputIterator, _Compare, _Allocator)-> set<typename iterator_traits<_Iter>::value_type, _Compare, _Allocator>'
  947 |     set(_InputIterator, _InputIterator,
      |     ^~~
/usr/include/c++/14/bits/stl_set.h:947:5: note:   candidate expects 2 arguments, 0 provided