criyle/codenet-compile-errors huggingface dataset:
Language: C

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=1e9+7;
const int N=1e5+5;
ll cnt[N];
ll n,k,ans;
ll pow(ll num)
{
	ll res=1,m=n;
	while(m>0){
	    if(m&1)
	    res=res*num%mod;
	    num=num*num%mod;
	    m>>=1;
	}
	return res;
}
int main()
{
	cin>>n>>k;
	for(ll i=k;i>=1;i--)
	{
	    cnt[i]=pow(k/i);
	    for(ll j=2;j*i<=k;j++)
		{
	        cnt[i]-=cnt[j*i];
	    }
	    ans+=(mod+(cnt[i]*i)%mod)%mod;
	    ans=(ans+mod)%mod;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
const int mod=1e9+7;
const int N=1e5+5;
ll cnt[N];
ll n,k,ans;
ll pow(ll num)
{
	ll res=1,m=n;
	while(m>0){
	    if(m&1)
	    res=res*num%mod;
	    num=num*num%mod;
	    m>>=1;
	}
	return res;
}
int main()
{
	ios::sync_with_stdio(0);
	cin>>n>>k;
	for(ll i=k;i>=1;i--)
	{
	    cnt[i]=pow(k/i);
	    for(ll j=2;j*i<=k;j++)
		{
	        cnt[i]-=cnt[j*i];
	    }
	    ans+=(mod+(cnt[i]*i)%mod)%mod;
	    ans=(ans+mod)%mod;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

const ll mod = 1000000007;

ll modpow(ll x, ll n){
    if(n == 0) return (ll)1;
    if(n % 2 == 0) return modpow(x * x % mod, n / 2);
    else return x * modpow(x, n - 1) % mod;
}

int main() {
    ll n, k;
    cin >> n >> k;
    
    vector<ll> cnt(k, 0);
    for(int x = k; x > 0; x--){
        ll sum = modpow(k / x, n);
        for(int y = 2 * x; y <= k; y += x){
            sum = (sum - cnt[y-1] + mod) % mod;
        }
        cnt[x-1] = sum;
    }

    ll ans = 0;
    rep(i, k)ans = (ans + (cnt[i] * (i + 1)) % mod) % mod;
    cout << ans << endl;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
using namespace std;
const int N = 100050;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
clock_t TIME_START, TIME_END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME_END - TIME_START) / CLOCKS_PER_SEC);
    system("pause");
#endif
}
ll n, k;
ll ans;
ll f[N];
inline ll mi(ll a, ll b)
{
    ll ret = 1;
    a %= mod;
    while (b)
    {
        if (b & 1)
            ret *= a, ret %= mod;
        a *= a, a %= mod;
        b >>= 1;
    }
    return ret;
}

void solve()
{
    scanf("%lld%lld", &n, &k);
    for (ll i = k; i; --i)
    {
        f[i] = mi(k / i, n);
        for (ll j = i * 2; j <= k; j += i)
            f[i] -= f[j];
        ans += (i * f[i] + mod % mod) % mod;
        ans = (ans + mod) mod;
    }
    cout << ans << '\n';
}

int main()
{
    TIME_START = clock();
    int Test = 1;
    // cin >> Test;
    while (Test--)
        solve();
    TIME_END = clock();
    program_end();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:50:26: error: expected ';' before 'mod'
   50 |         ans = (ans + mod) mod;
      |                          ^~~~
      |                          ;
Language: C

#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define M 1000000007
#define rep(i,b)  for(int i=0;i<(int)(b);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
typedef long long ll;
typedef long double ld;

using namespace std;
ll power(ll a,ll b){
    ll t=1;
    while(b) {
        if(b&1) t=(t*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    return t;
}
int main(){
    cs
    ll n,k,ans=0;cin>>n>>k;
    vector<ll> v(k+1);
    Repp(i,k,1) {
        v[i]=power(k/i,n);
        for(int j=i*2;j<=k;j+=i) v[i]-=v[j];
    }
    repp(i,1,k) {ans+=v[i]*i;ans%=M;}
    cout<<ans;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;
#define mod 1000000007
#define int long long int
int power(int a,int b)
{
	if(b==0)
	  return 1;
	int r=power(a,b/2);
	if(b%2==0)
	{
		return (r*r)%mod;
	}
	else
	{
		int x=(r*r)%mod;
		return (a*x)%mod;
	}
}
int32_t main()
{
	int n,k;
	cin>>n>>k;
	int arr[k+1];
	int j;
	for(j=k;j>=1;j--)
	{
		int total=k/j;
		int sub=power(total,n);
		int i;
		for(i=2;i*j<=k;i++)
		{
			sub-=arr[i*j];
			sub=sub%mod;
		}
		arr[j]=sub;
	}
	int answer=0;
	for(j=1;j<=k;j++)
	{
		answer=answer+j*arr[j];
		answer=answer%mod;
	}
	if(answer<=0)
	  answer+=mod;
	cout<<answer<<endl;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
#define int long long
typedef pair<int,int>pii;
const int mxN=1e5+10,M=1e9+7;
int n,k;
int mod(int a,int M){int ret=a%M;if(ret<0)ret+=M;return ret;}
int exp(int a,int b,int M){
    if(b==0LL)return 1LL;
    if(b==1LL)return mod(a,M);

    int t=exp(a,b/2,M);
    if(b&1)return mod(a*mod(t*t,M),M);
    return mod(t*t,M);
}
int v[mxN];
int resp;
int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>k;
    
    for(int x=k;x>=1;x--){
        int temp=k/x;
        temp=exp(temp,n,M);
        for(int i=2*x;i<=k;i+=x){
            temp-=v[i];
        }
        v[x]=temp;
        resp=mod(resp+mod(x*temp,M),M);
    }



    if(resp<0)resp+=M;
    cout<<resp;

}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<
//        pair<long long, int>, // change type
//        null_type,
//        less<pair<long long, int> >, // change type
//        rb_tree_tag,
//        tree_order_statistics_node_update>
//        ordered_set;

//template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;


vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)

typedef long long ll;
#define rep(i, start, end) for(int i = start; i < end; ++i)
#define sz(x) (int)((x).size())
#define pb push_back
#define T first
#define P second
#define all(x) x.begin(), x.end()
#define clr(d, v) memset(d, v, sizeof(d))
#define pii pair<int, int>
//#define debug(x) cerr << #x << " : " << (x) << " "
const double PI = 3.14159265358979323846;
const double eps = (1e-10);
int isGreater(long double x, long double y)
{
    if (abs(x - y) < eps)
        return 0;
    if (x > y)
        return 1;
    return -1;
}

const int MOD = 1000000007;
int add(int x, int y)
{
    x += y;
    while(x >= MOD)
        x -= MOD;
    while(x < 0)
        x += MOD;
    return x;
}

int mult(int x, int y)
{
    return (1LL * x * y) % MOD;
}


int n, k;

int power(int base, int exp)
{
    int ret = 1;
    for (; exp; exp >>= 1, base = mult(base, base))
        if (exp&1)
            ret = mult(ret, base);

    return ret;
}


const int MAX_N = 1e5 + 5;
int ans[MAX_N];
int count(int g)
{
    int c = k/g; // c c c
    int ret = power(c, n);
    for (int i = 2 * g; i <= k; i += g)
        ret = add(ret, -ans[i]);
    ans[g] = ret;
    return ret;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    int out = 0;
    for (int g = k; g >= 1; --g)
    {
//        debug(g, count(g));
        out = add(out, mult(count(g), g));
    }
    cout << out;

    return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
const lint MOD = 1e9+7;

lint modpow(lint m, lint n){
  if(n == 0) return 1;
  else if(n % 2 == 0) return modpow(m * m % MOD, n/2);
  else{
    return modpow(m, n - 1) * m % MOD;
  }
}

signed main(){
	lint N, K; cin >> N >> K;
	lint ans = 0;
	vector<lint> data(K + 1, 0);
	for(lint i = K; i > 0; i--){
		lint num = modpow(K/i, N);
		for(lint j = 2 * i; j <= K; j += i){
			num = num - data[j] + MOD;
			num %= MOD;
		}
		data[i] = num;
		ans += num * i;
		ans %= MOD;
	}
	cout << ans << endl;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  d' = 1;
  for (int j = 0; j < N; j++) {
    d' = d' * K / i;
  } //  K/i のガウスのn乗の値がd'となっている
  int max(i) = i * (k/i); 
  // d(i) = d'(i) - d(2i) -d(3i) -... - d(max(i))
  for (int j = 0; j < n j++) {
    
     
  
  
    


Compiler output:
a.cc:4:4: warning: missing terminating ' character
    4 |   d' = 1;
      |    ^
a.cc:4:4: error: missing terminating ' character
    4 |   d' = 1;
      |    ^~~~~~
a.cc:6:6: warning: multi-character character constant [-Wmultichar]
    6 |     d' = d' * K / i;
      |      ^~~~~~
a.cc: In function 'int main()':
a.cc:4:3: error: 'd' was not declared in this scope
    4 |   d' = 1;
      |   ^
a.cc:5:19: error: 'j' was not declared in this scope; did you mean 'jn'?
    5 |   for (int j = 0; j < N; j++) {
      |                   ^
      |                   jn
a.cc:5:23: error: 'N' was not declared in this scope
    5 |   for (int j = 0; j < N; j++) {
      |                       ^
a.cc:8:11: error: 'i' was not declared in this scope
    8 |   int max(i) = i * (k/i);
      |           ^
a.cc:10:23: error: 'n' was not declared in this scope
   10 |   for (int j = 0; j < n j++) {
      |                       ^
a.cc:10:24: error: expected ';' before 'j'
   10 |   for (int j = 0; j < n j++) {
      |                        ^~
      |                        ;
a.cc:10:31: error: expected '}' at end of input
   10 |   for (int j = 0; j < n j++) {
      |                              ~^
a.cc:10:31: error: expected '}' at end of input
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int  yuclid(i,j) {
    int k = i % j; 
    if (k = 0) {
      return j;
    }
    return yuclid(j,k);
  }
int answer(vector<int> vec(N)) {
  for (i = 0, i < N; i++) {
    
    

Compiler output:
a.cc:3:13: error: 'i' was not declared in this scope
    3 | int  yuclid(i,j) {
      |             ^
a.cc:3:15: error: 'j' was not declared in this scope; did you mean 'jn'?
    3 | int  yuclid(i,j) {
      |               ^
      |               jn
a.cc:3:16: error: expression list treated as compound expression in initializer [-fpermissive]
    3 | int  yuclid(i,j) {
      |                ^
a.cc:10:27: error: expected ',' or '...' before '(' token
   10 | int answer(vector<int> vec(N)) {
      |                           ^
a.cc: In function 'int answer(std::vector<int>)':
a.cc:11:8: error: 'i' was not declared in this scope
   11 |   for (i = 0, i < N; i++) {
      |        ^
a.cc:11:19: error: 'N' was not declared in this scope
   11 |   for (i = 0, i < N; i++) {
      |                   ^
a.cc:11:25: error: expected ';' before ')' token
   11 |   for (i = 0, i < N; i++) {
      |                         ^
      |                         ;
a.cc:11:28: error: expected '}' at end of input
   11 |   for (i = 0, i < N; i++) {
      |                           ~^
a.cc:11:28: error: expected '}' at end of input
a.cc:10:32: note: to match this '{'
   10 | int answer(vector<int> vec(N)) {
      |                                ^
a.cc:11:28: warning: no return statement in function returning non-void [-Wreturn-type]
   11 |   for (i = 0, i < N; i++) {
      |                            ^
Language: C

#include<iostream>
#include<vector>
using namespace std;
typedef long long li;
#define MOD 1000000007
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  // ここでストリームに obj を書き込みます。
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}

li pow(li a,int n){
  li ans=1;
  while(n){
    if(n%2) {
      ans*=a;
      if(df)print("*",a,ans);
      ans%=MOD;
    }
    (a*=a)%=MOD;
    n/=2;
  }
  return ans;
}


int main(){
  int n,k; cin >>n >>k;
  vector<li> v(k+1);
  rep(i,k+1) v[i]=i;

  auto f=
    [&](int a){
      int s=a*2;
      while(s<=k){
        v[s]-=v[a];
        s+=a;
      }
    };

  if(df)print(pow(10,10));

  li ans=0;
  repa(i,1,k+1){
    (ans+=pow(k/i,n)*v[i]%MOD)%=MOD;
    f(i);
  }
  if(df)print(v);
  print(ans);
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>


long long int mod(long long int x, long long int m);
long long int mod_inverse(long long int x, long long int m);
long long int mod_inverse_Fermat(long long int x, long long int m);
long long int fast_power(long long int x, long long int n, long long int m);
long long int euclid_extended(long long int a, long long int b, long long int &x, long long int &y);


using ll = long long int;
using namespace std;

ll MOD = 1e9+7;

int main(){

  ll N, K;
  cin >> N >> K;

  // make prime list
  vector<ll> prime(K+1);
  prime[0] = 0;
  prime[1] = 0;
  for(ll i = 2; i <= K; i++){
    prime[i] = 1;
  }
  for(ll i = 2; i <= K; i++){
    if(prime[i] == 1){
      for(ll j = 2; i*j <= K; j++){
        prime[i*j] = 0;
      }
    }
  }
  vector<ll> prime_list;
  for(ll i = 0; i <= K; i++){
    if(prime[i] == 1){
      prime_list.push_back(i);
    }
  }
  ll Nprime = prime_list.size();

  cerr << "prime list is made";

  cerr << "Nprime: " << Nprime << endl;
  /*for(ll i = 0; i < Nprime; i++){
    cerr << prime_list[i] << " ";
  }cerr << endl;*/

  // solve problem
  ll ans = 0;
  vector<ll> tmp_vec(K+1);
  for(ll i = 1; i <= K; i++){
    tmp_vec[i] = i;
  
    for(ll j = 1; j*j <= i; j++){
      if(i%j == 0){
        tmp_vec[i] -= tmp_vec[j];
        if(j*j < i && j != 1){
          tmp_vec[i] -= tmp_vec[i/j];
        }
      }
    }
    tmp_vec[1] = 1;

    //cerr << i << " " << tmp_vec[i] << endl;

    ans += tmp_vec[i] * fast_power(K/i, N, MOD);
    ans = (ans + MOD)%MOD;
  }

  cerr << "Answer:" << endl;
  cout << ans << endl;

  return 0;
  
}



long long int mod(long long int x, long long int m){
  if(x>0){
    return x%m;
  }
  else if(x==0){
    return 0;
  }
  else if((-x)%m == 0){
    return 0;
  }
  else{
    return m - (-x)%m;
  }
}


long long int euclid_extended(long long int a, long long int b, long long int &x, long long int &y){
  long long int d = a;
  if(b != 0){
    d = euclid_extended(b, a%b, y, x);
    y -= (a/b)*x;
  }
  else{
    x = 1;
    y = 0;
  }
  
  return d;
}

long long int mod_inverse(long long int x, long long int m){
  long long int tmp, x_inv, gcd_xm;
  gcd_xm = euclid_extended(x, m, x_inv, tmp);
  // if the inverse is calculate properly
  if(gcd_xm == 1){
    return mod(x_inv, m);
  }
  else{
    //std::cerr << "Error in mod_inverse: there is no inverse of x in mod m" << std::endl;
    return 0;
  }
}

long long int mod_inverse_Fermat(long long int x, long long int m){
  return fast_power(x, m-2, m);
}

long long int fast_power(long long int x, long long int n, long long int m){
  long long int ans = 1;
  
  while(n > 0){
    if(n&1){
      ans = ans * x;
      ans = mod(ans, m);
    }
    x = x*x;
    x = mod(x, m);
    n = n>>1;
  }
  
  return ans;
}



Compiler output:
main.c:2:10: fatal error: cstdio: No such file or directory
    2 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<stdlib.h>
#define  ll long long

ll rui(ll a,ll b){
  a*=a;
  b=--;
  if(b==0)return a;
  rui(a,b);
};  

int main(){
  ll n,k,ans=0;
  scanf("%lld %lld",&n,&k);
  for(ll a=1;a<=k;a++){
    ll c=k/a;
    ans+=rui(c,n);
  };
  printf("%lld",ans);
};


Compiler output:
main.c: In function 'rui':
main.c:7:7: error: expected expression before ';' token
    7 |   b=--;
      |       ^
Language: C

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n, k = map(int,input().split())
ans = int(k*(k+1)//2) #1種類のやつ

def function(n,k):
    if n < 1:
        return 0
    else:
        for i in range(1,k+1):
            ans += gcd(i,j) * math.factorial(n)
        return  ans + function(n-1)

for i in range(2,n+1): #2~n種類までループ
    for j in range(i+1,k+1):
        ans += gcd(i,j) * math.factorial(n) #数2種類
        for k in range(j+1,k+1):
            ans += gcd(i, j, k) * 6 #数3種類
    
print(function(n,k))


Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import math
      | ^~~~~~
main.c:2:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'from'
    2 | from functools import reduce
      | ^~~~
main.c:2:1: error: unknown type name 'from'
main.c:18:24: error: stray '#' in program
   18 | for i in range(2,n+1): #2~n種類までループ
      |                        ^
main.c:20:45: error: stray '#' in program
   20 |         ans += gcd(i,j) * math.factorial(n) #数2種類
      |                                             ^
main.c:22:37: error: stray '#' in program
   22 |             ans += gcd(i, j, k) * 6 #数3種類
      |                                     ^
Language: C

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
typedef long long ll;

ll MOD = 1000000007;

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while(n > 0) {
        if(n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    int N,K; cin >> N >> K;

    vector<ll> d(K);
    rep1(i,K+1) d[i] = modpow(K/i,N,MOD);

    for(int i = K; i > 0; i--) {
        for(int j = 2*i; j <= K; j += i) {
            d[i] -= d[j];
            d[i] %= MOD;
        }
    }

    ll ans = 0;
    rep1(i,K+1) {
        ans = (ans + (d[i] * i) % MOD) % MOD;
    }
    cout << ans << endl;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

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

typedef long long ll;

#define M 1000000007
#define MAX 100005

ll mpow(ll x, ll n){ 
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
ll msub(ll a,ll b){
	if(a>=b){
		return a-b;
	}
	return msub(a+M,b);
}

int main() {
	ll N,K;
    cin >> N >> K;
	ll gcd_num[MAX];
	
	ll sum=0;
	for(ll i=K; i >0; i--){
		ll num = mpow(K/i,N);
		for(int j=2;i*j<=K;j++){
			num = msub(num,gcd_num[i*j]);
		}
		gcd_num[i] = num;
		sum = (sum + (i * num%M))%M;
	}
	cout << sum << endl;

    return 0;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

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

ll mod_pow(ll x, ll n, const ll mod){
    ll ans = 1;
    while(n){
        if(n & 1) ans = ans * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return ans;
}

int main(){
    const ll mod = 1e9+7;
    int n, k; cin >> n >> k;

    ll d[k+1];
    loop(i, 1, k+1) d[i] = mod_pow(k/i, n, mod);
    for(int i = k; i > 0; i--){
        for(int j = 2*i; j < k+1; j += i){
            d[i] -= d[j];
            d[i] %= mod;
        }
    }
    ll ans = 0;
    loop(i, 1, k+1){
        ans += d[i]*i;
        ans %= mod;
    }
    cout << ans << endl;

    return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
// #define LOCAL
const ll MOD=1e9+7;
const int MAXN=1e5+10;
int N,K;
ll cnt[MAXN];
void read()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>K;
}
ll qpow(ll n,ll t)
{
    ll acc=1;
    while(t){
        if(t&1)acc=(acc*n)%MOD;
        n=n*n%MOD;
        t>>=1;
    }
    return acc;
}
void solve()
{
    read();
    for(int u=1;u<=K;u++){
        cnt[u]=qpow(K/u,N);
    }
    ll ans=0;
    for(int u=K;u>=1;u--){
        int t=u+u;
        while(t<=K){
            cnt[u]=(cnt[u]-cnt[t]+MOD)%MOD;
            t=t+u;
        }
        ans=(ans+cnt[u]*u%MOD)%MOD;
    }
    cout<<ans;
}
int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif
    solve();
}

Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
//int t[100005] , x[100005] , y[100005];
ll exp(ll a , ll b){
	if(b == 0)	return 1;
	int x = b % 2 == 0 ?   ((exp(a , b/2)%mod)*(exp(a , b / 2)%mod))%mod :  (a%mod*exp(a , b - 1) % mod)%mod;
	return x;
}
ll dp[nax];
int main(){
	dhoom;
	ll n , k;
	cin >>n >> k;
	ll ans = 0;
	for(int i = k ; i >= 1 ; i--){
		dp[i] = (k / i); // that much multiples are there for i 
		dp[i] = exp(dp[i],n);
		for(int j = 2 * i ; j <= k ; j+=i){
			dp[i] = (dp[i] - dp[j] + mod)%mod;
		}
	//	cout << dp[i] << " " << i << endl;
		ans = ans + dp[i]*i;
		//cout << ans << endl;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
	
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>

#include<algorithm>

#include<vector>

#include<queue>

#include<cstring>

#include<cmath>

#define LL  long long

#define MAXK    100010

#define P   1000000007

using namespace std;

int N, K;

LL cnt[MAXK];

LL ans = 0;

LL fastpw(LL base, LL power) {

	LL result = 1;	while(power>0) {

		if(power%2 == 1) {

			result = (result*base) %P;

		}

		power /= 2;

		base =(base*base) %P;

	}

	return result;

}

LL fastpw2(int base, int power) {

	LL result = 1;

	while(power>0) {

		if(power%2 == 0) {

			base = base * base % P;

			power /= 2;

		}else {

			power -= 1;

			result = result*base %P;

			power /= 2;

			base =base*base %P;

		}

	}

	return result;

}

int main()

{

    

    cin>>N>>K;

	cnt[K] = 1;

	ans = K;

    for(int i=K-1; i>=1; i--) {

        int t = K/i;

        cnt[i] = fastpw(t, N);

        //cnt[i] = pow(t, N);

        for(int j=i+i; j<=K; j+=i) {

            cnt[i] = cnt[i] + P - cnt[j];

            if(cnt[i]>=P) cnt[i]-=P;

        }

//        printf("%d %d\n", i, cnt[i]);

        ans += cnt[i]*i;

        ans %= P;

    }

    

  //  cout << fastpw(2, 1000)<<endl;

    cout << ans << endl;

    return 0;

}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;

#define sz(x) int(x.size())
#define pii pair<int, int>
#define All(x) (x).begin(), (x).end()
#define mp make_pair
#define Task "abc"

typedef long long ll;
const int maxn = 1e5 + 10;
const ll mod = 1e9 + 7;

ll f[maxn], cnt[maxn];

ll Pow(ll x, ll y){
  if (y == 0) return 1;
  ll tmp = Pow(x, y / 2);
  tmp = tmp * tmp; tmp %= mod;
  if (y % 2) return (tmp * x) % mod;
  return tmp;
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(NULL);
//  freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout);
  int n, k; cin >> n >> k;

  for (int i = 1; i <= k; ++i)
    for (int j = i; j <= k; j += i) ++cnt[i];

  ll ans = 0;
  for (int i = k; i > 0; --i){
    f[i] = Pow(cnt[i], n);
    for (int j = i * 2; j <= k; j += i) {
      f[i] = f[i] - f[j] + mod;
      f[i] %= mod;
    }
    ans = ans + f[i] * i;
    ans = ans % mod;
  }
  cout << ans;

return 0;
}




Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int MAXN = 100 * 1000 + 4;
const ll MOD = 1e9 + 7;
ll dp[MAXN];
ll n, k;

ll pw(ll a, ll b){
	if( b == (ll)0)
		return (ll)1;
	a %= MOD;
	if( b % 2 )
		return (pw(a * a, b/2) % MOD * a) % MOD;
	else
		return pw(a * a, b/2) % MOD;
}

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> n >> k;
	for( ll kp = k; kp >= 1; kp --){
		ll g = pw(k/kp, n) % MOD;
		ll p = 0;
		for( int j = 2 * kp; j <= k; j += kp)
			p = (p + dp[j]) % MOD;
		dp[kp] = (g - p + MOD) % MOD;
//		cout << dp[kp] << endl;
	}
	ll ans = 0;
	for( int i = 1; i <= k; i ++){
		ans = (ans + (dp[i] % MOD * i % MOD)) % MOD;
		ans %= MOD;
	}
	cout << ans % MOD << endl;
	return 0;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())

using namespace std;

#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;
const ll inf =1000000007;

//繰り返し
ll RepeatSquaring(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(N, P/2, M);
        return t*t % M;
    }
    return N * RepeatSquaring(N, P-1, M);
}

vector< ll > divisor(ll n) {
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

ll n,k;

ll cal(ll x) {  // (K/x)^N
    int p = n;
    x = 1LL * k / x;
    x %= inf;
    ll res = 1;
    while (p > 0) {
        if (p & 1) res = (x * res) % inf;
        x = x * x % inf;
        p >>= 1;
    }
    return res;
}

void esolve(){
    cin >> n >> k;
    ll ans=0;
    ll d[k+1];
    rep(i,k+1) d[i]=0;
    for(ll i=k;i>=1;i--){
        vector<ll> motu=divisor(i);
        ll score=cal(i);
        score%=inf;
        ll extra=0;
        for(ll j=2*i;j<=k;j+=i){
            extra+=d[j];
            extra%=inf;
        }
        d[i]=(score-extra+inf)%inf;
    }
    for(ll i=1;i<=k;i++){
        ans+=i*d[i];
        ans%=inf;
    }
    kaku(ans);
}
int main(){
    esolve();
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;

ll mpow(ll a,ll n){
    ll ret = 1;
    while(n){
        if(n&1)(ret *= a)%= mo;
        (a *= a)%=mo;
        n>>=1;
    }
    return ret%mo;
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    vector<ll> dp(100005);
    int n,k;
    cin>>n>>k;
    ll ret = 0;
    for(int i=k;i>0;--i){
        dp[i] = mpow(k/i,n);
        for(int j=2*i;j<=k;j+=i)dp[i] -= dp[j];
        dp[i] = (dp[i]%mo+mo)%mo;
        ret += i*dp[i]%mo;
    }
    cout << ret%mo << endl;
    return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;
int gcd (int a,int b) {
   if (a >= b) {
       if (b == 0) {
           return a;
       }
       else {
           return gcd(b,a % b);
       }
   }
   else {
       return gcd(b,a);
   }
}
ll pow(ll a,ll n,ll d) {
    if (n == 0) {
        return 1;
    }
    if (n % 2 == 1){
        return a * pow(a,n - 1,d) % d;
    }
    else {
        ll t = pow(a,n/2,d);
        return t * t % d;
    }
}
int main() {
    ll n,k;
    cin >> n >> k;
    ll ans[k + 1];
    for (ll i = k; i >= 1; i--) {
        ans[i] = pow(k / i, n , mod);
        int count = 2;
        while  (i * count < k + 1) {
            ans[i] -= ans[i * count];
            count++;
        }
    }
    ll ret = 0;
    for (int i = 1; i <= k; i++) {
        ret += ans[i] * i % mod;
    }
    cout << ret % mod ;
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;

ll modmultiply(ll a,ll b,ll c) {
  ll x = 0,y = a%c; 
  while(b > 0) {
    if(b%2 == 1) x = (x+y)%c; 
    y = (y*2)%c;
    b /= 2; 
  }
  return x%c;
}

ll modpow(ll x, ll y, ll mod) {
  ll ret = 1;// ret = x^y%mod;
  while(y) {
    if(y&1)
      //ret = (ret*x)%mod;
      ret = modmultiply(ret, x, mod);
    //x = (x*x)%mod;
    x = modmultiply(x, x, mod);
    y >>= 1;
  }
  return ret;
}

int N,K;

const ll mod = 1000000007LL;

vector<int> getDiv(int n){
  vector<int> res;
  for(int i=1;i*i<=n;i++)
    if(n%i == 0)
	{
	  res.push_back(i);
	  if(i*i != n) 
	    res.push_back(n/i);
	}
  return res;
}


typedef pair<ll,ll> ii;
map<ii,ll> mp;
ll bf_ans = 0;
map<ll,ll> cnt;
void dfs(int cur,ll g,deque<ll> &deq) {
  if( cur >= N ) {
    //cout << "g = " << g << endl;
    cout << "gcd(";
    rep(i,(int)deq.size()) {
      if( i ) cout << ", ";
      cout << deq[i];
    }
    cout << ") = " << g << endl;
    ++cnt[g];
    bf_ans += g;
    bf_ans %= mod;
    return;
  }
  REP(i,1,K+1) {
    deq.pb(i);
    dfs(cur+1,__gcd(g,(ll)i),deq);
    deq.pop_back();
  }
}

ll bf() {
  REP(i,1,K+1) {
    deque<ll> deq;
    deq.pb(i);
    dfs(1,i,deq);
  }
  return bf_ans;
}




ll dp[100010];

void solve() {
  //cout << bf() << endl;
  ll ans = 0;
  for(ll i = K; i >= 1; --i) {
    ll v = K / i;
    dp[i] = modpow(v,N,mod);
    for(ll j=i*2;j<=K;j=j+i) {
      dp[i] -= dp[j];
      while( dp[i] < 0 ) ( dp[i] += mod ) %= mod;
      dp[i] %= mod;
    }
    ( ans += (ll)( i * dp[i] ) ) %= mod ;
  }
  cout << ans << endl;
}

int main() {
  cin >> N >> K;
  solve();
  return 0;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
    WRITER:kakitamasziru/OxOmisosiru
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
//#include <unordered_map> // unordered_map
//#include <unordered_set> // unordered_set
#include <bitset> // bitset
//#include <cctype> // isupper, islower, isdigit, toupper, tolower
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 100100100100100;
const int MOD = 1000000007;
typedef pair<int,int> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long X[114514];
long long justX[114514];

int main() {
    int N,K;cin >> N >> K;
    for(int i = 0;i<114514;i++)X[i] = 0;
    //gcd{A}がXの倍数になるようなAの選び方は(K/i)^N通り
    for(int i = K;i>0;i--){
        int A = K/i;
        X[i] = mod_pow(A,N);
        //2*X,3*X…の通りを引いていく
        int times = 2;
        while(times*i <= K){
            X[i] -= X[times*i];
            X[i] %= MOD;
            times++;
        }
    }
    
    long long ans = 0;
    for(long long i = 1;i<=K;i++){
        ans += (i*X[i])%MOD;
        ans %= MOD;
    }
    cout << ans << endl;

    // PLEASE GIVE ME THE "ACCEPTED" !
}

Compiler output:
main.c:4:10: fatal error: iostream: No such file or directory
    4 | #include <iostream> // cout, endl, cin
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}


ll modpow(ll a,ll b){
    ll ret = 1;
    while(b>0){
        if(b&1)ret = (ret*a)%MOD;
        a = (a*a)%MOD;
        b = b>>1;
    }
    return ret;

}

int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll> nk(n+1,0);
    ll ans = 0;
    for(ll i=k;i>=1;i--){
        ll s = k/i;
        ll gcds = modpow(s,n);
        ll snext = i*2;
        ll next = 3;

        while(snext<=k){
            gcds-=nk[snext];
            if(gcds<0)gcds+=MOD;
            snext=next*i;
            next++;
        }

        ans+=gcds*i;
        ans%=MOD;
        nk[i]=gcds;

    }

    cout<<ans<<endl;






return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

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

const ll mod = 1e9 + 7;

long long gcd(ll x, ll y){
	if(x > y) swap(x, y);
	while(x != 0){
		y %= x;
		swap(x, y);
	}
	return y;
}

ll mpow(ll x, ll r){
	if(r == 0) return 1;
	if(r % 2 == 1){ return x * mpow(x, r-1) % mod; }
	else{ ll aa = mpow(x, r/2); return aa*aa%mod; }
}

int main(){
	ll N, K; cin >> N >> K;
	ll ans = 0, num[K+1];
	for(int g=K; g>=1; g--){
		if(g==K){
			num[K] = 1;
			ans += K;
		}else{
			ll xx = mpow(K/g, N);
			num[g] = xx;
			for(int j=2; j<=(K/g); j++){
				num[g] = (num[g] - num[j*g] + 10*mod) % mod;
			}
			ans = (ans + g*num[g]%mod) % mod;
		}
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
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;}


int main() {
  int n, k;
  cin >> n >> k;
  vector<mint> d(k + 1);
  for(int i = 1; i <= k; ++i) {
    d[i] = k / i;
    d[i] = d[i].pow(n);
  }

  for (int i = k; i >= 1; --i) {
    for (int j = i * 2; j <= k; j += i) {
      d[i] -= d[j];
    }
  }
  mint ans = 0;
  for (int i = 1; i <= k; ++i) {
    ans += d[i] * i;
  }
  cout << ans << endl;

}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <vector>
using namespace std;

// a^n (mod) を計算する
int64_t modpow(int64_t a, int64_t n, int64_t mod) {
    int64_t res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

const int64_t MOD = 1e+09 + 7;

int main(){
    int64_t N,K;
    cin >> N >> K;
    vector<int64_t> num(K+1); // xの倍数の個数はnum(x)
    
    for ( int64_t i = K; i >= 1; --i){
        int64_t count;
        count = modpow( (K/i), N, MOD );
        for ( int64_t j = 2; j <= K; ++j){
            if ( i * j > K ){
                break;
            } else {
                count = count - num.at(i*j);
            }
        }
        num.at(i) = count % MOD;
    }
    int64_t res = 0;
    for ( int i = 1; i <= K; ++i){
        res =  ( res + i * num.at(i) ) % MOD;
    }
    cout << res << endl;
    
    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

template<class T> inline T C(T x,T y){
    if(x<y)return 0;
    T div=min(x-y,y);
    T v=max(x-y,y);
    ll bunbo=1,bunshi=1;
    irep(i,x-div+1,x+1){
        bunshi*=i;
    }
    rep(j,1,div+1){
        bunbo*=j;
    }
    return bunshi/bunbo;
}
template<class T> inline T modC(T x,T y,ll mod){
    if(x<y)return 0;
    T div=min(x-y,y);
    ll bunbo=1,bunshi=1;
    irep(i,x-div+1,x+1){
        bunshi*=i;
        bunshi%=mod;
        if(bunshi<0)bunshi+=mod;
    }
    rep(j,1,div+1){
        bunbo*=j;
        bunbo%=mod;
        if(bunbo<0)bunbo+=mod;
    }
    T ans=bunshi*modinv(bunbo,mod)%mod;
    if(ans<0)ans+=mod;
    return ans;
}
long long INF = 1LL<<60;
int main( ){
    ll N,K;
    cin>>N>>K;
    ll mod=1e9+7;
    vll gcdres(K+1,0);
    irep(i,1,K+1){
        ll quem=K/i;
        gcdres[i]=modpow(quem,N,mod)%mod;
        if(gcdres[i]<0)gcdres[i]+=mod;
        if(quem>=2){
            rep(j,2,quem+1){
                gcdres[i]-=gcdres[i*j];
                gcdres[i]%=mod;
                if(gcdres[i]<0)gcdres[i]+=mod;
            }
        }
    }
    ll ans=0;
    rep(i,1,K+1){
        ans+=gcdres[i]*i%mod;
        ans%=mod;
        if(ans<0)ans+=mod;
    }
    cout<<ans<<endl;
    return 0;
}




Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
ll read(){ll a;scanf("%lld",&a);return a;}

const int inf = 3 * TEN(18) + 10;
const int mod = TEN(9) + 7;

inline ll mod_pow(ll a, ll x, ll m)
{
	if (x == 0) return 1ll;

	ll res = mod_pow(a, x / 2, m);

	res *= res;
	res %= m;

	if (x % 2) {
		res *= a;
		res %= m;
	}

	return res;
}

int N, K;
int counter[100010];

signed main()
{
	cin >> N >> K;

	int ans = 0;

	for (int i = K; i >= 1; --i) {
		counter[i] = mod_pow(K / i, N, mod);
		for (int j = i + i; j <= K; j += i) {
			counter[i] += mod - counter[j];
			counter[i] %= mod;
		}
	}

	for (int i = 1; i <= K; ++i) {
		ans += i * counter[i];
		ans %= mod;
	}

	cout << ans << endl;
}




Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.