Language: C++

#include<cstdio>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include<utility>
#include<tuple>
#include<bitset>
#include<complex>
// #include<ratio>
#include<algorithm>
#include<numeric>
// #include<limits>
// #include<chrono>
// #include<random>
// #include<regex>
// #include<functional>
// #include<boost/multiprecision/cpp_int.hpp>
// <iostream>
using std::cin;
using std::cout;
using std::clog;
using std::cerr;
// <ios>
using std::ios_base;
// <string>
using std::string;
using std::to_string;
using std::stoi;
using std::stol;
// <vector>
using std::vector;
// <map>
using std::map;
// <set>
using std::set;
// <queue>
using std::priority_queue;
using std::queue;
// <stack>
using std::stack;
// <deque>
using std::deque;
// <utility>
using std::pair;
// <tuple>
using std::tuple;
// <bitset>
using std::bitset;
// <complex>
using std::complex;
using std::real;
using std::imag;
using std::sin;
using std::cos;
using std::tan;
using std::asin;
using std::acos;
using std::atan;
using std::sinh;
using std::cosh;
using std::tanh;
using std::asinh;
using std::acosh;
using std::atanh;
using std::abs;
using std::pow;
using std::sqrt;
using std::exp;
using std::log;
using std::log10;
using std::polar;
using std::norm;
// <ratio>
// using std::ratio;
// <algorithm>
using std::all_of;
using std::any_of;
using std::none_of;
using std::find;
using std::count;
using std::swap;
using std::fill;
using std::unique;
using std::reverse;
using std::rotate;
using std::shuffle;
using std::sort;
using std::stable_sort;
using std::partial_sort;
using std::nth_element;
using std::lower_bound;
using std::upper_bound;
using std::equal_range;
using std::binary_search;
using std::set_union;
using std::set_intersection;
using std::set_difference;
using std::min;
using std::max;
using std::minmax; // value
using std::min_element;
using std::max_element;
using std::minmax_element; // pointer
using std::next_permutation;
using std::prev_permutation;
// <numeric>
using std::accumulate;
// <limits>
// using std::numeric_limits;
// <chrono>
// using std::chrono::system_clock;
// <random>
// using std::mt19937_64;
// <regex>
// using std::regex_match;
// <functional>
// using std::function;
// <boost/multiprecision/cpp_int.hpp>
// using boost::multiprecision::cpp_int;
using ll=long long;
using ld=long double;
using ull=unsigned long long;
// using vi=vector<int>;
// using vll=vector<ll>;
// using vs=vector<string>;
// using msi=map<string,int>;
// using si=set<int>;
// using ss=set<string>;
// using pii=pair<int,int>;
// using tiii=tuple<int,int,int>;
// using pqi=priority_queue<int>;
// using pqpii=priority_queue<pii>;
// using pqtiii=priority_queue<tiii>;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define rep(I,N) up(I,0,N-1)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define rs resize
#define np next_permutation
#define pp prev_permutation
#define rev reverse
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<"\n";}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<"\n";}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<"\n";}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<"\n";}
inline void                                              out(ld p){printf("%.12Lf\n",p);}
template<class T>inline void outml(T p){for_each(all(p),out<decltype(p[0])>);}//ml=multi line
template<class T>inline void outol(T V){auto n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}//ol=one line
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
int n,cnt;
template<class T>inline
vector<T> divisor(T n){
  vector<T>res;
  for(T i=1;i*i<=n;i++){
    if(n%i==0){
      res.push_back(i);
      if(i!=n/i)res.push_back(n/i);
    }
  }
  return res;
}
inline void solve(void){
  in(n);
  vector<int>a(n),b;
  ins(a);
  if(n==1&&a==1){
    out(1);
    return;
  }
  sort(all(a));
  if(a[0]!=a[1])b.pb(a[0]);
  up(i,1,n-2){
    if(a[i-1]!=a[i]&&a[i]!=a[i+1])b.pb(a[i]);
  }
  if(a[n-2]!=a[n-1])b.pb(a[n-1]);
  if(b.size()==0){
    out(0);
    return;
  }else{
    a=b;
  }
  rep(i,a.size()){
    auto d=divisor(a[i]);
    bool f=true;
    for(auto e:d){
      if(e==a[i])continue;
      if(std::binary_search(a.begin(),a.end(),e)){
        f=false;
        break;
      }
    }
    if(f)cnt++;
  }
  out(cnt);
}
int main(void){
  BEGIN;
  solve();
  END;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:189:13: error: no match for 'operator==' (operand types are 'std::vector<int>' and 'int')
  189 |   if(n==1&&a==1){
      |            ~^~~
      |            |  |
      |            |  int
      |            std::vector<int>
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33,
                 from /usr/include/c++/14/bits/allocator.h:46,
                 from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/new_allocator.h:215:9: note: candidate: 'template<class _Up> bool std::operator==(const __new_allocator<int>&, const __new_allocator<_Tp>&)'
  215 |         operator==(const __new_allocator&, const __new_allocator<_Up>&)
      |         ^~~~~~~~
/usr/include/c++/14/bits/new_allocator.h:215:9: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   mismatched types 'const std::__new_allocator<_Tp>' and 'int'
  189 |   if(n==1&&a==1){
      |               ^
In file included from /usr/include/c++/14/iosfwd:42,
                 from /usr/include/c++/14/ios:40:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
  192 |     operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'const std::fpos<_StateT>'
  189 |   if(n==1&&a==1){
      |               ^
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
  235 |     operator==(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'const std::allocator<_CharT>'
  189 |   if(n==1&&a==1){
      |               ^
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  441 |     operator==(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
  189 |   if(n==1&&a==1){
      |               ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  486 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
  189 |   if(n==1&&a==1){
      |               ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1667 |     operator==(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
  189 |   if(n==1&&a==1){
      |               ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
 1737 |     operator==(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
  189 |   if(n==1&&a==1){
      |               ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
 1033 |     operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'const std::pair<_T1, _T2>'
  189 |   if(n==1&&a==1){
      |               ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
  629 |     operator==(basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
  189 |   if(n==1&&a==1){
      |               ^
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
  637 |     operator==(basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
  189 |   if(n==1&&a==1){
      |               ^
/usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
  644 |     operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
      |     ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
  189 |   if(n==1&&a==1){
      |               ^
/usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3755 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  189 |   if(n==1&&a==1){
      |               ^
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 3772 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  189 |   if(n==1&&a==1){
      |               ^
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3819 |     operator==(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   mismatched types 'const _CharT*' and 'std::vector<int>'
  189 |   if(n==1&&a==1){
      |               ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
 2558 |     operator==(const tuple<_TElements...>& __t,
      |     ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'const std::tuple<_UTypes ...>'
  189 |   if(n==1&&a==1){
      |               ^
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
  234 |     operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
      |     ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note:   template argument deduction/substitution failed:
a.cc:189:15: note:   'std::vector<int>' is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>'
  189 |   if(n==1&&a==1){
      |               ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_vector.h:2050:5: note: cand