Harryxun/stf_run huggingface dataset:
N, M = map(int, input().split())
zahyou = list(map(int,input().split()))
zahyou.sort()
difference = []
ans = 0

if M == 1:
    ans = 0
else:
    for i in range (M-1):
        difference.append(zahyou[i+1] - zahyou[i])
    difference.append(0)
    difference.sort()
    difference.reverse()
    length = zahyou[-1] - zahyou[0]
    ans = int(length)
    for i in range (N):
        ans -= difference[i-1]

print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
zahyou = list(map(int,input().split()))
zahyou.sort()
difference = []
ans = 0

if N >= M:
    ans = 0
else:
    for i in range (M-1):
        difference.append(zahyou[i+1] - zahyou[i])
    difference.sort()
    ans = sum(difference[:M-N])

print(ans)
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]

A = [-1] * N
ok= True
for s, c in SC:
    i = s-1
    if A[i] != -1 and A[i] != c:
        ok = False
        break
    A[i] = c
if N > 1 and A[0]==0:
    ok = False
if ok:
    for i in range(N):
        if A[i] == -1:
            if i == 0 && N != 1:
                A[i] = 1
            else:
                A[i] = 0
if ok:
    print(''.join(map(str, A)))
else:    
    print(-1)

### FIXED CODE ###

N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]

A = [-1] * N
ok= True
for s, c in SC:
    i = s-1
    if A[i] != -1 and A[i] != c:
        ok = False
        break
    A[i] = c
if N > 1 and A[0]==0:
    ok = False
if ok:
    for i in range(N):
        if A[i] == -1:
            if i == 0 and N != 1:
                A[i] = 1
            else:
                A[i] = 0
if ok:
    print(''.join(map(str, A)))
else:    
    print(-1)
import sys, os, re
from pprint import pprint
from math import sin, cos, sqrt, radians

n, m = list(map(int, sys.stdin.readline().strip().split()))
g = [[] for x in range(n)]

for i in range(n):
    x, y = list(map(int, sys.stdin.readline().strip().split()))
    x -= 1
    y -= 1

ans = {0: -1}

while len(ans) < n:
    flag = False
    for k, v in ans.items():
        for node in g[k]:
            if node not in ans:
                ans[node] = k
                flag = True
    if flag == False:
        break

print("Yes")

    

### FIXED CODE ###


import sys, os, re
from pprint import pprint
from math import sin, cos, sqrt, radians

n, m = list(map(int, sys.stdin.readline().strip().split()))
g = [[] for x in range(n)]

for i in range(m):
    x, y = map(int, sys.stdin.readline().strip().split())
    x -= 1
    y -= 1
    g[x].append(y)
    g[y].append(x)

if [] in g:
    print("No")
    exit(0)

ans = {0: -1}
tmp = [0]

while len(ans) < n:
    tmp_next = []
    for k in tmp:
        for node in g[k]:
            if node not in ans:
                ans[node] = k
                tmp_next.append(node) 
                flag = True

        tmp = tmp_next
        if flag == False:
            break

    """
    flag = False    
    for k, v in list(ans.items()):
        for node in g[k]:
            if node not in ans:
                ans[node] = k
                flag = True
    if flag == False:
        break
    """

print("Yes")
for i in range(1, n):
    print(ans[i]+1)
a,b,c=input().split()
if a=b=c:
  print(No)
else:
  print(Yes)
  


### FIXED CODE ###

a,b,c=map(int,input().split())
if a==b and b==c and c==a:
  print("No")
elif a!=b and b!=c and c!=a:
  print("No")
else:
  print("Yes")
weight = input().split(" ")
if weight[0] + weight[1] > weight[2] + weight[3]:
  print("Left")
elif weight[0] + weight[1] = weight[2] + weight[3]:
  print("Balanced")
else:
  print("Right")

### FIXED CODE ###

weight = input().split(" ")
if int(weight[0]) + int(weight[1]) > int(weight[2]) + int(weight[3]):
  print("Left")
elif int(weight[0]) + int(weight[1]) == int(weight[2]) + int(weight[3]):
  print("Balanced")
else:
  print("Right")
import sys

input = sys.stdin.readline

n_k = list(map(int, input().split()))
n = n_k[0]
k = n_k[1]
a = list(map(int, input().split()))
a_pos = list(filter(lambda v: v >= 0, a))
a_neg = list(filter(lambda v: v < 0, a))

a_pos.sort(reverse=True)
a_neg.sort()

ans = 1
if n == k:
    for a_i in a:
        ans = ans * a_i % 100000007
elif len(a_pos) == 0 and k % 2 == 1:
    for i in reversed(range(len(a_neg) - k, len(a_neg))):
        ans = ans * a_neg[i] % 100000007
else:
    i_p = 0
    i_n = 0
    i = 0
    while i < k:
        if i == k - 1 or i_n+1 >= len(a_neg) or a_pos[i_p] * a_pos[i_p+1] > a_neg[i_n] * a_neg[i_n+1]:
            ans = ans * a_pos[i_p] % 1000000007
            i_p += 1
            i += 1
        else:
            ans = ans * a_neg[i_n] % 1000000007 * a_neg[i_n+1] % 1000000007
            i_n += 2
            i += 2
print(ans)


### FIXED CODE ###

import sys

input = sys.stdin.readline

n_k = list(map(int, input().split()))
n = n_k[0]
k = n_k[1]
a = list(map(int, input().split()))
a_pos = list(filter(lambda v: v >= 0, a))
a_neg = list(filter(lambda v: v < 0, a))

a_pos.sort(reverse=True)
a_neg.sort()

mod = 10**9+7

ans = 1
if n == k:
    for a_i in a:
        ans = ans * a_i % mod
elif len(a_pos) == 0 and k % 2 == 1:
    for i in reversed(range(len(a_neg) - k, len(a_neg))):
        ans = ans * a_neg[i] % mod
else:
    i_p = 0
    i_n = 0
    i = 0
    while i < k:
        if i_p < len(a_pos) and (i == k - 1 or i_n+1 >= len(a_neg) or a_pos[i_p] * (a_pos[i_p+1] if i_p+1 < len(a_pos) else 1) > a_neg[i_n] * a_neg[i_n+1]):
            ans = ans * a_pos[i_p] % mod
            i_p += 1
            i += 1
        else:
            ans = ans * a_neg[i_n] % mod * a_neg[i_n+1] % mod
            i_n += 2
            i += 2
print(ans)
#92

li = [int(input().rstrip()) for x in range(4)]

print(min(A+C, A+D, B+C, B+D))

### FIXED CODE ###

#92

li = [int(input().rstrip()) for x in range(4)]

print(min(li[0]+li[2], li[0]+li[3], li[1]+li[2], li[1]+li[3]))
n = int(input()
d, x = map(int, input().split())
a = [int(input()) for in _ range(n)]

count = x

for i in range(n):
    ai = a[i]
    for j in range(1, d+1, ai):
        count += 1

print(count)

### FIXED CODE ###

n = int(input())
d, x = map(int, input().split())
a = [int(input()) for _ in range(n)]

count = x

for i in range(n):
    ai = a[i]
    for j in range(1, d+1, ai):
        count += 1

print(count)
# D - ModSum
import numpy as np
N = int(input())

if N > 1:
    N_1 = np.array(list(range(1, N+1)))
    P_1 = np.array(list(range(2, N+1)))
    P_1 = np.append(P_1, 1)
    ans = sum(N_1 % P_1)
    print(ans)
else:
    print(0)

### FIXED CODE ###

# D - ModSum
N = int(input())

ans = (N*(N-1))//2
print(int(ans))
N, M = map(int, input().split())
E = [[] for _ in range(N)]
for _ in range(M):
  A, B = map(int, input().split())
  E[A-1] += [B-1]
  E[B-1] += [A-1]

ans = [-1]*N
T = [0]
while len(T)>0:
  P = T
  T = []
  for x in P:
    for e in E[x]:
      if ans[e]==-1:
        T += [e]
        ans[e] = x

print "Yes"
for a in ans[1:]:
  print(a+1)


### FIXED CODE ###

N, M = map(int, input().split())
E = [[] for _ in range(N)]
for _ in range(M):
  A, B = map(int, input().split())
  E[A-1] += [B-1]
  E[B-1] += [A-1]

ans = [-1]*N
T = [0]
while len(T)>0:
  P = T
  T = []
  for x in P:
    for e in E[x]:
      if ans[e]==-1:
        T += [e]
        ans[e] = x

print("Yes")
for a in ans[1:]:
  print(a+1)
import sys
sys.setrecursionlimit(100000)
from collections import defaultdict
edges = []
to = defaultdict(list) # 1から到達できるか
ot = defaultdict(list) # Nから到達できるか
N, M, P = map(int, input().split())
visited_toN = [False]*(N+1)
visited_fm1 = [False]*(N+1)    
for i in range(M):
    a,b,c = map(int, input().split())
    a -= 1
    b -= 1
    edges.append((a,b,-c+P))
    to[a].append(b)
    ot[b].append(a)

def dfs(v):
    global visited_fm1
    if visited_fm1[v]:return
    visited_fm1[v] = True
    for nxt in to[v]:
        dfs(nxt)
    
def dfs_r(v):
    global visited_toN
    if visited_toN[v]:return
    visited_toN[v] = True
    for nxt in ot[v]:
        dfs_r(nxt)
        
dfs(0)
dfs_r(N-1)
is_ok = []

for s, t in zip(visited_fm1,visited_toN):
    is_ok.append(s and t)


# BellmanFord    
INF = 10 ** 18
def bellmanFord(n, edges, s, g):
    """
    input
        n : 頂点の数
        edges : (始点, 終点, コスト)のリスト
        s : 探索の始点
        g : 探索の終点
    output
        sから各点への最短距離
    """    
    d = [INF] * n
    d[s] = 0
    cnt = 0
    while True:
        update = False
        for a, b, c in edges:
            if not is_ok[a]:continue
            if not is_ok[b]:continue
            if d[a] != INF and d[b] > d[a] + c:
                d[b] = d[a] + c
                update = True
        if not update:
            break
        cnt += 1
        # 負閉路の存在をチェック
        if cnt > n:
            print(-1)
            exit()
        # print(d,cnt)
    return d[g]



ans = bellmanFord(N,edges,0,N-1)
print(max(0,-ans))


### FIXED CODE ###

N = int(input())
As = list(map(int, input().split()))
from itertools import accumulate
acc = list(accumulate(As))
s = sum(As)
mn = 10**10
for i,x in enumerate(acc[:-1]):
    y = s - x
    if mn >= abs(x-y):
        mn = abs(x-y)
print(mn)
N = int(input())
S = int(input())

def f(B, N):
    X, res = N, 0
    while 0 < X:
        res += X % B
        X //= B
    return res


if N == S:
    print(N + 1)
    exit()

for i in range(2, N):
    if N < i * i: break
    if f(i, N) == S:
        print(i)
        exit()

for i in range(1, N):
    if N < i * i: break
    b = (N - S) // i + 1
    if f(b, N) == S:
        print(b)
        exit()

print(-1)

### FIXED CODE ###

import math

N = int(input())
S = int(input())

def f(B, N):
    X, res = N, 0
    while 0 < X:
        res += X % B
        X //= B
    return res


if N == S:
    print(N + 1)
    exit()

i = 2
while i * i <= N:
    if f(i, N) == S:
        print(i)
        exit()
    i += 1

sqrtN = math.floor(math.sqrt(N))
i = 1
ans = []
while i * i < N:
    if (N - S) % i != 0:
        i += 1
        continue
    b = (N - S) // i + 1
    if sqrtN < b and f(b, N) == S:
        ans.append(b)
    i += 1

print(-1 if len(ans) == 0 else min(ans))
input_line = input()
b = int(input_line)
a = (1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
a_list = list(a)
print(a_list[b])

### FIXED CODE ###

input_line = input()
b = int(input_line)
a = (1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
a_list = list(a)
print(a_list[b-1])
N, M = map(int, input().split())
status = [True]*(N+2)
for _ in range(M):
    status[int(input())] = False

dp = [0]*(N+2)
dp[0] = 1
for i in range(N):
    if status[i+1]:
        dp[i+1] += dp[i]
    if status[i+2]:
        dp[i+2] += dp[i]
print(dp[N])


### FIXED CODE ###

P, Q, R = map(int, input().split())
print(min(P+Q, Q+R, R+P))
import math
def gcd(a, b):
	if a < b:
		a, b = b, a
	if b == 0:
		return a
	c = a % b
	return gcd(b, c)

n = int(input())
a = list(map(int,input().split()))
gcds = []

maxt = 0
for i in range(n):
	b = a[0:i]
	b += (a[i+1:n])
	tmp = b[0]

	for bi in b[1::]:
		tmp = math.gcd(tmp,bi)
		
	if maxt < tmp:
		maxt = tmp
 
print (maxt)

### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


n = int(input())
a = list(map(int, input().split()))

l = [0]*(n+2) # l(i) = A1, A2, ..., A(i-1)のgcd
r = [0]*(n+2) # r(i) = Ai, A(i+1), ..., A(n)のgcd

for i in range(n):
	l[i+1] = gcd(l[i],a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i+1],a[i])

ext = [0] * n
for i in range(n):
	ext[i] = gcd(l[i],r[i+1])

print (max(ext))
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
if m%n>10000:
  for i in range(1,n):
    if m%i==0 and is_prime(i) and is_prime(m//i) and (i==1 or m//i<n):
      print('1')
      exit()
for i in range(n,m+1):
  if i==m:
    print(1)
    break
  if m%i==0:
    print(m//i)
    break
  if m%(m-i+1)==0
    print(m-i+1)
    break


### FIXED CODE ###

import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
for i in range(1,n):
  if m%i==0 and (is_prime(i) or i==1) and is_prime(m//i) and (i==1 or m//i<n):
    print('1')
    exit()
for i in range(n,m+1):
  if i==m:
    print(1)
    break
  if m%i==0:
    print(m//i)
    break
  if m-i-n>0 and m%(m-i-n)==0 and m//(m-i-n)>n:
    print(m-i-n)
    break
from decimal import Decimal
import math
a,b,c=map(int,input().split())
if Demical(str(a))+Demical(str(b))+Decimal(str(2*math.sqrt(a*b)))<Demical(str(c)):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

from decimal import Decimal
import math
a,b,c=map(int,input().split())
if c-a-b>0 and 4*a*b<(c-a-b)**2:
  print("Yes")
else:
  print("No")
from math import gcd
n, m = map(int, input().split())
if m % n == 0:
    print(m // n)
else:
    gcd = m // n
    for i in range(gcd, 0, -1):
        if m % i == 0:
            j = m // gcd
            if j >= n:
                print(i)
                exit()


### FIXED CODE ###

import math
n, m = map(int, input().split())
root_m = int(math.sqrt(m))
ans = 1
for a in range(1, root_m):
    # print(a, ans)
    if m % a == 0:
        b = m // a
        if a * n <= m:
            ans = max(ans, a)
        if b * n <= m:
            ans = max(ans, b)
print(ans)
R = int(input())
G = int(input())
B = int(input())

N = int(input())

ans = int(0)
x = int(N//R)
y = int(N//G)
z = int(N//B)

for i in range(x+1):
    for j in range(y+1) :
        s = N-R*i-G*j
        if s%B==0 and s>=0 : ans +=1

print(ans)

### FIXED CODE ###

R,G,B,N = map(int, input().split())

ans = int(0)
x = int(N//R)

for i in range(x+1):
    t = N-i*R
    y = int(t//G)
    for j in range(y+1) :
        s = int(t-G*j)
        if s%B==0 : ans +=1

print(ans)
import sys

def S(): return sys.stdin.readline().rstrip()

A,B = map(int,S().split())

def f(n):  # 0からnまでのxor
    res = 0
    while n % 4 != 3:
        res ^= n
        n -= 1

print(f(B) ^ f(A-1))

### FIXED CODE ###

import sys

def S(): return sys.stdin.readline().rstrip()

A,B = map(int,S().split())

def f(n):  # 0からnまでのxor
    res = 0
    for i in range(41):  # 2**iの位
        if i == 0:
            res += ((n+1)//2) % 2
        else:
            a = n - ((n >> (i+1)) << (i+1))
            if a < 2**i or a % 2 == 1:
                continue
            else:
                res += 1 << i
    return res

print(f(B) ^ f(A-1))
n = int(x)
if n % 2 == 1:
  ans = 0
else:
  ans = int(n // 10) + int(n // 50) + int(n // 250)
print(ans)

### FIXED CODE ###

n = int(input())
if n == 0:
  ans = 0
elif n % 2 == 1:
  ans = 0
else:
  pwr = 10
  ans = 0
  while pwr <= n:
    ans += n // pwr
    pwr *= 5
print(ans)
n,m=map(int,input().split())
g = [[] for _ in range(m)]
for _ in range(m):
  a,b=map(int,input().split())
  g[a-1].append(b-1)
  g[b-1].append(a-1)
p = [0]*n
from collections import deque
q = deque([0])

while q:
  v = q.popleft()
  for c in g[v]:
    if p[c]<1:p[c]=v+1;q.append(c)
if 0 in p: print('No')
else: print('Yes',*p[1:],sep='\n')

### FIXED CODE ###

f=lambda:map(int,input().split())
n,m=f()
g=[[] for _ in range(n)]
for _ in range(m):
  a,b=f()
  g[a-1]+=[b-1]
  g[b-1]+=[a-1]
p=[0]*n
from collections import*
q=deque([0])
while q:
  v=q.popleft()
  for c in g[v]:
    if p[c]<1: p[c]=v+1; q.append(c)
if 0 in p: print('No')
else: print('Yes',*p[1:],sep='\n')
n = int(input())
a = [int(input()) for _ in range(n)]
def search(i, p):
    if i == 2:
        print(p)
        exit()
    elif p > n:
        print(-1)
        exit()
    else:
        search(a[i-1], p+1)

search(1, 0)


### FIXED CODE ###

import sys
sys.setrecursionlimit(500*500)
n = int(input())
a = [int(input()) for _ in range(n)]
def search(i, p):
    if p > n:
        print(-1)
        exit()
    elif i == 2:
        print(p)
        exit()
    else:
        search(a[i-1], p+1)

search(1, 0)
#coding: utf-8

line=input()
lines=line.split(" ")

a=lines[0]
b=lines[1]

print ((a+b)*2+" "+(a*b))

### FIXED CODE ###

#coding: utf-8

nums=list(map(int,input().split()))

a=nums[0]
b=nums[1]

print (a*b,(a+b)*2)
a,b,h = list(map(int,input().split()))

print((a+b)*h/2)

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())


print(int((a+b)*h/2))
line = input().split(sep=" ")
x = int(line[0])
y = int(line[1])
z = int(line[2])
in_k = int(line[3])


in_x = sorted(list(map(int,input().split(sep=" "))),reverse=True)
in_y = sorted(list(map(int,input().split(sep=" "))),reverse=True)
in_z = sorted(list(map(int,input().split(sep=" "))),reverse=True)

ans_arr = []

if(x > in_k ): x =in_k
if(y > in_k ): y =in_k
if(z > in_k ): z =in_k

print(x)
for i in range(x):
	for j in range(y):
		if((i+1) * (j+1) > in_k) break
		for k in range(z):
			ans_arr.append(in_x[i] + in_y[j] + in_z[k])
			if((i+1) * (j+1) * (k+1) > in_k) break

ans_arr = sorted(ans_arr,reverse=True)

for i in range(in_k):
	print(ans_arr[i])


### FIXED CODE ###

X, Y, Z, K = map(int, input().split())

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


A = sorted(A, key = lambda x:-x)
B = sorted(B, key = lambda x:-x)
C = sorted(C, key = lambda x:-x)

AB = [0] * (X * Y)

ABC = []

for i in range(X):
    for j in range(Y):
        if (i + 1) * (j + 1) > K:
            break
        for k in range(Z):
            if (i + 1) * (j + 1) * (k + 1) > K:
                break
            ABC.append(A[i] + B[j] + C[k])

ABC = sorted(ABC, key = lambda x:-x)
for i in range(0, K):
    print(ABC[i])
from collections import defaultdict

import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,k=mis()
    ave=float(k/2)
    ans=n
    dis=abs(ans-k)
    if n>=k:
        ans=n%k
        if k>ans:
            print(k%ans)
            exit()
    print(n if n<ave else k-n)



if __name__ == "__main__":
    main()

### FIXED CODE ###

from collections import defaultdict

import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,k=mis()
    if n>=k:
        n%=k
        print(k%n if n!=0 else 0)
        exit()    
    print(n if n<=k//2 else k-n)



if __name__ == "__main__":
    main()
N = int(input())

import collections
l = []
for n in range(N):
  S = input()
  l.append(S)

c = collections.Counter(l)


print("AC x " c['AC'])
print("WA x " c['WA'])
print("TLE x " c['TLE'])
print("RE x " c['RE'])

### FIXED CODE ###

N = int(input())

import collections
l = []
for n in range(N):
  S = input()
  l.append(S)

c = collections.Counter(l)


print("AC x " + str(c['AC']))
print("WA x " + str(c['WA']))
print("TLE x " + str(c['TLE']))
print("RE x " + str(c['RE']))
a, op, b = map(int, input().split())
op = str(op)

if p == "+":
  print(a+b)
else:
  print(a-b)

### FIXED CODE ###

a,o,b=input().split()
a=int(a)
b=int(b)
print(a+b if o=="+" else a-b)
x,n=map(int,input().split())
if n==0:
  print(x)
else:
  p=list(map(int,input().split()))
  c=[0]*100
  for i in p:
    c[i]=1
  if max(p)<x:
    print(x)
  elif min(p)>x:
    print(x)
  else:
    i=0
    while True:
      if p.count(x-i)==0:
        print(x-i)
        break
      elif p.count(x+i)==0:
        print(x+i)
        break
      else:
        i+=1

### FIXED CODE ###

x,n=map(int,input().split())
if n!=0:
  p=list(map(int,input().split()))
else:
  p=[]
ans=0
if x in p:
  low=x
  high=x
  while True:
    low-=1
    high+=1
    if low in p:
      if high in p:
        continue
      else:
        ans=high
        break
    else:
      ans=low
      break
  print(ans)
else:
  print(x)
N, M = map(int,input().split())
if N > M:
    N, M = M, N
if N == 1:
    if M == 1:
        ans = 1
    else:
        ans = n - 2
elif N == 2:
    ans = 0
else:
    ans = (N - 2) * (M - 2)
print(ans)

### FIXED CODE ###

N, M = map(int,input().split())
if N > M:
    N, M = M, N
if N == 1:
    if M == 1:
        ans = 1
    else:
        ans = M - 2
elif N == 2:
    ans = 0
else:
    ans = (N - 2) * (M - 2)
print(ans)
import numpy as np


def read_input(trans=int):
    return list(map(trans, input().split()))


N, K = read_input()
A = np.array(read_input(), dtype="int")
B = np.zeros(N, dtype="int")
coordinate = np.arange(1, N+1)


for _ in range(K):
    A = [(A >= np.abs(coordinate - coordinate[i])).sum() for i in range(N)]

print(" ".join(map(str, A.tolist())))


### FIXED CODE ###

def read_input(trans=int):
    return list(map(trans, input().split()))


N, K = read_input()
A = read_input()
K = min(K, 41)

for _ in range(K):
    B = [0]*N
    for i in range(N):
        start = max(i-A[i], 0)
        end = min(i+A[i], N-1)

        B[start] += 1
        if end+1 < N:
            B[end+1] -= 1
    for i in range(1, N):
        B[i] += B[i-1]
    A = B.copy()


print(" ".join(map(str, A)))
x,y,a,b,c = list(map(int, input().split()))

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p_rev = sorted(p, reverse=True)
q_rev = sorted(q, reverse=True)
r_rev = sorted(r, reverse=True)
#print(p_rev[:x])
#print(q_rev[:y])
pq_rev = sorted(p_rev[:x] + q_rev[:y] , reverse=True)

num_r = len(r_rev)
start = len(pq_rev) - num_r

pq_cnt = 0
r_cnt = 0
total = 0
for i in range(len(pq_rev)):
  if pq_rev[pq_cnt] > r_rev[r_cnt]:
    total += pq_rev[pq_cnt]
    pq_cnt += 1
  else:
    total += r_rev[r_cnt]
    r_cnt += 1
print(total)

### FIXED CODE ###

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

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p_rev = sorted(p, reverse=True)
q_rev = sorted(q, reverse=True)
pq_rev = sorted(p_rev[:x] + q_rev[:y] , reverse=True)

total = sum(sorted(pq_rev + r, reverse=True)[:x+y])
print(total)
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
dif=[]
count=0
for i in range(N):
    dif.append(int(V[i]-C[i]))

dif.sort(reverse=True)

i=0
while (dif[i]>=0)and(i<=N-1):
    count=count+dif[i]
    i=i+1

print(count)

### FIXED CODE ###

N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
dif=[]
count=0
for i in range(N):
    dif.append(int(V[i]-C[i]))

dif.sort(reverse=True)

i=0
for i in range(N):
    if dif[i]>=0:
        count=count+dif[i]
    else:
        break

print(count)
a,b = map(int,input().split())
s = input()
s1,s2 = s.split("-")
 
if s.count("-") ==1:
  if a == len(s1) and b == len(s2):
    print("Yes")
  else:
    print("No")

else:
  print("No")

### FIXED CODE ###

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

 
if s.count("-") ==1:
  s1,s2 = s.split("-")
  if a == len(s1) and b == len(s2):
    print("Yes")
  else:
    print("No")
 
else:
  print("No")
S = int(input() S >= 10000)
s = int(input())
a = int(h = (S / 3600), m = ((S % 3600) / 60), for s in range(0, 60):.split )
print(a[h, m, s])

### FIXED CODE ###

S = int(input())

s = S % 60
m = S // 60 % 60
h = S // 60 // 60

print("{0}:{1}:{2}".format(h,m,s))