Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
ll mod=1e9;
ll MOD=1e18;
#define ff first
#define yy second
#define endl "\n"
#define gap ' '
bool comp(const pair<int,int>&p,const pair<int,int>&q)
{
    //if(p.first!=q.first)
        return (p.first<q.first);
        //return (p.second<q.second);
}
bool comp2(const pair<int,int>&p,const pair<int,int>&q)
{
    if(p.second!=q.second)
        return (p.second<q.second);
        return (p.first<q.first);
}
bool comp3(const pair<ll,pair<ll,ll> >&p,const pair<ll,pair<ll,ll> >&q)
{
    if(p.first!=q.first) return p.first<q.first;
    if(p.second.first!=q.second.first) return p.second.first<q.second.first;
    return p.second.second<q.second.second;
}
long long pp(long long a,long long b)
{
    long long t=1;
    while(b)
    {
        if(b&1) t=(t*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }return t;
}bool isprime(int n)
{
    int i=2;
    if(n==1) return true;
    if(n==2) return true;
    for(;i*i<=n;i++)
    {
        if(n%i==0) return false;
    }return true;
}
long long lcd(long long n,long long m)
{
    if(n>m) swap(m,n);
    if(m%n==0) return m;
    else
    {int p=n+n;
        while(1)
        {
            if(p%m==0) return p;
            else p=(n+p)%MOD;
        }
    }
}
  /*bitmask
int sum_of_all_subset ( vector< int > s ){
            int n = s.size() ;
            int results[ ( 1 << n ) ] ;     ( 1 << n )= 2^n

         initialize results to 0
            memset( results, 0, sizeof( results ) ) ;

         iterate through all subsets

           for( int i = 0 ; i < ( 1 << n ) ; ++ i ) {     for each subset, O(2^n)
                 for ( int j = 0; j < n ; ++ j ) {        check membership, O(n)
                     i f ( ( i & ( 1 << j ) ) ! = 0 )     test if bit �j� is turned on in subset �i�?
                          results[i] += s [j] ;           if yes, process �j�
                     }
                 }
           }
           */
void print(ll n)
{
    ll mask=1LL<<63;
    for(ll i=0;i<64;i++)
    {
        int p=(mask&n)?1:0;
        n=n<<1;
        cout<<p;
    }
    cout<<endl;
}

//vector<int>weight(200005,0);
//vector<int>val;
//vector<int>visited(200005,WHITE);
//int mx_w;
/*
void bfs(int sr)
{
    weight[sr]=1;
    val.push_back(1);
    visited[sr]=GREY;
    queue<int> q;
    q.push(sr);
    while(!q.empty())
    {
        int u=q.front();
        q.pop();
        for(int i=0;i<g[u].size();i++)
        {
            int v=g[u][i];
            if(visited[v]==GREY) continue;
            weight[v]=weight[u]+1;
            //mx_w=max(mx_w,weight[v]);
            val.push_back(weight[v]);
            visited[v]=GREY;
            q.push(v);
        }
    }
}
*/
/*bool cmp(pair<int,pair<int,int> >&p,pair<int,pair<int,int> >&q)
{
    if(p.first!=q.first) return p.first<q.first;
    if(p.first==q.first)
    {
        if(p.second.first!=q.second.first) return (p.second.first<q.second.first);
        if(p.second.first==q.second.first)
        {
           return (p.second.second<=q.second.second);
        }
        return false;
    }
}*/
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ll min(ll a,ll b)
{
    return (a<b)?a:b;
}
ll INF =1000000007;

ll binomialCeff(ll n,ll k)
{
    ll c[k+1];
    memset(c,0,sizeof(c));
    c[0]=1;
    ll i,j;
    for(i=0;i<=n;i++)
    {
        for(j=min(i,k);j>0;j--)
        {
            c[j]=c[j]+c[j-1];
        }
    }
    cout<<c[k]<<endl;
    return c[k];
}
vector<int>adj [200006];
int size[200006]={0};
int depth[200006]={0};
int res[200006];
int dfs(int u,int f)
{
    size[u]=1;
    depth[u]=depth[f]+1;
    for(int i=0;i<(int)adj[u].size();i++)
    {
        int v=adj[u][i];
        if(v==f) continue;
        size[u]+=dfs(v,u);
    }
    res[u]=size[u]-depth[u];
    return size[u];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int cs=1;
    //scanf("%d",&cs);
    while(cs--)
    {
        int n;
        scanf("%d",&n);
        int i,j,k;
        ll sum=0;
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=n;j++)
            {
                for(k=1;k<=n;k++)
                {
                    sum+=(__gcd(__gcd(i,j),k));
                }
            }
        }
        printf("%I64d",sum);
    }
}


Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:163:5: error: reference to 'size' is ambiguous
  163 |     size[u]=1;
      |     ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:158:5: note:                 'int size [200006]'
  158 | int size[200006]={0};
      |     ^~~~
a.cc:169:9: error: reference to 'size' is ambiguous
  169 |         size[u]+=dfs(v,u);
      |         ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:158:5: note:                 'int size [200006]'
  158 | int size[200006]={0};
      |     ^~~~
a.cc:171:12: error: reference to 'size' is ambiguous
  171 |     res[u]=size[u]-depth[u];
      |            ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:158:5: note:                 'int size [200006]'
  158 | int size[200006]={0};
      |     ^~~~
a.cc:172:12: error: reference to 'size' is ambiguous
  172 |     return size[u];
      |            ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:158:5: note:                 'int size [200006]'
  158 | int size[200006]={0};
      |     ^~~~