Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dbg puts("It's Just Begining.Wait For The End!!!!!\n")
#define CHECK(x) cout << (#x) << " is " << (x) <<"\n";
#define endl printf("\n")
typedef pair<ll,ll> pii;
#define pb push_back
#define ms(a,b) memset(a, b, sizeof(a))
#define in(x) scanf("%lld",&x)
#define out(x) printf("%lld",x)
#define X first
#define Y second
#define sps printf(" ")
#define dou(x) cout<<fixed<<setprecision(6)<<x
#define all(v) v.begin(),v.end()
#define dis(it,it1) distance(it,it1)+1
#define MAX 1000005
#define INF 1000000000
#define MOD 1000000007
#define print(cs) printf("Case %lld:\n",cs)
#define Yesno(ok) if(ok)puts("YES");else puts("NO")
#define yesno(ok) if(ok)puts("Yes");else puts("No")
ll lcm(ll a,ll b){return ((a*b)/__gcd(a,b));}
ll visit[MAX];
int main()
{
    ll i,j,k,l,n,m,r;
    in(n);
    ll arr[n];
    ms(visit,0);
    for(i=0;i<n;i++)
    {
        in(arr[i]);
        visit[arr[i]]++;
    }
    ll cnt=0;
    if(visit[1LL])
    {
        if(visit[1]==1)puts("1");
        else puts("0");
        exit(0);
    }
    for(i=0;i<n;i++)
    {
        if(visit[arr[i]]>1)continue;
        bool ok=false;
        for(j=2;j*j<=arr[i];j++)
        {
            if(arr[i]%j==0&&(visit[j]||visit[arr[i]/j]))
            {
                ok=true;
                break;
            }
        }
        if(!ok)cnt++;
    }
    out(cnt);endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:8: error: reference to 'visit' is ambiguous
   31 |     ms(visit,0);
      |        ^~~~~
a.cc:9:24: note: in definition of macro 'ms'
    9 | #define ms(a,b) memset(a, b, sizeof(a))
      |                        ^
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:25:4: note:                 'long long int visit [1000005]'
   25 | ll visit[MAX];
      |    ^~~~~
a.cc:31:8: error: reference to 'visit' is ambiguous
   31 |     ms(visit,0);
      |        ^~~~~
a.cc:9:37: note: in definition of macro 'ms'
    9 | #define ms(a,b) memset(a, b, sizeof(a))
      |                                     ^
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:25:4: note:                 'long long int visit [1000005]'
   25 | ll visit[MAX];
      |    ^~~~~
a.cc:35:9: error: reference to 'visit' is ambiguous
   35 |         visit[arr[i]]++;
      |         ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:25:4: note:                 'long long int visit [1000005]'
   25 | ll visit[MAX];
      |    ^~~~~
a.cc:38:8: error: reference to 'visit' is ambiguous
   38 |     if(visit[1LL])
      |        ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:25:4: note:                 'long long int visit [1000005]'
   25 | ll visit[MAX];
      |    ^~~~~
a.cc:40:12: error: reference to 'visit' is ambiguous
   40 |         if(visit[1]==1)puts("1");
      |            ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:25:4: note:                 'long long int visit [1000005]'
   25 | ll visit[MAX];
      |    ^~~~~
a.cc:46:12: error: reference to 'visit' is ambiguous
   46 |         if(visit[arr[i]]>1)continue;
      |            ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:25:4: note:                 'long long int visit [1000005]'
   25 | ll visit[MAX];
      |    ^~~~~
a.cc:50:30: error: reference to 'visit' is ambiguous
   50 |             if(arr[i]%j==0&&(visit[j]||visit[arr[i]/j]))
      |                              ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:25:4: note:                 'long long int visit [1000005]'
   25 | ll visit[MAX];
      |    ^~~~~
a.cc:50:40: error: reference to 'visit' is ambiguous
   50 |             if(arr[i]%j==0&&(visit[j]||visit[arr[i]/j]))
      |                                        ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:25:4: note:                 'long long int visit [1000005]'
   25 | ll visit[MAX];
      |    ^~~~~