Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

// Sieve of Eratosthenes
struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

int main() {
  int n, k; cin>>n>>k;
  Sieve sieve(k);
  mint ans;
  vector<mint> d(k+1);
  for (int i = 1; i <= k; ++i) d[i] = mint(k/i).pow(n);
  for (int p : sieve.primes) {
    for (int i = p; i <= k; i += p) {
      d[i/p] -= d[i];
    }
  }
  for (int i = 1; i <= k; ++i) ans += d[i]*i;
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc:5:11: error: two or more data types in declaration of 'type name'
    5 | using P = pair<int,int>
      |           ^~~~~~~~~~~~~
a.cc: In constructor 'mint::mint(ll)':
a.cc:10:21: error: 'mod' was not declared in this scope; did you mean 'modf'?
   10 |   mint(ll x=0):x((x%mod+mod)%mod){}
      |                     ^~~
      |                     modf
a.cc: In member function 'mint& mint::operator+=(mint)':
a.cc:13:23: error: 'mod' was not declared in this scope; did you mean 'modf'?
   13 |     if ((x += a.x) >= mod) x -= mod;
      |                       ^~~
      |                       modf
a.cc: In member function 'mint& mint::operator-=(mint)':
a.cc:17:15: error: 'mod' was not declared in this scope; did you mean 'modf'?
   17 |     if ((x += mod-a.x) >= mod) x -= mod;
      |               ^~~
      |               modf
a.cc: In member function 'mint& mint::operator*=(mint)':
a.cc:20:50: error: 'mod' was not declared in this scope; did you mean 'modf'?
   20 |   mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
      |                                                  ^~~
      |                                                  modf
a.cc: In member function 'mint mint::inv() const':
a.cc:33:33: error: 'mod' was not declared in this scope; did you mean 'modf'?
   33 |   mint inv() const { return pow(mod-2);}
      |                                 ^~~
      |                                 modf
a.cc: At global scope:
a.cc:64:10: error: 'P' was not declared in this scope
   64 |   vector<P> factor(int x) {
      |          ^
a.cc:64:11: error: template argument 1 is invalid
   64 |   vector<P> factor(int x) {
      |           ^
a.cc:64:11: error: template argument 2 is invalid
a.cc: In member function 'int Sieve::factor(int)':
a.cc:67:12: error: 'P' was not declared in this scope
   67 |     vector<P> res(1, P(fl[0], 0));
      |            ^
a.cc:67:13: error: template argument 1 is invalid
   67 |     vector<P> res(1, P(fl[0], 0));
      |             ^
a.cc:67:13: error: template argument 2 is invalid
a.cc:67:33: error: expression list treated as compound expression in initializer [-fpermissive]
   67 |     vector<P> res(1, P(fl[0], 0));
      |                                 ^
a.cc:69:15: error: request for member 'back' in 'res', which is of non-class type 'int'
   69 |       if (res.back().first == p) {
      |               ^~~~
a.cc:70:13: error: request for member 'back' in 'res', which is of non-class type 'int'
   70 |         res.back().second++;
      |             ^~~~
a.cc:72:13: error: request for member 'emplace_back' in 'res', which is of non-class type 'int'
   72 |         res.emplace_back(p, 1);
      |             ^~~~~~~~~~~~