Harryxun/stf_run huggingface dataset:
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w, k = MAP()
s = []
p = []
q = []
for i in range(h):
    s.append(input())
    if s[i].count('#') > 0:
        p.append(i)
    else:
        q.append(i)

a = [[0]*w for i in range(h)]
num = 0
for i in p:
    num += 1
    k = 0
    while s[i][k] == '.':
        a[i][k] = num
        k += 1
    a[i][k] = num
    k += 1
    if k < w:
        for j in range(k, w):
            if s[i][j] == '#':
                num += 1
            a[i][j] = num

for i in q:
    k = i
    while k < h and a[k][j] == 0:
        k += 1
    if k >= h:
        k = i
        while k < h and a[k][j] == 0:
            k -= 1
    for j in range(w):
        a[i][j] = a[k][j]
for i in range(h):
    print(*a[i][:])

### FIXED CODE ###

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w, k = MAP()
s = []
p = []
q = []
for i in range(h):
    s.append(input())
    if s[i].count('#') > 0:
        p.append(i)
    else:
        q.append(i)

a = [[0]*w for i in range(h)]
num = 0
if p:
    for i in p:
        num += 1
        m = 0
        while s[i][m] == '.':
            a[i][m] = num
            m += 1
        if m < w:
            if s[i][m] == '#':
                a[i][m] = num
                m += 1
            if m < w:
                for j in range(m, w):
                    if s[i][j] == '#':
                        num += 1
                    a[i][j] = num

if q:
    for i in q:
        m = i
        while m < h and a[m][0] == 0:
            m += 1
        if m >= h:
            m = i
            while m > 0 and a[m][0] == 0:
                m -= 1
        a[i][:] = a[m][:]
for i in range(h):
    print(*a[i][:])
N = int(input())
and = D = [list(map(int,input().split())) for i in range(N)]  

ans = "No"

for i in range(N-2):
    if D[i][0] == D[i][1]:
        if D[i+1][0] == D[i+1][1]:
            if D[i+2][0] == D[i+2][1]:
                ans = "Yes"
                break
print(ans)

### FIXED CODE ###

N = int(input())
D = [list(map(int,input().split())) for i in range(N)]  

ans = "No"

for i in range(N-2):
    if D[i][0] == D[i][1]:
        if D[i+1][0] == D[i+1][1]:
            if D[i+2][0] == D[i+2][1]:
                ans = "Yes"
                break
print(ans)
#####segfunc######
def segfunc(x,y):
    if x == y == None:
        return []
    if x == None:
        return y
    if y == None:
        return x
    return x | y
def init(init_val):
    #set_val
    for i in range(len(init_val)):
        seg[i+num-1]=set([init_val[i]])   
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return []
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

#####単位元######
n = int(input())
s = list(input())
ide_ele = None
num =2**(n-1).bit_length()
seg=[ide_ele]*(2*num - 1)
init(s)
for i in range(int(input())):
    a,b,c = input().split()
    if a == "1":
        update(int(b), set([c]))
    else:
        if b == c:
            print(1)
        else:
            print(len(query(int(b)-1,int(c))))

### FIXED CODE ###

import sys
input = sys.stdin.readline
#####segfunc######
def segfunc(x,y):
    return x | y

def init(init_val):
    #set_val
    for i in range(len(init_val)):
        seg[i+num-1]=init_val[i]   
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

#####単位元######
n = int(input())
s = list(input())[:-1]
ide_ele = 0
num =2**(n-1).bit_length()
seg=[ide_ele]*(2*num - 1)
s = [2 ** (ord(i) - ord('a')) for i in s]
init(s)
q = int(input())
for i in range(q):
    tmp = input()
    a,b,c = tmp[:-1].split()
    if a == "1":
        update(int(b)-1, 2 ** (ord(c) - ord('a')))
    else:
        if b == c:
            print(1)
        else:
            tmp = query(int(b)-1, int(c))
            tmp = format(tmp, 'b')
            print(tmp.count('1'))
def cmb(n, r, mod):#コンビネーションの高速計算　
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 5*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

N, M = map(int, input().split())
ans = 0
for i in range(N+1):
    ans += cmb(N,i,mod)*((-1)**i)*g1[M]*g2[M-i]*((g1[M-i]*g2[M-N])**2)
    ans %= mod
print(ans)

### FIXED CODE ###

a = int(input())
print(a + a**2 + a**3)
n,m,v,p = map(int,input().split())
lis = list(map(int,input().split()))
lis.sort(reverse=True)

li = []

  # print(lis)
cnt = 1
now = 0
ans = 0

border = lis[p-1]
li.append(0)
ind = 0
for i in range(n-1):
    if lis[i]!=lis[i+1]:
        now += cnt
        cnt = 1
    else:
        cnt += 1
    if now <= p:
        ind += 1
    li.append(now)

print(li)
sa = 0
keykey = 1
key = 0

for i in range(n):
    if i >= p-1:
        sa += lis[i]
        if keykey:
            key = i
        keykey = 0

    if li[i]+1 <= p:
        ans += 1
   #       print(i,1)

    else:
        if lis[i] + m >= border:
            num = (p-1)+(n-li[i]-1)+1
            if num >= v:
                ans += 1
   #               print(i,2)
            else:
                nu = v-num
                if (sa -lis[i])-lis[i]*(i-key) <= (key-nu-1)*m:
                    ans += 1
   #                   print(i,3)
   #                   print(sa,lis[i],i,key,key-nu,m)
                else:
   #                   print(i,4)
  #        else:
  #            print(i,5)
print(ans)

### FIXED CODE ###

n,m,v,p = map(int,input().split())
lis = list(map(int,input().split()))
lis.sort(reverse=True)
ans = 0
trash = 0
for i in range(n):
    if i+1 <= p:
        ans += 1
    else:
        if lis[i] + m >= lis[p-1]:
            if (lis[i]+m)*(i-(p-1))-trash >= m * (v-(p-1)-(n-i)):
  #                 print(lis[i]+m,i-(p-1)-trash,m*(v-(p-1)-(n-i)))
                ans += 1
    if i+1 >= p:
        trash += lis[i]
print(ans)
n = int(input())
s = str(input())

R, G, B = [], [], []
for i, c in enumerate(s):
  if c == 'R': R.append(i)
  elif c == 'G': G.append(i)
  else: B.append(i)

ans = 0
for r in R:
  for g in G:
    if r < g: x, y = r, g
    else: x, y = g, r

    ans += len(X3)
    if x*2 - y >= 0:
      if s[x*2 - y] == 'B': ans -= 1
    if (x + y) % 2 == 0:
      if s[(x+y)//2] == 'B': ans -= 1
    if y*2 - x < len(s):
      if s[y*2 - x] == 'B': ans -= 1

print(ans)

### FIXED CODE ###

n = int(input())
s = str(input())

R, G, B = [], [], []
for i, c in enumerate(s):
  if c == 'R': R.append(i)
  elif c == 'G': G.append(i)
  else: B.append(i)

ans = 0
for r in R:
  for g in G:
    if r < g: x, y = r, g
    else: x, y = g, r

    ans += len(B)
    if x*2 - y >= 0:
      if s[x*2 - y] == 'B': ans -= 1
    if (x + y) % 2 == 0:
      if s[(x+y)//2] == 'B': ans -= 1
    if y*2 - x < len(s):
      if s[y*2 - x] == 'B': ans -= 1

print(ans)
#D-Face Produces Unhappiness
N, K = map(int, input().split())
S = str(input())
l_index = [l[i]+l[i+1] for i in range(0,N-1)]

count_LRorRL =0
count_LRorRL += S.count('LR')
count_LRorRL += S.count('RL')

count_LLorRR = 0
count_LLorRR += S.count('LL')
count_LLorRR += S.count('RR')

if count_LRorRL > 2*K:
    print(count_LLorRR+2*K)
else:
    print(count_LLorRR+count_LRorRL)

### FIXED CODE ###

#D-Face Produces Unhappiness
N, K = map(int, input().split())
S = str(input())

def count_LRorRL(l):
    ans = 0
    l_index = [l[i]+l[i+1] for i in range(0,N-1)]
    ans += l_index.count('LR')
    ans += l_index.count('RL')
    return ans

def count_LLorRR(l):
    ans = 0
    l_index = [l[i]+l[i+1] for i in range(0,N-1)]
    ans += l_index.count('LL')
    ans += l_index.count('RR')
    return ans
  
if count_LRorRL(S) > 2*K:
    print(count_LLorRR(S)+2*K)
else:
    print(count_LLorRR(S)+count_LRorRL(S))
N, X = map(int, input().split())
x = list(map(int, input().split()))
d = []
min=abs(x[0]-X)
for i in range(N):
    d.append(abs(x[i] - X))

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

g = gcd(d[0], d[1])
for i in range(2,N):
    g=gcd(g,d[i])
print(g)

### FIXED CODE ###

N, X = map(int, input().split())
x = list(map(int, input().split()))
d = []
min=abs(x[0]-X)
for i in range(N):
    d.append(abs(x[i] - X))

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

if len(d) == 1:
    print(d[0])
else:    
    g = gcd(d[0], d[1])
    for i in range(2,N):
        g=gcd(g,d[i])
    print(g)
X=int(input())
 
if 400<=X<=599:
    print(8)
elif 600<=X<=799:
    print(7)
elif 800<=X<=999:
    prnit(6)
elif 1000<=X<=1199:
    print(5)
elif 1200<=X<=1399:
    print(4)
elif 1400<=X<=1599:
    print(3)
elif 1600<=X<=1799:
    print(2)
elif 1800<=X<=1999:
    print(1)

### FIXED CODE ###

x = int(input())
 
if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 <= x <= 1999:
    print(1)
l = input().split()
N = int(l[0])
M = int(l[1])

C = []

for i in range(M):
    l = input().split()
    C.append([int(x) - 1 for x in l])

# print(N, M, C)

def visit(s, G, visited):
    # print(s, G, visited)
    visited.add(s)
    for g in G:
        if g[0] in visited:
            n = g[1]
            G.remove(g)
            return visit(n, G, visited)
        elif g[1] in visited:
            n = g[0]
            G.remove(g)
            return visit(n, G, visited)
    return

ans = 0
for i in range(N):
    D = []
    for j in range(N):
        if i != j:
            D.append(C[j])
    visited = set()
    visit(0, D, visited)
    # print(i, len(visited))
    if len(visited) != N:
        ans += 1

print(ans)


### FIXED CODE ###

l = input().split()
N = int(l[0])
M = int(l[1])

C = []

for i in range(M):
    l = input().split()
    C.append([int(x) - 1 for x in l])

# print(N, M, C)

def visit(s, G, visited):
    # print(s, G, visited)
    visited.add(s)
    for g in G:
        if g[0] in visited:
            n = g[1]
            G.remove(g)
            return visit(n, G, visited)
        elif g[1] in visited:
            n = g[0]
            G.remove(g)
            return visit(n, G, visited)
    return

ans = 0
for i in range(M):
    D = []
    for j in range(M):
        if i != j:
            D.append(C[j])
    visited = set()
    visit(0, D, visited)
    # print(i, len(visited))
    if len(visited) != N:
        ans += 1

print(ans)
import math

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

k = math.gcd(a, b)

ans = (a * b) // k

print(ans)


### FIXED CODE ###

import fractions

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

k = fractions.gcd(a, b)

ans = (a * b) // k

print(ans)
import sys
input = sys.stdin.readline
A, B = map(int, input().split())
if A < B: print("LESS")
elif A == B: print("EQUAL")
else: print("GREATER")


### FIXED CODE ###

import sys
input = sys.stdin.readline
A = int(input())
B = int(input())
if A < B: print("LESS")
elif A == B: print("EQUAL")
else: print("GREATER")
n,m,q=map(int,input().split())

a=[]
b=[]
c=[]
d=[]
for i in range(0,q):
    ay,by,cy,dy=map(int,input().split())
    a.append(ay)
    b.append(by)
    c.append(cy)
    d.append(dy)
s=0
smax=0
for i1 in range(0,m+1):
    for i2 in range(i1,m+1):
        for i3 in range(i2,m+1):
            for i4 in range(i3,m+1):
                for i5 in range(i4,m+1):
                    for i6 in range(i5,m+1):
                        for i7 in range(i6,m+1):
                            for i8 in range(i7,m+1):
                                for i9 in range(i8,m+1):
                                    for i10 in range(i9,m+1):
                                        s=0
                                        na=[i1,i2,i3,i4,i5,i6,i7,i8,i9,i10]
                                        for j in range(0,q):
                                            if na[b[j]]-na[a[j]]==c[j]:
                                                s+=d[j]
                                        if s>smax:
                                            smax=s


print(smax)

### FIXED CODE ###

import sys
n,m,q=map(int,input().split())


a=[]
b=[]
c=[]
d=[]
for i in range(0,q):
    ay,by1,cy,dy=map(int,input().split())
    a.append(ay)
    b.append(by1)
    c.append(cy)
    d.append(dy)
s=0
smax=-100

sys.setrecursionlimit(3000)



def dfs(h):
    global smax
    if len(h)==n+1:
        s=0
        for j in range(0,q):
            if h[b[j]]-h[a[j]]==c[j]:
                s+=d[j]
        if s>smax:
            smax=s

        return
    
    for i in range(0,m+1-h[len(h)-1]):
        
        h2=h[:]
        h2.append(h[len(h)-1]+i)
        dfs(h2)

sta=[1]
dfs(sta)
print(smax)
n, x = map(int, input().split())
ls = list(map(int, input().split()))

bounce = [0]

while bounce[-1] < x:
  bounce.append(bounce[len(bounce)-1] + ls[len(bounce)-1])

print(len(bounce))


### FIXED CODE ###

n, x = map(int, input().split())
ls = list(map(int, input().split()))

bounce = [0] + [ sum(ls[:i]) for i in range(1, len(ls)+1) ]

for i, v in enumerate(bounce):
  if v > x:
    print(i)
    break
else:
  print(len(bounce))
n, l = map(int, input().split())
s = [input() for i in range(l)]
s.sort()
mojiretu = ''

for x in s:
    mojiretu += x
print(mojiretu)

### FIXED CODE ###

n, l = map(int, input().split())
s = [input() for i in range(n)]
s.sort()
mojiretsu = ''

for x in s:
    mojiretsu += x
print(mojiretsu)
#!/usr/bin/env python3
import sys

MOD = 2019  # type: int

def solve(L: int, R: int):
    if R - L >= 2019 - 1:
        print(0)
    else:
        L = L % 2019
        R = R % 2019
        
        smallest = 10000000
        for i in range(L, R+1):
            for j in range(i+1, R+1):
                calc = (i*j)%2019
                if calc < smallest:
                    smallest = calc
    print(smallest)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

MOD = 2019  # type: int

def solve(L: int, R: int):
    if R - L >= 2019 - 1:
        print(0)
        return
    if R % 2019 <= L % 2019:
        print(0)
        return
    else:
        L = L % 2019
        R = R % 2019
        
        smallest = 10000000
        for i in range(L, R):
            for j in range(i+1, R+1):
                calc = (i*j)%2019
                if calc < smallest:
                    smallest = calc
    print(smallest)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)

if __name__ == '__main__':
    main()
n,m=map(int,input().split())
x=[]
for _ in range(n):
    x.append([])

for _ in range(m):
    s,c=map(int,input().split())
    x[s-1].append(c)
ans=''
for i in range(n):
    if len(set(x[i]))>=2:
        ans='-1'
        break
    elif len(x[i])==0 and i==0:
        ans+='1'
    elif len(x[i])==0 and i!=0:
        ans+='0'
    else:
        if x[0][0]==0 and n==1:
            ans='0'
            break
        elif x[0][0]==0 and n!=1:
            ans='-1'
            break
        ans+=str(x[i][0])

print(int(ans))


### FIXED CODE ###

n,m=map(int,input().split())
a=[]
for _ in range(m):
    s,c=map(int,input().split())
    a.append([s,c])

ans=-1
if n==1:
    for i in range(10):
        x=str(i)
        c=0
        for j in range(m):
            if x[a[j][0]-1] == str(a[j][1]):
                c+=1          
        if c==m:
            ans=i
            break
else:
    for i in range(10**(n-1),10**n):
        x=str(i)
        c=0
        for j in range(m):
            if x[a[j][0]-1] == str(a[j][1]):
                c+=1          
        if c==m:
            ans=i
            break
print(ans)
inl=map(int. raw_input().split())

a=inl[0]
b=inl[1]
c=inl[2]

if a<b and b<c:
  print "Yes"
else:
  print "No"

### FIXED CODE ###

inl=map(int, raw_input().split())

a=inl[0]
b=inl[1]
c=inl[2]

if a<b and b<c:
  print "Yes"
else:
  print "No"
n=int(input())
res=[]
for i in range(n):
	s,p=max(str,input().split())
    res.append([s,int(p)])
res1=res
res=sorted(res,key=lambda x:x[0], -x[1])
for i in range(n):
	print(res1.index(res[i])+1)

### FIXED CODE ###

n=int(input())
res = []
for i in range(n):
    s,p=map(str, input().split())
    res += [(s,int(p))]
res1=res
res = sorted(res, key=lambda x:(x[0],-x[1]))
for i in range(n):
    print(res1.index(res[i])+1)
s = input()
t = input()
ans = 0

for i, j in s, t:
    if i == j:
        ans += 1
print(ans)

### FIXED CODE ###

s = input()
t = input()
ans = 0

for i, j in zip(s, t):
    if i == j:
        ans += 1
print(ans)
import numpy

def back_oturigation(fee, coin_values, coin_nums):

    coin_values=numpy.array(coin_values)
    coin_nums=numpy.array(coin_nums)
    all = numpy.dot(coin_values, coin_nums)
    oturi = all - fee

    use_coins = [0] * len(coin_values)
    no_use_coins = [0] * len(coin_values)

    for i in reversed(range(0,len(coin_values))):
        no_use_coins[i] = int(oturi / coin_values[i])
        oturi = oturi - (coin_values[i] * no_use_coins[i])

    for i in range(0, len(use_coins), 1):
        use_coins[i] = coin_nums[i] - no_use_coins[i]
        if use_coins[i] > 0:
            print(str(coin_values[i]) + ' ' + str(use_coins[i]))

if __name__ == "__main__":
    first = True
    while (True):
        total_fee = int(input(''))
        if total_fee == 0:
            break
        if first:
            first = False
        else:
            print('')
        coins = input('')
        coins = coins.split(' ')  # 10, 50, 100, 500????????§????????????
        coins = [int(coin) for coin in coins]
        coin_values = [10, 50, 100, 500]
        back_oturigation(total_fee, coin_values, coins)

### FIXED CODE ###

import math
def back_oturigation(fee, coin_values, coin_nums):
    """
    1. ?????????????????????????????????£??????????????????
    2. 1????????????????????????????????????????????????????????????
       ????????????§?????????????????????-> ??°?????????????????????¶???????????????????
    3. 2?????????????????????°?????????????????????????????????????????????
    """
    # 1.
    oturi = coin_values[0] * coin_nums[0] \
            + coin_values[1] * coin_nums[1] \
            + coin_values[2] * coin_nums[2] \
            + coin_values[3] * coin_nums[3] \
            - fee

    use_coins = [0] * len(coin_values)
    no_use_coins = [0] * len(coin_values)
 
    # 2.
    for i in range(len(coin_values) - 1, -1, -1):
        no_use_coins[i] = int(oturi / coin_values[i])
        oturi = oturi - (coin_values[i] * no_use_coins[i])
 
    # 3.
    for i in range(0, len(use_coins), 1):
        use_coins[i] = coin_nums[i] - no_use_coins[i]
        if use_coins[i] > 0:
            print(str(coin_values[i]) + ' ' + str(use_coins[i]))
 
if __name__ == "__main__":
    first = True
    while (True):
        total_fee = int(input(''))
        if total_fee == 0:
            break
        if first:
            first = False
        else:
            print('')
        coins = input('')
        coins = coins.split(' ')  # 10, 50, 100, 500?????????§????????????
        coins = [int(coin) for coin in coins]
        coin_values = [10, 50, 100, 500]
        back_oturigation(total_fee, coin_values, coins)
N,M=map(int,input().split())
X=list(map(int,input().split()))
if(len(X)<=N):
  print(0)
else:
  #print(N,M,X)
  sort_X=sorted(X)
  #print(sort_X)
  #print(sort_X[1:],sort_X[0:len(sort_X)-1])
  X_sa=[x - y for (x, y) in zip(sort_X[1:], sort_X[0:len(X)-1])]
  #print(X_sa)
  sort_X_sa=sorted(X_sa)
  #print(sort_X_sa)
  #print(sort_X_sa[:M-N])
  print(sum(sort_X_sa[:M-N]))

### FIXED CODE ###

T,X=map(int,input().split())
print(T/X)