Language: C

import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, gcd
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# ここから書き始める
k = int(input())
ans = 0
for i in range(1, k + 1):
    for j in range(1, k + 1):
        for l in range(1, k + 1):
            # print("i =", i)
            # print("j =",j)
            # print("l =", l)
            ans += gcd_list([i, j, l])   
print(ans)

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import sys
      | ^~~~~~
main.c:2:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'import'
    2 | import heapq
      | ^~~~~~
main.c:2:1: error: unknown type name 'import'
main.c:13:3: error: invalid preprocessing directive #UnionFind
   13 | # UnionFind
      |   ^~~~~~~~~
main.c:58:5: error: unknown type name 'def'
   58 |     def __str__(self):
      |     ^~~
main.c: In function '__str__':
main.c:58:22: error: expected declaration specifiers before ':' token
   58 |     def __str__(self):
      |                      ^
main.c:59:26: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   59 |         return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      |                          ^~~~~~~~
main.c:61:3: error: invalid preprocessing directive #\U000030c0\U000030a4\U000030af\U000030b9\U000030c8\U000030e9
   61 | # ダイクストラ
      |   ^~~~~~~~~~~~
main.c:63:6: error: invalid preprocessing directive #\U000059cb\U000070b9s\U0000304b\U00003089\U00005404\U00009802\U000070b9\U00003078\U0000306e\U00006700\U000077ed\U00008ddd\U000096e2
   63 |     #始点sから各頂点への最短距離
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:65:23: error: stray '#' in program
   65 |     used = [True] * n #True:未確定
      |                       ^
main.c:73:10: error: invalid preprocessing directive #\U0000307e\U00003060\U00004f7f\U0000308f\U0000308c\U00003066\U0000306a\U00003044\U00009802\U000070b9\U0000306e\U00004e2d\U0000304b\U00003089\U00006700\U00005c0f\U0000306e\U00008ddd\U000096e2\U0000306e\U00003082\U0000306e\U00003092\U000063a2\U00003059
   73 |         #まだ使われてない頂点の中から最小の距離のものを探す
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:84:3: error: invalid preprocessing directive #\U00007d20\U000056e0\U00006570\U00005206\U000089e3
   84 | # 素因数分解
      |   ^~~~~~~~~~
main.c:104:3: error: "2数の最小公倍数" after # is not a positive integer
  104 | # 2数の最小公倍数
      |   ^~~~~~~~~~~~~~~
main.c:108:3: error: invalid preprocessing directive #\U000030ea\U000030b9\U000030c8\U0000306e\U00008981\U00007d20\U0000306e\U00006700\U00005c0f\U0000516c\U0000500d\U00006570
  108 | # リストの要素の最小公倍数
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:112:3: error: invalid preprocessing directive #\U000030ea\U000030b9\U000030c8\U0000306e\U00008981\U00007d20\U0000306e\U00006700\U00005927\U0000516c\U00007d04\U00006570
  112 | # リストの要素の最大公約数
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:116:3: error: invalid preprocessing directive #\U00003053\U00003053\U0000304b\U00003089\U000066f8\U0000304d\U000059cb\U00003081\U0000308b
  116 | # ここから書き始める
      |   ^~~~~~~~~~~~~~~~~~
main.c:122:15: error: invalid preprocessing directive #print
  122 |             # print("i =", i)
      |               ^~~~~
main.c:123:15: error: invalid preprocessing directive #print
  123 |             # print("j =",j)
      |               ^~~~~
main.c:124:15: error: invalid preprocessing directive #print
  124 |             # print("l =", l)
      |               ^~~~~
main.c:58:9: error: type of 'self' defaults to 'int' [-Wimplicit-int]
   58 |     def __str__(self):
      |         ^~~~~~~