Language: C++

#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per0(i, st, ed) for (int i = (st); i > ed; --i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
#define chmin(a, b) (a = a > b ? b : a)
#define chmax(a, b) (a = a < b ? b : a)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
template<class T> void _out(const T &x) { cout << x; }
void _out(const int &x) { printf("%d", x); }
void _out(const ll &x) { printf("%lld", x); }
void _out(const double &x) { printf("%.16f", x); }
void _out(const char &x) { putchar(x); }
void _out(const char *x) { printf("%s", x); }
template<class T,class U> void _out(const pair<T,U> &x) {_out(x.F); putchar(' '); _out(x.S);}
template<class T> void _out(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _out(*i++)) if (i != x.cbegin()) putchar(' '); }
void out() {}
template<class T, class... U> void out(const T &head, const U &... tail) { _out(head); putchar(sizeof...(tail) ? ' ' : '\n'); out(tail...); }
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}

ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
const int maxn = 1e5 + 5;
ll n, f, k[maxn];

int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    sf(n, k);
    ll ans = 0;
    for (int i = k; i >= 1; --i) {
        f[i] = power(k / i, n);
        for (int j = 2 * i; j <= k; j += i) f[i] -= f[j];
        ans = (ans + i * f[i] % mod) % mod;
    }
    cout << (ans + mod) % mod << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:81:18: error: invalid conversion from 'long long int*' to 'int' [-fpermissive]
   81 |     for (int i = k; i >= 1; --i) {
      |                  ^
      |                  |
      |                  long long int*
a.cc:82:10: error: invalid types 'long long int[int]' for array subscript
   82 |         f[i] = power(k / i, n);
      |          ^
a.cc:82:24: error: invalid operands of types 'long long int [100005]' and 'int' to binary 'operator/'
   82 |         f[i] = power(k / i, n);
      |                      ~ ^ ~
      |                      |   |
      |                      |   int
      |                      long long int [100005]
a.cc:83:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   83 |         for (int j = 2 * i; j <= k; j += i) f[i] -= f[j];
      |                             ~~^~~~
a.cc:83:46: error: invalid types 'long long int[int]' for array subscript
   83 |         for (int j = 2 * i; j <= k; j += i) f[i] -= f[j];
      |                                              ^
a.cc:83:54: error: invalid types 'long long int[int]' for array subscript
   83 |         for (int j = 2 * i; j <= k; j += i) f[i] -= f[j];
      |                                                      ^
a.cc:84:27: error: invalid types 'long long int[int]' for array subscript
   84 |         ans = (ans + i * f[i] % mod) % mod;
      |                           ^
a.cc: In instantiation of 'void _sf(T&) [with T = long long int [100005]]':
a.cc:42:66:   required from 'void sf(T&, U& ...) [with T = long long int [100005]; U = {}]'
   42 | template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
      |                                                               ~~~^~~~~~
a.cc:42:76:   required from 'void sf(T&, U& ...) [with T = long long int; U = {long long int [100005]}]'
   42 | template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
      |                                                                          ~~^~~~~~~~~
a.cc:79:7:   required from here
   79 |     sf(n, k);
      |     ~~^~~~~~
a.cc:35:39: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'long long int [100005]')
   35 | template<class T> void _sf(T &x) {cin >> x;}
      |                                   ~~~~^~~~
In file included from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:2:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:7: note:   conversion of argument 1 would be ill-formed:
/usr/include/c++/14/istream:170:7: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'long long int*'
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:7: note:   conversion of argument 1 would be ill-formed:
/usr/include/c++/14/istream:174:7: error: invalid conversion from 'long long int*' to 'short int' [-fpermissive]
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
      |       |
      |       long long int*
/usr/include/c++/14/istream:174:7: error: cannot bind rvalue '(short int)((long long int*)x)' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:7: note:   conversion of argument 1 would be ill-formed:
/usr/include/c++/14/istream:177:7: error: invalid conversion from 'long long int*' to 'short unsigned int' [-fpermissive]
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
      |       |
      |       long long int*
/usr/include/c++/14/istream:177:7: error: cannot bind rvalue '(short unsigned int)((long long int*)x)' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:7: note:   conversion of argument 1 would be ill-formed:
/usr/include/c++/14/istream:181:7: error: invalid conversion from 'long long int*' to 'int' [-fpermissive]
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
      |       |
      |       long long int*
/usr/include/c++/14/istream:181:7: error: cannot bind rvalue '(int)((long long int*)x)' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:7: note:   conversion of argument 1 would be ill-formed:
/usr/include/c++/14/istream:184:7: error: invalid conversion from 'long long int*' to 'unsigned int' [-fpermissive]
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
      |       |
      |       long long int*
/usr/include/c++/14/istream:184:7: error: cannot bind rvalue '(unsigned int)((long long int*)x)' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:7: note:   conversion of argument 1 would be ill-formed:
/usr/include/c++/14/istream:188:7: error: invalid conversion from 'long long int*' to 'long int' [-fpermissive]
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
      |       |
      |       long long int*
/usr/include/c++/14/istream:188:7: error: cannot bind rvalue '(long int)((long long int*)x)' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:7: note:   conversion of argument 1 would be ill-formed:
/usr/include/c++/14/istream:192:7: error: invalid conversion from 'long long int*' to 'long unsigned int' [-fpermissive]
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
      |       |
      |       long long int*
/usr/include/c++/14/istream:192:7: error: cannot bind rvalue '(long unsigned int)((long long int*)x)' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:199:7: note:   conversion of argument 1 would be ill-formed:
/usr/include/c++/14/istream:199:7: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
      |       |
      |       long long int*
/usr/include/c++/14/istream:199:7: error: cannot bind rvalue '(long long int)((long long int*)x)' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:203:7: note:   conversion of argument 1 would be ill-formed:
/usr/include/c++/14/istream:203:7: error: invalid conversion from 'long long int*' to 'long long unsigned int' [-fpermissive]
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
      |       |
      |       long long int*
/usr/include/c++/14/istream:203:7: error: cannot bind rvalue '(long long unsigned int)((long long int*)x)' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  328 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/14/istream:328:7: note:   conversion of argument 1 would be ill-formed:
/usr/include/c++/14/istream:328:7: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  219 |       operator>>(float& __f)
      |       ^~~~~~~~
/usr/include/c++/14/i