Language: C++

//
//  main.cpp
//  E
//
//  Created by 曾憲揚 on 2020/8/21.
//  Copyright © 2020 曾憲揚. All rights reserved.
//

#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+5;
const int MOD = 1e9+7;
int gcd[maxn];

int mul(int a, int b){
    return (1LL*a*b)%MOD;
}
int quickpow(int a, int pow){
    int ans = 1;
    while(pow>0){
        if(pow&1) ans = mul(ans, a);
        a = mul(a, a);
        pow>>=1;
    }
    return ans;
}

int main(int argc, const char * argv[]) {
    int n, k; cin>>n>>k;
    for(int i=k; i>0; i--){
        gcd[i] = quickpow(k/i, n);
        for(int j=i+i; j<=k; j+=i){
            gcd[i] -= gcd[j];
            if(gcd[i]<0) gcd[i] += MOD;
        }
    }
    int ans=0;
    for(int i=1; i<=k; i++){
        ans = (ans + mul(gcd[i], i))%MOD;
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:31:9: error: reference to 'gcd' is ambiguous
   31 |         gcd[i] = quickpow(k/i, n);
      |         ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:9:
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:13:5: note:                 'int gcd [100005]'
   13 | int gcd[maxn];
      |     ^~~
a.cc:33:13: error: reference to 'gcd' is ambiguous
   33 |             gcd[i] -= gcd[j];
      |             ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:13:5: note:                 'int gcd [100005]'
   13 | int gcd[maxn];
      |     ^~~
a.cc:33:23: error: reference to 'gcd' is ambiguous
   33 |             gcd[i] -= gcd[j];
      |                       ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:13:5: note:                 'int gcd [100005]'
   13 | int gcd[maxn];
      |     ^~~
a.cc:34:16: error: reference to 'gcd' is ambiguous
   34 |             if(gcd[i]<0) gcd[i] += MOD;
      |                ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:13:5: note:                 'int gcd [100005]'
   13 | int gcd[maxn];
      |     ^~~
a.cc:34:26: error: reference to 'gcd' is ambiguous
   34 |             if(gcd[i]<0) gcd[i] += MOD;
      |                          ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:13:5: note:                 'int gcd [100005]'
   13 | int gcd[maxn];
      |     ^~~
a.cc:39:26: error: reference to 'gcd' is ambiguous
   39 |         ans = (ans + mul(gcd[i], i))%MOD;
      |                          ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:13:5: note:                 'int gcd [100005]'
   13 | int gcd[maxn];
      |     ^~~