Language: C++

/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 100005
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)

ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT], freq[MAX_INT];
vector<ll> V;

ll modSum(ll A, ll B) {
	return (A + B) % MOD;
}
ll modSub(ll A, ll B) {
	return (A - B + MOD) % MOD;
} 
ll modMul(ll A, ll B) {
	return (A * B) % MOD;
}

ll modPow(ll x, ll y) {  
    ll res = 1;  
 
    x = x % MOD;   
   
    if (x == 0) return 0;  
  
    while (y > 0)  
    {  
       
        if (y & 1)  
            res = (res*x) % MOD;  
        y = y>>1; 
        x = (x*x) % MOD;  
    }  
    return res;  
}  

int main() {
	scanf("%lld %lld", &M, &N);
	fei(i, 1, N, 1) {
		fei(j, i, N, i) {
			if(j % i == 0) {
				data[i]++;
			} 
		}
	}
	
	ll finalAns = 0;
	for(int i = N; i>= 1; i--) {
		ll ans = 0;
		ans = modSum(ans, modPow(data[i], M));
		// cout << ans << " " << i << " \n";
		freq[i] += ans;
		fei(j, 1, sqrt(i), 1) {
			if(i != j && (i % j) == 0) {
				freq[j] = (freq[j] - freq[i]);
				if(j != i / j && i != i / j) {
					freq[i / j] = (freq[i / j] - freq[i]);
				}
			} 
		}
		// cout << freq[1] << " " << freq[2] << " " << freq[3] << " " << freq[4] << "\n";
		// cout << ans << " ";
		// ans = modSub(ans, modSub(data[i], 1ll));
		// cout << ans << " \n";
		// finalAns = modSum(finalAns, modMul(ans, i));
	}
	fei(i, 1, N, 1) {
		finalAns = modSum(finalAns, modMul(i, freq[i]));
	}
	printf("%lld\n", finalAns);
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Compiler output:
a.cc: In function 'int main()':
a.cc:65:33: error: reference to 'data' is ambiguous
   65 |                                 data[i]++;
      |                                 ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:5:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:29:33: note:                 'long long int data [100005]'
   29 | ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT], freq[MAX_INT];
      |                                 ^~~~
a.cc:73:42: error: reference to 'data' is ambiguous
   73 |                 ans = modSum(ans, modPow(data[i], M));
      |                                          ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:29:33: note:                 'long long int data [100005]'
   29 | ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT], freq[MAX_INT];
      |                                 ^~~~