Language: C

#![allow(unused_macros)]

// cf. [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita](https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8)
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:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::collections::HashMap;
fn main() {
    input! {
        K: usize,
    }
    let mut ans = 0;
    //let mut memo = HashMap::new();
    for a in 1..=K {
        for b in 1..=K {
            for c in 1..=K {
                ans += gcd(a as u64, gcd(b as u64, c as u64));
                //let (a, b, c) = {
                //let mut slice = [a, b, c];
                //slice.sort();
                //(slice[0] as u64, slice[1] as u64, slice[2] as u64)
                //};
                //ans += gcd3(a, b, c, &mut memo);
            }
        }
    }
    println!("{}", ans);
}

fn gcd3(a: u64, b: u64, c: u64, memo: &mut HashMap<(u64, u64, u64), u64>) -> u64 {
    if memo.contains_key(&(a, b, c)) {
        return *memo.get(&(a, b, c)).unwrap();
    }

    let ans = gcd(a, gcd(b, c));
    memo.insert((a, b, c), ans);
    ans
}

pub fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}


Compiler output:
main.c:1:2: error: invalid preprocessing directive #!
    1 | #![allow(unused_macros)]
      |  ^
main.c:4:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '!' token
    4 | macro_rules! input {
      |            ^
main.c:25:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '!' token
   25 | macro_rules! input_inner {
      |            ^
main.c:35:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '!' token
   35 | macro_rules! read_value {
      |            ^
main.c:41:10: error: too many decimal points in number
   41 |         (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
      |          ^~~~~~~
main.c:57:1: error: unknown type name 'use'
   57 | use std::collections::HashMap;
      | ^~~
main.c:57:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '::' token
   57 | use std::collections::HashMap;
      |        ^~
main.c:58:1: error: unknown type name 'fn'
   58 | fn main() {
      | ^~
main.c: In function 'main':
main.c:59:5: error: 'input' undeclared (first use in this function); did you mean 'int'?
   59 |     input! {
      |     ^~~~~
      |     int
main.c:59:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:59:10: error: expected ';' before '!' token
   59 |     input! {
      |          ^
      |          ;
main.c:64:9: error: expected '(' before 'a'
   64 |     for a in 1..=K {
      |         ^
      |         (
main.c:64:9: error: 'a' undeclared (first use in this function)
main.c:64:14: error: too many decimal points in number
   64 |     for a in 1..=K {
      |              ^~~
main.c:65:18: error: too many decimal points in number
   65 |         for b in 1..=K {
      |                  ^~~
main.c:66:22: error: too many decimal points in number
   66 |             for c in 1..=K {
      |                      ^~~
main.c: At top level:
main.c:80:1: error: unknown type name 'fn'
   80 | fn gcd3(a: u64, b: u64, c: u64, memo: &mut HashMap<(u64, u64, u64), u64>) -> u64 {
      | ^~
main.c:80:10: error: expected ')' before ':' token
   80 | fn gcd3(a: u64, b: u64, c: u64, memo: &mut HashMap<(u64, u64, u64), u64>) -> u64 {
      |          ^
      |          )
main.c:90:1: error: unknown type name 'pub'
   90 | pub fn gcd(a: u64, b: u64) -> u64 {
      | ^~~
main.c:90:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gcd'
   90 | pub fn gcd(a: u64, b: u64) -> u64 {
      |        ^~~