peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
sx,sy,tx,ty = list(map(int, input().split()))

result = ""
dy = ty-sy
dx = tx-sx

for i in range(dy):
    result += "U"
for i in range(dx):
    result += "R"
for i in range(dy):
    result += "D"
for i in range(dx):
    result += "L"

result += "L"
for i in range(dy+1):
    result += "U"
for i in range(dx+1):
    result += "R"
result += "D"

result += "R"
for i in range(dy+1):
    result += "D"
for i in range(dx+1):
    result += "L"
result += "U"
print(result)
# Judge status: Accepted
A, B, C = map(int, input().split())
K = int(input())

m = max(A, B, C)
print(m * (2 ** K) + A + B + C - m)
# Judge status: Accepted
import itertools

N = input()
array = list(map(int, input().split()))

p = list(itertools.combinations(array, 3))

count = 0

for p_i in p:
    if p_i[0] + p_i[1] > p_i[2]:
        if p_i[1] + p_i[2] > p_i[0]:
            if p_i[2] + p_i[0] > p_i[1]:
                if p_i[0] != p_i[1] and p_i[1] != p_i[2] and p_i[2] != p_i[0]:
                    count = count + 1

print(count)
# Judge status: Accepted
print('Yes'if sorted(input())<sorted(input())[::-1] else'No')
# Judge status: Accepted
a = input()
b = input()
c = input()

i = "a"
player = {"a":a,"b":b,"c":c}

while True:
    if len(player[i])==0:
        print(i.upper())
        break
    l = player[i][0]
    player[i] = player[i][1:]
    i = l
# Judge status: Wrong Answer
ans=0
a,b=map(int,input().split())
for i in range(1,999):
    ans+=i
    if ans>b:
        print(ans-a)
        exit(0)
# Judge status: Accepted
import numpy as np


N = int(input())
L = list(map(int, input().split()))
maxL = max(L)
argmaxL = np.argmax(L)
L.pop(argmaxL)
if maxL < sum(L):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n = int(input())
alpha_arr = [chr(i) for i in range(97, 97+26)]
ans = []
while n > 0:
    n -= 1
    ans.insert(0, alpha_arr[n % 26])
    n //= 26
print(''.join(ans))
# Judge status: Wrong Answer
import numpy as np


N, D = map(int,input().split())

num = 0

for n in range(N):
    x,y =  map(int,input().split())
    d = np.sqrt(x**2 + y**2)
    if d >= D:
        num+=1

print(num)
# Judge status: Wrong Answer
N,X=map(int, input().split())
L=list(map(int, input().split()))
distance = 0
count = 0
while distance <= X and count < N:
  print(distance)
  distance = distance + L[count]
  count = count + 1
# Judge status: Accepted
n,m=map(int,input().split())
a=[]
for i in range(n):
  ai=list(input())
  a.append(ai)
b=[]
for i in range(m):
  bi=list(input())
  b.append(bi)

frag='No'
for i in range(n-m+1):
  for j in range(n-m+1):
    for k in range(m):
      if a[i+k][j:j+m]!=b[k]:
        break
    else:
      frag="Yes"
      break
  continue
print(frag)
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))

s = sum(A)

ans = N - s

if ans < 0:
    print(-1)
else:
    print(ans)
# Judge status: Accepted
def main():
    n = int(input())
    print(0.5 if n % 2 == 0 else (1 + n // 2) / n)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

from collections import Counter

c = Counter(a)

c = [(length,cnt) for length,cnt in sorted(c.items(), key=lambda x:(-x[0], -x[1])) if cnt>=2]
if len(c)<2:
    print(0)
else:
    if c[0][1]>=4:
        print(c[0][0]*c[0][0])
    else:
        print(c[0][0]*c[1][0])
# Judge status: Accepted
import math
N=int(input())
ans=math.factorial(N)%(10**9+7)
print(ans)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))

m=0
K=0
for i in range(N):
    if i==0:
        m=A[i]
    else:
        S=max(0,m-A[i])
        K+=S
        m=A[i]+S
print(K)
# Judge status: Accepted
A,B = map(int,input().split())

if A >= 13:
    print(B)
elif A <= 5:
    print(0)
else:    
    print(B//2)
# Judge status: Wrong Answer
import sys
from collections import defaultdict

input = sys.stdin.readline
P = 998244353


def main():
    N = int(input())
    D = list(map(int, input().split()))

    count = defaultdict(int)
    for d in D:
        count[d] += 1

    if count[0] != 1:
        print(0)
        exit()

    max_depth = max(count.keys())
    ans = 1
    for d in range(max_depth):
        ans = (ans * pow(count[d], count[d + 1], mod=P)) % P

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
S = int(input())

const = 10**9 + 7

from scipy.special import comb
def amari(a, k):
    temp = 0
    for i in range(a):
        temp += comb(a-1, i) * comb(i+1, k)
    return int(temp)

a = S//3
b = S%3

if b == 0:
    ans = amari(a, 0)
elif b==1:
    ans = amari(a, 1)
else:
    ans = amari(a, 1) + amari(a, 2)

ans %= const

print(ans)
# Judge status: Accepted
A, B, K = map(int, input().split())
c = 0
for i in range(min(A,B), 0, -1):
  if A % i == 0 and B % i == 0:
    c += 1
#    print(c,i)
    if c == K:
      ans = i
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())

c = b//4
print(c)
if c > a:
    print("No")
    exit()
for i in range(0, b):
    for j in range(0, b):
        if i*2 + j*4 == b:
            print("Yes")
            exit()
    else:
        print("No")
# Judge status: Wrong Answer
s = input()
if int(s[5:7]) < 4:
    print ("Heisei")
else :
    print ('TBD')
# Judge status: Wrong Answer
s=input()
b=0
m=len(s)
c=0
for i in range(m-3):
    a=s[i]+s[i+1]+s[i+2]
    for j in range(i+3,m):
        if c==1 and int(s[j])%3!=0:
            c=0
            continue
        a=str(a)
        a=int(a+s[j])
        c=0
        
        if a%3!=0:
            continue

        c=1
        if a%2019==0:
            b+=1
print(b)
# Judge status: Accepted
# coding: utf-8

dish = [int(input().rstrip()) for i in range(5)]


def get_ans(flag: int, current: int):
    if (1 << 5) - 1 == flag:
        return current

    tmp = current
    if current % 10 != 0:
        tmp += 10 - (current % 10)

    ans = 2000
    for i in range(5):
        key = 1 << i
        if (flag & key) != 0:
            continue
        ret = get_ans(flag + key, tmp + dish[i])
        ans = min(ans, ret)
    return ans


print(get_ans(0, 0))
# Judge status: Accepted
N = int(input())
lt = list()
for i in range(1, 10):
    for j in range(1, 10):
        lt.append(i*j)
if N in lt:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
MOD = 10**9 + 7

from collections import Counter
s = []

for i in range(n):
    b = bin(a[i])[2:]
    c = len(b)
    s.append("0"*(60-c) + b)
    
ans = 0
for i in range(60):
    zero = 0
    one = 0
    for j in range(n):
        if s[j][i] == "0":
            zero += 1
        else:
            one += 1
            
    temp = zero * one * (2 ** (59-i)) % MOD
    
    ans = (ans + temp) % MOD
    
print(ans)
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
ans=b*(n-1)+a-a*(n-1)-b
if ans<=0:
  print(0)
else:
  print(ans)
# Judge status: Accepted
def resolve():
    N= int(input())
    A = list(map(int,input().split()))

    API = dict()
    ans = 0
    for i,a in enumerate(A):
        api = a+i+1
        ami = i+1-a

        if ami in API:
            ans += API[ami]

        if not api in API:
            API[api]=0
        API[api]+=1
        
    print(ans)




if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
n = int(input())
a = 1
for i in range(1,n+1):
    a = i * (a % (10**9+7))

print(a)
# Judge status: Wrong Answer
import sys
N, M, K = map(int, input().split())

for i in range(N+1):
    for j in range(M+1):
        if M*i + N*j - i*j == K:
            print('Yes')
            sys.exit()
print('No')
# Judge status: Accepted
N = int(input())
S = input()
arr = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
c = ""
for s in S:
    c = c + arr[arr.find(s)+N:arr.find(s)+N+1]
print(c)
# Judge status: Accepted
import itertools
n,m=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(list(map(int,input().split())))
  del a[i][0]
a=list(itertools.chain.from_iterable(a))
count=0
for i in range(0,m):
  if a.count(i+1)==n:
    count=count+1
print(count)
# Judge status: Accepted
from functools import reduce

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

mod=10**9+7
def nCk(n,k):
    if n<k or (n<0 or k<0):
        return 0
    k=min(k,n-k)
    up,down=1,1
    for i in range(k):
        up=up*(n-i)%mod
        down=down*(i+1)%mod
    return up*pow(down,mod-2,mod)%mod

all=pow(2,n,mod)
nCa=nCk(n,a)
nCb=nCk(n,b)

print((all-nCa-nCb-1)%mod)
# Judge status: Accepted
def resolve():
    n = int(input())
    a_1 = list(map(int, input().split()))
    a_2 = list(map(int, input().split()))
    total = 0
    for i in range(n):
        line_1 = sum(a_1[:i+1])
        line_2 = sum(a_2[i:])
        total = max(total, line_1+line_2)
    print(total)
resolve()
# Judge status: Wrong Answer
from math import pi
def cicle(hankei):
    print(2 * hankei * pi)

cicle(1)
cicle(73)
# Judge status: Wrong Answer
#!/usr/bin/env python3

s = str(input())

a = s[0:2]

b = s[2:]


def div(a):
    a = int(a)
    if a <= 12 and a >= 1:
        return "BOTH"
    else:
        return "YY"


if div(a) == div(b):
    if div(a) == "YY":
        print("NA")
    else:
        print("AMBIGUOUS")
elif div(a) == "YY":
    print(b+a)
else:
    print(a+b)
# Judge status: Accepted
k,x=[int(i) for i in input().split()]
print("Yes" if k*500>=x else "No")
# Judge status: Accepted
import numpy as np
n = int(input())
aa = list(map(int, input().split()))
mod = 10**9+7
res = 1
pow2 = 1
ans = 0
for i in range(60):
    cnt = np.count_nonzero(np.array(aa)&pow2)
    ans = (ans + cnt * (n-cnt) * res)%mod
    res = (res*2)%mod
    pow2*=2
print(ans)
# Judge status: Accepted

#<D>wa
n, k = map(int,input().split())
r, s, p = map(int,input().split())
q = input()
d = {"r":p,"s":r, "p":s}
ans = 0
wins = [False] * k
for i in range(len(q)):
    if not wins[i % k] or q[i] != q[i - k]:
        ans += d[q[i]]
        wins[i % k] = True
    else:
        wins[i % k] = False
print(ans)
# Judge status: Accepted
from math import gcd
n=int(input())
a=list(map(int,input().split()))
g=gcd(a[0],a[0])
for i in range(n):
    g=gcd(g,a[i])
print(g)
# Judge status: Accepted
N = int(input())

if N % 2 == 1:
    ans = 0
else:
    count = 1
    ans = 0
    while N//2 >= 5**count:
        ans += N//(2*5**count)
        count+=1

print(ans)
# Judge status: Accepted
import math
n = [int(input()) for _ in range(6)]
print(math.ceil((n[0]/ min(n[1:]))) + 4)
# Judge status: Wrong Answer
n,k = map(int,input().split())
s = input()
kb = ''
if k >= 2:
  kb = s[:k-2]
kk = s[k-1]
ka = ''
if k < len(s):
  ka = s[k:]

if kk == 'A':
  print(kb + 'a' + ka)
  exit()
if kk == 'B':
  print(kb + 'b' + ka)
  exit()
if kk == 'C':
  print(kb + 'c' + ka)
  exit()
# Judge status: Wrong Answer
a,b,c,d=map(int, input().split())
tc = b//c-a//c
td = b//d-a//d
tcd = b//(c*d)-a//(c*d)
print(b-a+1-tc-tc+tcd)
# Judge status: Accepted
from itertools import accumulate


N = int(input())
A1 = [0] + list(accumulate(map(int, input().split())))
A2 = [0] + list(accumulate(map(int, input().split())))
ans = 0
for i in range(1, N + 1):
    cur = A1[i - 1]
    if i < N:
        cur += A2[N] - A2[i]
    ans = max(ans, cur + A1[i] - A1[i - 1] + A2[i] - A2[i - 1])
print(ans)
# Judge status: Accepted
s=str(input())
R=s.count('R')
if s=='RSR':
    print(1)
else:
    print(R)
# Judge status: Wrong Answer
n = int(input())

wa = 0

if n == 1:
	print(1)
else:
	for i in range(1, n):
		if 2 * i >= n - wa:
			print(n - wa)
			break
		else:
			wa += i
			print(i)
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    S = input()
    L = len(S)
    ans = 'NO'
    for i in range(0,8):
        s = S[:i] + S[L-7+i:]
        if s == 'keyence':
            ans = 'YES'
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
import collections
N = int(input())
S = [sorted(input()) for _ in range(N)]
Ssrt = []
for s in S:
    s = ''.join(s)
    Ssrt.append(s)
cnt = collections.Counter(Ssrt)
ans = 0
for i in cnt.keys():
    if cnt[i] >= 2:
        ans += cnt[i]*(cnt[i]-1)//2
print(ans)
# Judge status: Accepted
a,b,_c,k=map(int,input().split())
if k%2==0:print(a-b)
else:print(b-a)
# Judge status: Accepted
a=list(map(int,input().split()))
a=sorted(a)
k=int(input())

for i in range(1,k+1):
       f=a[2]*2
       a[2]=f
       
c=a[0]+a[1]+a[2]
print(c)
# Judge status: Accepted
import sys

n = sys.stdin.readline().rstrip()

def main():
    dp = [0, 1]
    for d in n:
        d = int(d)
        dp[0], dp[1] = min(dp[0]+d, dp[1]+10-d), min(dp[0]+d+1, dp[1]+10-d-1)

    return dp[0]

if __name__ == '__main__':
    ans = main()
    print(ans)
# Judge status: Accepted
t = input()
ans = ''

for i in range(len(t)):
    if t[i] == '?':
        ans += 'D'
    else:
        ans += t[i]

print(ans)
# Judge status: Accepted
X = int(input())
import math
X -= 400
X /= 200
X = math.floor(X)
print(8-X)
# Judge status: Accepted
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


N = inp()

a = inlist()
a = sorted(a)
st = 3*N - 1
wk = 0
res = 0
for i in range(N):
    chosen = st - 1
    res += a[chosen]

    wk += 1
    st -= 2

print(res)
# Judge status: Accepted
N = int(input())
A = list( map(int, input().split()) )
B = [i for i in A]

for i in range(N):
  B[N-i-1] += B[N-i]

if(N == 0 and A[0] == 1):
  print(1)
  exit()  
  

if(0 in B):
  print(-1)
  exit()
  
if(A[0] != 0):
  print(-1)
  exit()

a = 1
sum = a
for i in range(1, N):
  a = min(2*(a-A[i-1]) , B[i])
    
  if(a <= A[i]):
    print(-1)
    exit()
  sum += a

if(2*(a-A[-2]) < A[-1]):
  print(-1)
  exit()
print(sum + A[-1])
# Judge status: Accepted
n, m = map(int, input().split())
for i in range(m//n, 0, -1):
    rem = m-i*n
    if rem%i==0:
        print(i)
        break
# Judge status: Accepted
S = input()
if S == 'a' or S == 'i' or S == 'u' or S == 'e' or S == 'o':
  print('vowel')
else:
  print('consonant')
# Judge status: Wrong Answer
n=int(input())
s=input()
if s.count('R')==0 or s.count('W')==0:
    print(0)
else:
    a= s.count('W')
    w=s.index('W')
    b= s[w:].count('R')
    if b==0:
        print(0)
    else:
        c = s[(w+1):].count('W')
        t=min(b,c)
        print(min(t,a))
# Judge status: Wrong Answer
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, *P = read().decode('utf8').split()
P_N = sorted(P)

# print(list(x != y for x, y in zip(P, P_N)))

S = sum(x != y for x, y in zip(P, P_N))
# print(S)
print('YES' if S == 0 or S == 2 else 'NO')
# Judge status: Accepted
S = [int(i) for i in list(input())]
s = ["", ""]
c = 0
for v in S:
    s.append(v)
    # print(s)
    if (s[-1], s[-2])==(0, 1) or (s[-1], s[-2])==(1, 0):
        s.pop()
        s.pop()
        c += 2

print(c)
# Judge status: Accepted
a, b, c, k = map(int, input().split())
print(a-b) if k % 2 == 0 else print(b-a)
# Judge status: Accepted
from sys import stdin
A, B= stdin.readline().rstrip().split()
m = [A,B]
k = list(map(int, input().split()))
l = stdin.readline().rstrip().split()
k[m.index(l[0])] = k[m.index(l[0])] -1
print(k[0],k[1])
# Judge status: Accepted
s = str(input())

n = len(s)

L = [0]*(n+1)
cnt = 0
for i in range(n):
    if s[i] == '<':
        cnt += 1
    else:
        cnt = 0
    L[i+1] = cnt


R = [0]*(n+1)
cnt = 0
for i in reversed(range(n)):
    if s[i] == '>':
        cnt += 1
    else:
        cnt = 0
    R[i] = cnt

A = [0]*(n+1)
for i in range(n+1):
    A[i] = max(L[i], R[i])
print(sum(A))
# Judge status: Wrong Answer
import sys

S = sys.stdin.readline().strip()
print("2018" + S[5:])
# Judge status: Accepted

def main():
    n, k = map(int, input().split(" "))
    p = list(map(int, input().split(" ")))
    p.sort()
    ans = 0
    for i in range(k):
        ans += p[i]
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
from sys import stdin
def main():
	readline=stdin.readline
	N=int(readline())
	a=list(map(int,readline().split()))
	b=[0]*N
	for i in range(N):
		n=N-i
		count=0
		for k in range(n,N+1,n):
			if k==n:
				pass
			else:
				count+=b[k-1]
		if count%2!=a[n-1]:
			b[n-1]=1
		else:
			b[n-1]=0
	
	res=[]
	M=0
	for i in range(N):
		if b[i]==1:
			res.append(i+1)
			M+=1
	
	print(M)
	print(*res)
if __name__=="__main__":
	main()
# Judge status: Accepted
X = int(input())
C = 1000000

output = []
for c in range(C):
    if (c*100) <= X <= (c*105):
        output.append(1)
    else:
        output.append(0)
if max(output):
  print("1")
else:
  print("0")
# Judge status: Accepted
A=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
n=int(input())
s=str(input())
t=""
for i in range(len(s)):
  for j in range(26):
    if s[i]==A[j]:
      if j+n<=25:
        t+=A[j+n]
        break
      else:
        t+=A[j+n-26]
        break

print(t)
# Judge status: Accepted
# 締切の早いものから順番に見ていくのが最適戦略
N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]
X = sorted(X, key=lambda x: x[1])  # B (締切の早い順にソート)

res = 0
for i in range(N):
    res += X[i][0]
    if res > X[i][1]:
        print("No")
        exit()
print("Yes")
# Judge status: Wrong Answer
def resolve():
    S = list(input())
    mindiff = float("inf")
    for i in range(len(S)-2):
        val = int(S[i]+S[i+1]+S[i+2])
        print(val)
        mindiff = min(mindiff, abs(753-val))
    print(mindiff)

if '__main__' == __name__:
    resolve()
# Judge status: Accepted
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.buffer.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, X, Y = lr()
dist = []
for i in range(1, N+1):
    z = np.arange(i+1, N+1)
    d1 = z - i
    d2 = np.abs(i - X) + np.abs(z - Y) + 1
    d = np.minimum(d1, d2)
    dist.append(d)

dist = np.concatenate(dist)
cnt = np.bincount(dist, minlength=N)
print('\n'.join(cnt[1:].astype(str)))
# Judge status: Accepted
N, M = map(int, input().split())

ans = 1
for i in range(1, int(M**0.5)+1):
    if M % i != 0:
        continue

    j = M // i
    if i * N <= M:
        ans = max(ans, i)
    if j * N <= M:
        ans = max(ans, j)

print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = 0
for i in range(N):
    ans += min(A[i] + A[i+1], B[i])
    A[i+1] -= min(A[i] - B[i], 0)

print(ans)
# Judge status: Accepted
def main():
    import sys

    input = sys.stdin.readline
    n, w = map(int, input().split())

    if n > w:
        print("safe")
    else:
        print("unsafe")
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
X = int(input())
if 360%X == 0:
	print(360//X)
else:
	print(180)
# Judge status: Accepted
import bisect
n = int(input())
li = list(map(int,input().split()))
ans = 0
li.sort()
for k in range(0,n-2):
  for i in range(k+1,n-1):
    ans += bisect.bisect_left(li,li[k]+li[i])-i-1
print(ans)
# Judge status: Accepted
i = list(map(int, input().split()))

x = i[0] * i[1]
if x % 2 == 0:
  print("Even")
else:
  print("Odd")
# Judge status: Accepted
N, M = map(int, input().split())

if N % 2 == 1:
    for i in range(1, M + 1):
        l = i
        r = N - i
        print(l, r)
else:
    flag = False
    l = 1
    r = N - 1
    cnt = 0
    while cnt < M:
        if not flag and r - l <= N // 2:
            r -= 1
            flag = True
        print(l, r)
        l += 1
        r -= 1
        cnt += 1
# Judge status: Accepted
L = list(map(int,input().split()))
S=L[0]
W=L[1]
if W>=S:
 print("unsafe")
else:
 print("safe")
# Judge status: Accepted
w,a,b=map(int,input().split())
if a<b:
  if a+w>b:
    print(0)
  else:
    print(b-a-w)
elif b<a:
  if b+w>a:
    print(0)
  else:
    print(a-b-w)
else:
  print(0)
# Judge status: Accepted
n,a,b,c,d = map(int, input().split())
s = list(input())
s.append(".")
a -= 1
b -= 1
c -= 1
d -= 1

if c > d:
    if "##" not in "".join(s[a+1:c]) and "##" not in "".join(s[b+1:d]) and "..." in "".join(s[b-1:d+2]):
        print("Yes")
    else: print("No")
else:
    if "##" not in "".join(s[a+1:c]) and "##" not in "".join(s[b+1:d]):
        print("Yes")
    else: print("No")
# Judge status: Wrong Answer
N, M = map(int, input().split())
root_dic = {}
for i in range(M):
    root = list(map(int, input().split()))
    for i in range(2):
        if root[i] in root_dic:
            root_dic[root[i]] += 1
        else:
            root_dic[root[i]] = 1
for i, v in sorted(root_dic.items()):
    print(v)
# Judge status: Accepted
import sys

n, m = map(int, sys.stdin.readline().rstrip().split())
sc = [sys.stdin.readline().rstrip().split() for i in range(m)]
if n > 1:
    ans = ['1'] + ['0'] * (n - 1)
else:
    ans = ['0']
tmp = [0] * n
for sci in sc:
    s, c = sci
    if n > 1 and s == '1' and c == '0':
        print(-1)
        sys.exit()
    if tmp[int(s) - 1] > 0 and ans[int(s)-1] != c:
        print(-1)
        sys.exit()
    ans[int(s)-1] = c
    tmp[int(s) - 1] += 1
# print(ans)
print(''.join(ans))
# Judge status: Accepted
import math
X = int(input())
answer = 100
j = 0
while(answer <= X):
    answer = math.floor(answer * 1.01)
    j += 1
    if answer >= X:
        break
print(j)
# Judge status: Wrong Answer
S = str(input())
T = str(input())

same_l = min(len(S), len(T))
# print(S[:same_l-1])
# print(T[:same_l-1])

if S[:same_l-1] == T[:same_l-1]:
    # print("t")
    if len(T)-len(S) == 1:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Wrong Answer
def nc2(n):
    if n==0:
        return 0
    return n*(n-1)/2


n=int(input())
arr=[int(i) for i in input().strip().split(" ")]
ans=0
dic={}
for i in arr:
    dic[i]=dic.get(i,0)+1
for i in dic:
    if dic[i]==1 :
        continue
    ans+=nc2(dic[i])
    
print(dic)

for i in range(n):
    curr_nc2=nc2(dic[arr[i]])
    # print(curr_nc2)
    print(int(ans-curr_nc2+nc2(dic[arr[i]]-1)))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
from fractions import gcd
L=[0]
R=[]
l=a[0]
r=a[-1]
for i in range(n-1):
    l=gcd(a[i], l)
    L.append(l)
    r=gcd(a[-i-1], r)
    R.append(r)
R=R[::-1]
R.append(0)
M=[]
#print(L,R)
for i in range(n):
    m=gcd(L[i],R[i])
    M.append(m)
print(max(M))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
result=1
if 0 in a:
    print(0)
else:
    for i in a:
        result*=i
        if result>10**18:
            print(-1)
            break
    if result<=10**18:
        print(result)
# Judge status: Accepted
from collections import deque

N = int(input())
A = [int(e) for e in input().split()]


A.sort(reverse=True)

if N == 2:
    print(A[0])
else:
    ans = A[0]
    friendly_deque = deque()
    friendly_deque.append(A[1])
    friendly_deque.append(A[1])
    
    for i in range(2,N):
        add = friendly_deque.popleft()
        ans += add
        friendly_deque.append(A[i])
        friendly_deque.append(A[i])

    print(ans)
# Judge status: Accepted
a,b   = input().split()
aa,bb = map(int, input().split())
c     = input()

if (c == a):
  aa = aa - 1
else:
  bb = bb - 1
print(aa,bb)
# Judge status: Wrong Answer
n, m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]

print('No')
# Judge status: Wrong Answer
N  = int(input())

plans = []

for _ in range(N):
  a, b, c = map(int, input().split())
  plans.append((a, b, c))
  
memo = [[0] * (N + 1) for _ in range(3)]

for day, plan in enumerate(plans, 1):
  memo[0][day] = max(memo[1][day - 1], memo[2][day - 1]) + plan[0]
  memo[1][day] = max(memo[0][day - 1], memo[2][day - 1]) + plan[1]
  memo[2][day] = max(memo[0][day - 1], memo[1][day - 1]) + plan[2]
    
print(max(memo[0][N], memo[1][N], memo[1][N]))
# Judge status: Wrong Answer
#!/usr/bin/env python3
n, m, *x = map(int, open(0).read().split())
x.sort()
d = sorted(x[i] - x[i - 1] for i in range(1, m))
print(sum(d[:m - n]))