Language: C

use std::cmp;
use std::collections::BinaryHeap; // 優先度付きキュー
use std::collections::HashMap; // 連想配列
use std::collections::HashSet; // 連想配列 キーのみ
use std::collections::VecDeque; // キュー or スタック
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: u64,
        k: usize
    }

    let mut ans = 0;
    let mut gcd_array = vec![0; k + 1];

    for i in (1..k + 1).rev() {
        let divisor = (k / i) as u64;
        gcd_array[i] = power_mod(divisor, n, LARGE_PRIME);
        let mut multiple = 2;
        while i * multiple <= k {
            gcd_array[i] += LARGE_PRIME;
            gcd_array[i] -= gcd_array[i * multiple];
            multiple += 1;
        }
        gcd_array[i] %= LARGE_PRIME;

        ans += gcd_array[i] * i as u64;
    }
    ans %= LARGE_PRIME;

    println!("{}", ans);
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet
fn power_mod(base: u64, exp: u64, modulo: u64) -> u64 {
    if exp == 0 {
        return 1;
    } else if exp & 1 == 0 {
        return (power_mod(base, exp / 2, modulo) % modulo).pow(2) % modulo;
    } else {
        return power_mod(base, exp - 1, modulo) % modulo * base % modulo;
    }
}

fn inverse_mod(element: u64, modulo: u64) -> u64 {
    // フェルマーの小定理からpが素数なら a^(p-1) = 1
    // よってa*a^(p-2) = 1 より a^(p-2)がaの逆元
    power_mod(element, modulo - 2, modulo) % modulo
}

fn combination_mod(m: u64, n: u64, modulo: u64) -> u64 {
    // m C n = m! / ( n! * (m - n)! )
    //       = m*(m-1)*(m-2)*...*(m-n+1)/n!
    //       = m*(m-1)*(m-2)*...*(m-n+1) * (n!)^-1
    let mut numerator = 1;
    for i in 0..n {
        numerator *= m - i;
        numerator %= modulo;
    }

    // n!
    let mut element = 1;
    for j in 1..(n + 1) {
        element *= j;
        element %= modulo;
    }
    numerator * inverse_mod(element, modulo) % modulo
}


Compiler output:
main.c:1:1: error: unknown type name 'use'
    1 | use std::cmp;
      | ^~~
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '::' token
    1 | use std::cmp;
      |        ^~
main.c:2:1: error: unknown type name 'use'
    2 | use std::collections::BinaryHeap; // 優先度付きキュー
      | ^~~
main.c:2:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '::' token
    2 | use std::collections::BinaryHeap; // 優先度付きキュー
      |        ^~
main.c:3:1: error: unknown type name 'use'
    3 | use std::collections::HashMap; // 連想配列
      | ^~~
main.c:3:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '::' token
    3 | use std::collections::HashMap; // 連想配列
      |        ^~
main.c:4:1: error: unknown type name 'use'
    4 | use std::collections::HashSet; // 連想配列 キーのみ
      | ^~~
main.c:4:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '::' token
    4 | use std::collections::HashSet; // 連想配列 キーのみ
      |        ^~
main.c:5:1: error: unknown type name 'use'
    5 | use std::collections::VecDeque; // キュー or スタック
      | ^~~
main.c:5:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '::' token
    5 | use std::collections::VecDeque; // キュー or スタック
      |        ^~
main.c:6:1: error: unknown type name 'use'
    6 | use std::io::Read;
      | ^~~
main.c:6:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '::' token
    6 | use std::io::Read;
      |        ^~
main.c:7:1: error: unknown type name 'use'
    7 | use std::usize::MAX;
      | ^~~
main.c:7:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '::' token
    7 | use std::usize::MAX;
      |        ^~
main.c:9:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '!' token
    9 | macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
      |            ^
main.c:10:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '!' token
   10 | macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
      |            ^
main.c:11:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '!' token
   11 | macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}
      |            ^
main.c:11:133: error: too many decimal points in number
   11 | macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}
      |                                                                                                                                     ^~~~~~~
main.c:11:400: error: too many decimal points in number
   11 | macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}
      |                                                                                                                                                                                                                                                                                                                                                                                                                ^~~~~~
main.c:13:1: error: unknown type name 'fn'
   13 | fn solve() {
      | ^~
main.c: In function 'solve':
main.c:14:5: error: 'input' undeclared (first use in this function); did you mean 'int'?
   14 |     input! {
      |     ^~~~~
      |     int
main.c:14:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:10: error: expected ';' before '!' token
   14 |     input! {
      |          ^
      |          ;
main.c:20:5: error: unknown type name 'let'
   20 |     let mut gcd_array = vec![0; k + 1];
      |     ^~~
main.c:20:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gcd_array'
   20 |     let mut gcd_array = vec![0; k + 1];
      |             ^~~~~~~~~
main.c:20:33: error: 'k' undeclared (first use in this function)
   20 |     let mut gcd_array = vec![0; k + 1];
      |                                 ^
main.c:20:38: error: expected ';' before ']' token
   20 |     let mut gcd_array = vec![0; k + 1];
      |                                      ^
      |                                      ;
main.c:20:38: error: expected statement before ']' token
main.c:22:9: error: expected '(' before 'i'
   22 |     for i in (1..k + 1).rev() {
      |         ^
      |         (
main.c:22:9: error: 'i' undeclared (first use in this function)
main.c:22:15: error: too many decimal points in number
   22 |     for i in (1..k + 1).rev() {
      |               ^~~~
main.c:37:5: error: 'println' undeclared (first use in this function)
   37 |     println!("{}", ans);
      |     ^~~~~~~
main.c:37:12: error: expected ';' before '!' token
   37 |     println!("{}", ans);
      |            ^
      |            ;
main.c: At top level:
main.c:40:1: error: unknown type name 'fn'
   40 | fn main() {
      | ^~
main.c: In function 'main':
main.c:41:5: error: unknown type name 'let'
   41 |     let thd = std::thread::Builder::new().stack_size(104_857_600);
      |     ^~~
main.c:41:15: error: 'std' undeclared (first use in this function)
   41 |     let thd = std::thread::Builder::new().stack_size(104_857_600);
      |               ^~~
main.c:41:18: error: expected ',' or ';' before '::' token
   41 |     let thd = std::thread::Builder::new().stack_size(104_857_600);
      |                  ^~
main.c:41:54: error: invalid suffix "_857_600" on integer constant
   41 |     let thd = std::thread::Builder::new().stack_size(104_857_600);
      |                                                      ^~~~~~~~~~~
main.c:42:8: error: request for member 'spawn' in something not a structure or union
   42 |     thd.spawn(|| solve()).unwrap().join().unwrap();
      |        ^
main.c:42:15: error: expected expression before '||' token
   42 |     thd.spawn(|| solve()).unwrap().join().unwrap();
      |               ^~
main.c: At top level:
main.c:55:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
   55 | const LARGE_PRIME: u64 = 1_000_000_007;
      |                  ^
main.c:55:26: error: invalid suffix "_000_000_007" on integer constant
   55 | const LARGE_PRIME: u64 = 1_000_000_007;
      |                          ^~~~~~~~~~~~~
main.c:58:1: error: unknown type name 'fn'
   58 | fn power_mod(base: u64, exp: u64, modulo: u64) -> u64 {
      | ^~
main.c:58:18: error: expected ')' before ':' token
   58 | fn power_mod(base: u64, exp: u64, modulo: u64) -> u64 {
      |                  ^
      |                  )
main.c:68:1: error: unknown type name 'fn'
   68 | fn inverse_mod(element: u64, modulo: u64) -> u64 {
      | ^~
main.c:68:23: error: expected ')' before ':' token
   68 | fn inverse_mod(element: u64, modulo: u64) -> u64 {
      |                       ^
      |                       )
main.c:74:1: error: unknown type name 'fn'
   74 | fn combination_mod(m: u64, n: u64, modulo: u64) -> u64 {
      | ^~
main.c:74:21: error: expected ')' before ':' token
   74 | fn combination_mod(m: u64, n: u64, modulo: u64) -> u64 {
      |                     ^
      |                     )
main.c:79:14: error: too many decimal points in number
   79 |     for i in 0..n {
      |              ^~~~
main.c:86:14: error: too many decimal points in number
   86 |     for j in 1..(n + 1) {
      |              ^~~