Language: C++

#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int gcd[N];

int power(int x, int y) 
{ 
    int res = 1;
    x = x % MOD;
    while (y) {
        if(y & 1) res = res * x % MOD;
        y >>= 1;
        x = x * x % MOD;
    }
    return res; 
}

signed main(){
    IOS;
    int n, k;
    cin >> n >> k;
    gcd[k] = 1;
    for (int i = k - 1; i >= 1; i--) {
        gcd[i] = power(k/i, n);
        for (int j = 2 * i; j <= k; j += i) {
            gcd[i] = (gcd[i] - gcd[j] + MOD) % MOD;
        }
    }
    int ans = 0;
    for (int i = 1; i <= k; i++) {
        ans += i * gcd[i] % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:5: error: reference to 'gcd' is ambiguous
   39 |     gcd[k] = 1;
      |     ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/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:21:5: note:                 'long long int gcd [100005]'
   21 | int gcd[N];
      |     ^~~
a.cc:41:9: error: reference to 'gcd' is ambiguous
   41 |         gcd[i] = power(k/i, n);
      |         ^~~
/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:21:5: note:                 'long long int gcd [100005]'
   21 | int gcd[N];
      |     ^~~
a.cc:43:13: error: reference to 'gcd' is ambiguous
   43 |             gcd[i] = (gcd[i] - gcd[j] + MOD) % 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:21:5: note:                 'long long int gcd [100005]'
   21 | int gcd[N];
      |     ^~~
a.cc:43:23: error: reference to 'gcd' is ambiguous
   43 |             gcd[i] = (gcd[i] - gcd[j] + MOD) % 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:21:5: note:                 'long long int gcd [100005]'
   21 | int gcd[N];
      |     ^~~
a.cc:43:32: error: reference to 'gcd' is ambiguous
   43 |             gcd[i] = (gcd[i] - gcd[j] + MOD) % 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:21:5: note:                 'long long int gcd [100005]'
   21 | int gcd[N];
      |     ^~~
a.cc:48:20: error: reference to 'gcd' is ambiguous
   48 |         ans += i * 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:21:5: note:                 'long long int gcd [100005]'
   21 | int gcd[N];
      |     ^~~