Language: C

#include <bits/stdc++.h>

//#define DEBUG

#ifdef DEBUG
using std::endl;
std::ifstream cin("input.txt");
std::ofstream cout("output.txt");
#endif // DEBUG
#ifndef DEBUG
using namespace std;
#endif // DEBUG

template <class T>
void print_vect(T v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}

int gcd(int a , int b){
    if( a < b){
        return gcd(b, a);
    }else{
        if( b == 0){
            return a;
        }else{
            return gcd(b , a % b);
        }
    }
 
}

int gcd(int a, int b , int c, int d){
    int e = gcd(a, b);
    int f = gcd(c, d);
    return gcd(e, f);
}
int gcd(int a, int b , int c, int d, int e){
    int f = gcd(a, b);
    return gcd(f, c, d, e);
}

int gcd(int a, int b, int c){
    int d = gcd(a,b);
    return gcd(c, d);
}

unsigned int pow(unsigned int a , unsigned int p, unsigned int mod){
    if( p < 2){
        unsigned int ans = 1;
        while(p--){
            ans =  (ans * a) % mod;
        }
        return ans;
    }else{
        if( p % 2){
            unsigned int ans = pow(a, p / 2, mod);
            unsigned int real_ans = (ans * ans) % mod;
            real_ans = (real_ans * a) % mod;
            return real_ans;
        }else{
            unsigned int ans = pow(a , p /2, mod);
            return (ans * ans) % mod;
        }
    }
}

unsigned int count_turple(int N, int K){
    std::vector<unsigned int> count_prime_turple;
    count_prime_turple.reserve(K + 1);
    count_prime_turple.push_back(0);
    count_prime_turple.push_back(1);
    const unsigned int MOD = 1000000007;

    for(int k = 2 ; k <= K ;k++){
        unsigned int count = pow(k, N, MOD);
        for(int j = 2 ; j <= k ; j++){
            count = (count + MOD - count_prime_turple[k / j]) % MOD;
        }
        count_prime_turple.push_back(count);
    }
    
    unsigned int ans = 0;
    // cout << "Smart function " << endl;
    // cout << "Expetect total turple " << pow(K, N, MOD) << " \ngcd count: ";
    unsigned int count_t = 0;
    for(int i = 1 ; i <= K; i++){
        //cout << i * count_prime_turple[ K / i] << " ";
        count_t += count_prime_turple[K / i];
        ans =  (ans + i * count_prime_turple[ K / i] ) % MOD;
    }
    // cout << "\ncount total : " << count_t << endl;
    // cout << "\n ================= " << endl;
    return ans;
    
}

bool func_to_create(){
    unsigned int N, K;
    cin >> N >> K;
    unsigned int ans = count_turple(N, K);
    cout << ans << endl;
}
unsigned int naive_sum_4(int K){
    std::vector<int> gcd_store;
    for(int i = 0 ; i < K + 1 ; i++){
        gcd_store.push_back(0);
    }
    unsigned int ans = 0;
    for(int a = 1; a <= K ; a++){
        for(int b = 1; b <= K; b++){
            for(int c = 1; c <= K; c++){
                for(int d = 1; d <= K; d++){
                    int g = gcd(a, b, c, d);
                    ans += gcd(a, b, c, d);
                    gcd_store[g] = gcd_store[g] + 1;
                }
            }
        }
    }
    // cout << "gcd count : ";
    // for(int i = 1 ; i < K + 1 ; i++){
    //     cout << gcd_store[i] * i << " " ;
    // }
    // cout << endl;
    return ans;

}

unsigned int naive_sum_5(int K){
    std::vector<int> gcd_store;
    for(int i = 0 ; i < K + 1 ; i++){
        gcd_store.push_back(0);
    }
    unsigned int ans = 0;
    for(int a = 1; a <= K ; a++){
        for(int b = 1; b <= K; b++){
            for(int c = 1; c <= K; c++){
                for(int d = 1; d <= K; d++){
                    for(int e = 1; e <= K ; e++){
                        int g = gcd(a, b, c, d, e);
                        ans += g;
                        gcd_store[g] = gcd_store[g] + 1;
                    }
                }
            }
        }
    }
    // cout << "gcd count : ";
    // for(int i = 1 ; i < K + 1 ; i++){
    //     cout << gcd_store[i] * i << " " ;
    // }
    // cout << endl;
    return ans;

}
unsigned int naive_sum_3(int K){
    unsigned int ans = 0;
    for(int a = 1; a <= K ; a++){
        for(int b = 1; b <= K; b++){
            for(int c = 1; c <= K; c++){
                    ans += gcd(a, b, c);
            }
        }
    }
    return ans;

}
void func_test(){
    int N = 5;
    cout << "testing N " << N << endl;

    // if( ans1 != ans2){
    //     cout << "Found error @ " << K << endl;
    //     cout << ans1 << " vs " << ans2 << endl;
    //     cout << "======================" << endl;
    // }
    
    for(int K = 3; K < 100; K++){
        unsigned int ans1 = count_turple(N, K);
        unsigned int ans2 = naive_sum_5(K);
        if( ans1 != ans2){
            cout << "Found error @ " << K << endl;
            cout << ans1 << " vs " << ans2 << endl;
            cout << "======================" << endl;
        }else{
            cout << "ok" << endl;
        }
        
    }
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /***************************/

    #ifdef DEBUG
    int TEST_CASES = 3;
    while(TEST_CASES--){
    #endif // DEBBUG

    func_to_create();

    #ifdef DEBUG
    }
    #endif // DEBUG

    //func_test();

    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.