Harryxun/stf_run huggingface dataset:
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

#????????????????¨????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
#for i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
#for i in range(n):
#    print(" ".join(map(str, C[i][:])))
for r in C:
    print(' '.join([str(d) for d in r]))

### FIXED CODE ###

n, m, l = (int(i) for i in input().split())
A = []
B = []
C = [[0 for i in range(l)] for j in range(n)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
    #A.append([int(i) for i in input().split()])
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)
    #B.append([int(i) for i in input().split()])
#????????????????¨????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
#for i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
for i in range(n):
    print(" ".join(map(str, C[i][:])))
#for r in C:
#    print(" ".join([str(d) for d in r]))
A,B,K=map(int,input().split())
i=1
count=max(A,B)
while 1:
    if A%i+B%i==0:
        count +=1
    if count=K:
        print(i)
    i-=1
    


### FIXED CODE ###

A,B,K = map(int,input().split())
ans_list=[0]
for i in range(1,min(A,B)+1):
    if A%i==B%i==0:
        ans_list.append(i)
print(ans_list[-K])
from math import gcd

input = __import__('sys').stdin.readline
N, X = map(int, input().split())
l = [*map(int, input().split())]
res = -1

for i in range(N):
    d = abs(l[i] - X)
    
    if res == -1:
        res = d
    else:
        res = gcd(res, d)

print(res)

### FIXED CODE ###

def gcd(a, b):
    if b:
        return gcd(b, a%b)
    else:
        return a

#input = __import__('sys').stdin.readline
N, X = map(int, input().split())
l = list(map(int, input().split()))
res = -1

for i in range(N):
    d = abs(l[i] - X)
    
    if res == -1:
        res = d
    else:
        res = gcd(res, d)

print(res)
n = int(input())
from collections import Counter
#a,b = map(int,input().split())
#L = list(map(int,input().split()))
def pr(n):
    L = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            L.append(i)
            n = n//i
    if n != 1:
        L.append(n)
    return L
dic = {1:1,2:1,3:2,4:2,5:2,6:3,7:3,8:3,9:3,10:4,11:4,12:4,13:4,14:4,15:5,16:5,17:5,18:5,19:5,20:5}
L = pr(n)
#(L)
L = Counter(L)
num = 0
for k,v in L.items():
    if v%2 == 1:
        num +=dic[v]
    else:
        num +=dic[v]
print(num)

### FIXED CODE ###

n = int(input())
from collections import Counter
#a,b = map(int,input().split())
#L = list(map(int,input().split()))
def pr(n):
    L = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            L.append(i)
            n = n//i
    if n != 1:
        L.append(n)
    return L
dic = {1:1,2:1,3:2,4:2,5:2,6:3,7:3,8:3,9:3,10:4,11:4,12:4,13:4,14:4,15:5,16:5,17:5,18:5,19:5,20:5,21:6,22:6,23:6,24:6,25:6,27:6,28:7,29:7,30:7,31:7,32:7,33:7,34:7,35:7,36:8,39:8,40:8}
L = pr(n)
#print(L)
L = Counter(L)
num = 0
for k,v in L.items():
    num +=dic[v]
print(num)
R = int(input())

if R >= 2800:
    print('AGC')
elif R < 1200:
    print('ABC')
else:a
    print('ARC') 

### FIXED CODE ###

R = int(input())

if R >= 2800:
    print('AGC')
elif R < 1200:
    print('ABC')
else:
    print('ARC')
N=int(input())
div=1000000007

primedict= {i:True for i in range(2,N+1)}

for i in range(2,N+1):
        if primedict[i]==True:
                j=2
                while i*j<=N:
                        primedict[i*j]=False
                        j+=1

primelist = [i for i in  range(2,N+1) if primedict[i]==True]

# print(primelist)

primecntdict={p:0 for p in primelist}

for n in range(2,N+1):
        for p in [p for p in primelist if p <= n]:
                while n%p==0:
                        n/=p
                        primecntdict[p]+=1

res=1
for p in primelist:
        res*=primecntdict[p]+1
        res%=div
# print(primecntdict[2])
print(res)


### FIXED CODE ###

#! /usr/bin/python3

A,B,C,D= list(map(int,input().split()))

print(max(A*B, C*D))
N = int(input())
A = list(map(int, input().split(' ')))


B = sorted(list(set(A)), reverse=True)

for i in range(len(B)):
    b = B[i]
    n = A.count(b)
    if n >= 2:
        if n >= 4:
            print(b*b)
            exit()
        elif:
            C = B[i+1:]
            for c in C:
                if  A.count(c) >= 2:
                    print(b*c)
                    exit()

print(0)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split(' ')))

x = 0
y = 0
S = set()

for a in A:
    if a in S:
        if a < x:
            continue
        elif a > y:
            x = y
            y = a
        else:
            x = a
        S.remove(a)
    else:
        S.add(a)

print(x*y)
import numpy as np

def divisors(N):
    return sorted(sum(([*{n, N // n}] for n in range(1, int(N ** 0.5) + 1) if not N % n), []))

def prime_factorize_dict(n):
    d = dict()
    while not n & 1:
        d[2] = d.get(2, 0) + 1
        n >>= 1
    f = 3
    while f * f <= n:
        if not n % f:
            d[f] = d.get(f, 0) + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = d.get(n, 0) + 1
    return d

N = int(input())
count = 0
for n in divisors(N)[1:]:
    M = N
    while not M % n:
        M //= n
    count += M % n == 1
fact_Nm1 = np.array(list(prime_factorize_dict(N - 1).values()), dtype=np.int32)
print(count + np.prod(fact_Nm1 + 1) - 1)

### FIXED CODE ###

import numpy as np

def divisors(N):
    return sorted(sum((list({n, N // n}) for n in range(1, int(N ** 0.5) + 1) if not N % n), []))

def prime_factorize_dict(n):
    d = dict()
    while not n & 1:
        d[2] = d.get(2, 0) + 1
        n >>= 1
    f = 3
    while f * f <= n:
        if not n % f:
            d[f] = d.get(f, 0) + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = d.get(n, 0) + 1
    return d

N = int(input())
count = 0
for n in divisors(N)[1:]:
    M = N
    while not M % n:
        M //= n
    count += M % n == 1
fact_Nm1 = np.array(list(prime_factorize_dict(N - 1).values()), dtype=np.int32)
print(count + np.prod(fact_Nm1 + 1) - 1)
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
num=0
for i in range(N):
  sum=0
  A=[]
  A.append(list(map(int,input().split())))
  for j in range(M):
    sum+=A[j] * B[j]
  if sum+C>0:
    num+=1
print(num)

### FIXED CODE ###

N,M,C=map(int,input().split())
B=list(map(int,input().split()))
num=0
A=[]
for i in range(N):
  A.append(list(map(int,input().split())))
D=[]
for j in range(N):
  sum=0
  D=A[j]
  for k in range(M):
    sum+=B[k]*D[k]
  if sum+C>0:
    num+=1
print(num)
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(N))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l))))

### FIXED CODE ###

N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(s))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))
k = int(input())
l =[1,2,3,4,5,6,7,8,9,19,29,39,49,59,69,79,89,99,199,299,399,499,599,699,799,899,999,1099,1199,1299,1399,1499,1599,1699,1799,1899,1999,2999,3999,4999,5999,6999,7999,8999,9999,10999,11999,12999,13999,14999,15999,16999,17999,18999,19999,20999,21999,22999,23999,24999,25999,26999,27999,28999,29999,39999,49999,59999,69999,79999,89999,99999,109999,119999,129999,139999,149999,159999,169999,179999,189999,199999,209999,219999,229999,239999,249999,259999,269999,279999,289999,299999,309999,319999,329999,339999,349999,359999,369999,379999,389999,399999,499999,599999,699999,799999,899999,999999,1099999,1199999,1299999,1399999,1499999,1599999,1699999,1799999,1899999,1999999,2099999,2199999,2299999,2399999,2499999,2599999,2699999,2799999,2899999,2999999,3099999,3199999,3299999,3399999,3499999,3599999,3699999,3799999,3899999,3999999,4099999,4199999,4299999,4399999,4499999,4599999,4699999,4799999,4899999,4999999,5999999,6999999,7999999,8999999,9999999,10999999,11999999,12999999,13999999,14999999,15999999,16999999,17999999,18999999,19999999,20999999,21999999,22999999,23999999,24999999,25999999,26999999,27999999,28999999,29999999,30999999,31999999,32999999,33999999,34999999,35999999,36999999,37999999,38999999,39999999,40999999,41999999,42999999,43999999,44999999,45999999,46999999,47999999,48999999,49999999,50999999,51999999,52999999,53999999,54999999,55999999,56999999,57999999,58999999,59999999,69999999,79999999,89999999,99999999,109999999,119999999,129999999,139999999,149999999,159999999,169999999,179999999,189999999,199999999,209999999,219999999,229999999,239999999,249999999,259999999,269999999,279999999,289999999,299999999,309999999,319999999,329999999,339999999,349999999,359999999,369999999,379999999,389999999,399999999,409999999,419999999,429999999,439999999,449999999,459999999,469999999,479999999,489999999,499999999,509999999,519999999,529999999,539999999,549999999,559999999,569999999,579999999,589999999,599999999,609999999,619999999,629999999,639999999,649999999,659999999,669999999,679999999,689999999,699999999,799999999,899999999,999999999]
for i in range(k):
    print(l[i])


### FIXED CODE ###

def s(n):
	return sum([ord(x)-ord('0') for x in str(n)])

def r(n):
	return n/s(n)

def f(n):
	d = 10
	m = n
	while d <= n*10:
		n //= d
		n *= d
		n += d-1
		d *= 10
		if(r(n) < r(m)):
			m = n
	return m

n = 1
for _ in range(int(input())):
	print(n)
	n = f(n+1)
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

import numpy as np

N = II()
u_li = []
v_li = []
w_li = []
for i in range(N-1):
    u, v, w = LI()
    u_li.append(u)
    v_li.append(v)
    w_li.append(w)


node_count = max(max(u_li), max(v_li))

mat = np.zeros((node_count,node_count))

for i in range(N-1):
    a = min(u_li[i], v_li[i])
    b = max(u_li[i], v_li[i])
    mat[a-1, b-1] = w_li[i]
mat = mat.astype(int)

color = [None]*N
checked = [False]*N

color[0] = 0
checked[0] = True
queue = [0]

while True:
    i = queue[0]
    for j in mat[i].nonzero():
        if mat[i,j]%2 == 0:
            color[j] = color[i]
        else:
            color[j] = 1 if color[i] == 0 else 0
        queue.append(j)
    queue.pop(0)
    if len(queue) == 0: break

for i in color:
    print(i)



### FIXED CODE ###

import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')


N = II()
u_li = []
v_li = []
w_li = []
for i in range(N-1):
    u, v, w = LI()
    u_li.append(u)
    v_li.append(v)
    w_li.append(w)

# 連結リストを作成。計算量削減のために、距離の情報も持つ。
max_node = max(max(u_li), max(v_li))
neighbor = [[] for i in range(max_node+1)]
for i in range(N-1):
    neighbor[u_li[i]].append((v_li[i], w_li[i]))
    neighbor[v_li[i]].append((u_li[i], w_li[i]))

# 深さ優先探索をしつつ色を塗っていく。
from collections import deque
def depth_first(neighbor, start):
    visited, stack = [False]*(N+1), deque()
    stack.append(start)
    result = [None, 0] + [None]*(N-1)
    while len(stack) > 0:
        next_node = stack.pop()
        if visited[next_node]: continue
        visited[next_node] = True
        for nei in neighbor[next_node]:
            if result[nei[0]] is not None: continue
            if nei[1]%2 == 0:
                result[nei[0]] = result[next_node]
            else:
                result[nei[0]] = (result[next_node]+1)%2
            stack.append(nei[0])
    return result

colors = depth_first(neighbor, 1)

for ans in colors[1:]:
    print(ans)
while 1:
 H,W = map(int, raw_input().split())
 if h == w == 0:
 break
 print '#'*w
 for i in range(h-2):
  if w >= 2:
   print '#'+'.'*(w-2)+'#'
  else:
   print '#'
 print '#'*w

### FIXED CODE ###

while True:
 H, W = map(int, raw_input().split())
 if (H+W) == 0:
  break
 print "#"*W
 for h in range(1, (H-1)):
  print  "#" + ('.'*(W-2)) + "#"
 print "#"*W
 print ""
import math

n = int(input())
arr = list(map(int, input().split()))
lcm = 1
for e in arr:
    lcm = int(lcm * e / math.gcd(lcm, e))
lcm -= 1
res = 0
for e in arr:
    res += lcm % e
print(res)


### FIXED CODE ###

n = int(input())
arr = list(map(int, input().split()))
lcm = 0
for e in arr:
    lcm += e - 1
print(lcm)
INF = int(1e9) + 7

n = int(input())
a = list(map(int, input().split()))
col = [0,0,0]
ans = 1
for i in range(n):
        col[i] +=1
        continue
    c = set(col)
    m = 0
    for j in range(3):
        if c==col[j]:
            m +=1
    ans *= m
    
    for j in range(3):
        if i==col[j]:
            col[j] +=1
            break
        else:
            continue
    ans = ans%INF

print(ans)

### FIXED CODE ###

n = int(input())
s = str(input())
ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            i_pos = s.find(str(i))

            if i_pos == -1:
                continue

            j_pos = s.find(str(j), i_pos+1)

            if j_pos == -1:
                continue

            k_pos = s.find(str(k), j_pos+1)

            if k_pos == -1:
                continue

            ans += 1

print(ans)
H,W=map(int, input().split())
3 7
if(H%2==1 and W%2==1):
    print((W*H-1)/2)
else:
    print(W*H/2)

### FIXED CODE ###

H,W=map(int, input().split())
print(int((H*W-(H%2)*(W%2))/2+(H%2)*(W%2)) if(H!=1 and W!=1) else 1)
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
 
assert K > 2
 
print(114514)

### FIXED CODE ###

input_line = input().split()

num_array = int(input_line[0])
num_equal = int(input_line[1])

input_line = input() # 無視

equalized = 1
i = 0
while equalized < num_array:
    equalized += (num_equal - 1)
    # print(i, equalized)
    i += 1

print(str(i))
import sys

N = int(input())
a = list(map(int,input().split()))
l = []
for i in range(N-1):
    l.append(a[i+1]-a[i])
if any(i<=-2 for i in l):
    print("No")
if 0 in l:
    l.remove(0)
for i in range(len(l)):
    if l[i] == -1 and l[i+1]==-1:
        print("No")
        sys.exit()
print("Yes")

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
l = []
for i in range(N-1):
    if a[i+1]-a[i] != 0:
        l.append(a[i+1]-a[i])
# print(l)
if any(i<=-2 for i in l):
    print("No")
    exit()
# while 0 in l:
#     l.remove(0)
# # print(l)
for i in range(len(l)-1):
    if l[i] == -1 and l[i+1] == -1:
        print("No")
        exit()
print("Yes")
h = S / 3600                                                                                           
m = (S - h*3600) / 60                                                                                  
S = 3598                                                                                               
h = S / 3600                                                                                           
m = (S - h*3600) / 60                                                                                  
s = S - (h * 3600 + m * 60)                                                                            
print "%d:%d:%d" % (h, m, s) 

### FIXED CODE ###

time = raw_input()
time = int(time)
h = time / 3600
m = (time - h * 3600) / 60
s = time - (h * 3600 + m * 60)
print "%d:%d:%d" % (h, m, s)
from collections import Counter
import numpy as np
from pprint import pprint

h, w, m = map(int, input().split())
hw = [list(map(int, input().split())) for _ in range(m)]

grid = [[0] * h for _ in range(w)]

for i in range(m):
    grid[hw[i][1]-1][hw[i][0]-1] = 1


cnt_grid = []
for i in range(w):
    cnt_grid.append(Counter(grid[i]))


cnt_grid_h = 0
max_h = 0
for i in range(w):
    if cnt_grid_h < cnt_grid[i][1]:
        cnt_grid_h = cnt_grid[i][1]
        max_h = i
grid = np.rot90(grid)
grid = grid.tolist()
cnt_grid = []
for i in range(h):
    cnt_grid.append(Counter(grid[i]))

cnt_grid_w = 0
max_w = 0
for i in range(h):
    if cnt_grid_w < cnt_grid[i][1]:
        cnt_grid_w = cnt_grid[i][1]
        max_w = i
max_w = h - max_w - 1

if grid[max_h][max_w] == 1:
    print(cnt_grid_h + cnt_grid_w - 1)
else:
    print(cnt_grid_h + cnt_grid_w)

### FIXED CODE ###

from collections import defaultdict

h, w, m = map(int, input().split())

cnt_h = [0] * h
cnt_w = [0] * w
dic = defaultdict(int)

for _ in range(m):
    h_m, w_m = map(int, input().split())
    cnt_h[h_m - 1] += 1
    cnt_w[w_m - 1] += 1
    dic[(h_m - 1, w_m - 1)] += 1

max_h = max(cnt_h)
max_w = max(cnt_w)

mh = []
mw = []

for i in range(h):
    if max_h == cnt_h[i]:
        mh.append(i)

for i in range(w):
    if max_w == cnt_w[i]:
        mw.append(i)

for i in mh:
    for j in mw:
        if dic[(i, j)] == 0:
            print(max_h + max_w)
            quit()

print(max_h + max_w - 1)
line=input().split()

N=int(line[0])
K=int(line[1])

D=input().rstrip().split()


for i in range(N,10*N+1):
	s=str(i)
	flag=True
    for x in D:
		if x in s:
			flag=False
			break

	if flag:
		print(s)
		break
    
	else:
    	continue

### FIXED CODE ###

line=input().split()
N=int(line[0])
K=int(line[1])
D=input().rstrip().split()

for i in range(N,10*N+1):
 s=str(i)
 flag=True
 for x in D:
  if x in s:
   flag=False
   break

 if flag:
  print(s)
  break
 else:
  continue
N,K=map(int,input().split())
A=list(map(int,input().split()))
hyoutei=[0]*(N+1)
import numpy as np
for i in range(K,N+1):#K学期からN学期までの評定を計算
    hyoutei[i]=np.prod(np.array(A[i-K:i]))##K回目＝1回目ーK回目
    if i>K and hyoutei[i]>hyoutei[i-1]:
        print("Yes")
    elif i>K and hyoutei[i]<=hyoutei[i-1]:
        print("No")

### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
hyoutei=[0]*(N+1)
for i in range(K,N):#K+1-N
    if A[i]/A[i-K]>1:
        print("Yes")
    else:
        print("No")
n,k = map(int,input().split())
s = []
count = 0
last = 1
for i in input():
    if i=='1':
        if last==1:
            count+=1
        else:
            s.append(count)
            count=1
        last = 1
    else:
        if last==0:
            count+=1
        else:
            s.append(count)
            count=1
        last = 0
s.append(count)
if last=='0':
    s.append(0)

k = min(k,len(s)//2)
ans = 0

for j in range(len(s)//2-k+1):
    if j==0:
        now = sum(s[:k*2+1])
        ans = now
    else:
        now = now-s[j*2-1]-s[j*2-2]+s[(j+k)*2]+s[(j+k)*2-1]
        ans = max(ans,now) 
print(ans)

### FIXED CODE ###

#ABC124 D-Handstand
n,k = map(int,input().split())
s = []
count = 0
last = 1
for i in input():
    if i=='1':
        if last==1:
            count+=1
        else:
            s.append(count)
            count=1
        last = 1
    else:
        if last==0:
            count+=1
        else:
            s.append(count)
            count=1
        last = 0
s.append(count)
if last==0:
    s.append(0)

k = min(k,len(s)//2)
ans = 0

for j in range(len(s)//2-k+1):
    if j==0:
        now = sum(s[:k*2+1])
        ans = now
    else:
        now = now-s[j*2-1]-s[j*2-2]+s[(j+k)*2]+s[(j+k)*2-1]
        ans = max(ans,now) 
print(ans)
l = [i for i in range(1,10)]
for i in l:
  for j in l:
    print(str(i)+ 'x' + str(j) + '=' str(i*j))

### FIXED CODE ###

for i in range(1,10):
 for j in range(1,10):
  print(str(i) + "x" + str(j) + "=" + str(i * j))
N = int(input())
D = list(map(int, input().split()))
M = 998244353
from collections import Counter

if D[0] != 0:
    print(0)
    exit(0)

cd = Counter(D)
if cd[0] != 1:
    print(0)
    exit(0)

tmp = sorted(cd.items(), key=lambda x: x[0])

ans = 1
# for kx in range(1, max(D)+1):
for kx in range(2, len(tmp)+1):
    __, p = tmp[kx-1]
    _, v = tmp[kx]
    # p = cd[kx-1]
    # v = cd[kx]
    # print("{}^{}".format(p, v))
    while v > 0:
        ans *= p
        ans %= M
        v -= 1
# print(cd)

# for kx in range(1, max(D)+1):
#     ans *= pow(cd[kx-1], cd[kx],M)
#     ans %= M

print(ans)

### FIXED CODE ###

N = int(input())
D = list(map(int, input().split()))
M = 998244353
from collections import Counter

if D[0] != 0:
    print(0)
    exit(0)

cd = Counter(D)
if cd[0] != 1:
    print(0)
    exit(0)

tmp = sorted(cd.items(), key=lambda x: x[0])

ans = 1


for kx in range(1, max(D)+1):
    ans *= pow(cd[kx-1], cd[kx],M)
    ans %= M

print(ans)
import itertools
import math

N, M, R = map(int, input().split())
r = list(map(int, input().split()))

adj = [[math.inf]*(N+1) for _ in range(N+1)]

for _ in range(M):
    A, B, C = map(int, input().split())
    adj[A][B] = min(adj[A][B], C)
    adj[B][A] = min(adj[B][A], C)

res = math.inf

for k in range(1, N+1):
    for i in range(1, N+1):
        for j in range(1, N+1):
            adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j])

for perm in itertools.permutations(r):
    best = 0
    for x, y in zip(perm, perm[1:]):
        best += adj[x][y]
    res = min(res, best)

print(res)

### FIXED CODE ###

import itertools, math

N, M, R = map(int, input().split())
r = list(map(int, input().split()))

adj = [[float('inf')] * (N + 1) for _ in range(N + 1)]

for m in range(M):
    A, B, C = map(int, input().split())
    adj[A][B] = min(adj[A][B], C)
    adj[B][A] = min(adj[B][A], C)

res = float('inf')

for k in range(1, N + 1):
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j])

for perm in itertools.permutations(r):
    best = 0
    for x, y in zip(perm, perm[1:]):
        best += adj[x][y]
    res = min(res, best)

print(res)
import math

N, M, X = map(int, input().split(' '))
A = list(map(int, input().split(' ')))

pits = []

cost = 0

for i in range(0, N+1):
    pits.append(i)

half = int(len(pits) / 2)


if X == half:
    cost_r = 0
    cost_l = 0
    for a in A:
        # 右側
        if X < a:
            cost_r += 1
        # 左側
        if X > a:
            cost_l += 1
    cost = min(cost_l, cost_r)
elif half < X:
    for a in A:
        if X < a:
            count += 1
else:
    for a in A:
        if X > a:
            count += 1

print(cost)


### FIXED CODE ###

N, M, X = map(int, input().split(' '))
A = list(map(int, input().split(' ')))

r_count = 0
l_count = 0

tmp_1 = X
tmp_2 = X


while tmp_1 != N:
    tmp_1 += 1
    if tmp_1 in A:
        r_count += 1

while tmp_2 != 0:
    tmp_2 -= 1
    if tmp_2 in A:
        l_count += 1


res = min(l_count, r_count)
print(res)
n,a,b = map(int,input().split())

ans = "b"*a
count = len(ans)
switch = 0
while count < n:
    if switch == 0:
        count += b
        ans += "r"*b
        switch = 1
    else:
        count+= a
        ans += "b" *a
        switch = 0
print(ans[:n].count("b"))

### FIXED CODE ###

N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)
|ab|,|bc|,|ca|=map(int,input().split())
print((|ab|*|bc|)//2)

### FIXED CODE ###

a,b,c=map(int,input().split())

print((a*b)//2)