Harryxun/stf_run huggingface dataset:
K=int(input())
S=input()

def printt(S,K):
  if len(S)<=K:
    print(S)
  else:
    print(S[:k]+'...')
      
printt(S,K)


### FIXED CODE ###

N=int(input())

def ass(N):
  if N%10 in [2,4,5,7,9]:
    print('hon')
  elif N%10 in [0,1,6,8]:
    print('pon')
  else:
    print('bon')
   
ass(N)
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

answer = sum(B)
for i in range(len(B)):
  if B[i+1] = B[i]+1:
    answer += C[i]

print(answer)
  

### FIXED CODE ###

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

answer = sum(B)
for i in range(len(A)-1):
  if A[i+1] == A[i]+1:
    answer += C[A[i]-1]

print(answer)
cnt = 0
ans = 0

for i in range(n):
  cnt = b[i] - a[i]
  if cnt > 0:
    ans += a[i]
    if a[i+1] >= cnt:
      ans += cnt
      a[i+1] -= cnt
    else:
      ans += a[i+1]
      a[i+1] =0
      
    
  else:
    ans += b[i]

print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
ans = 0

for i in range(n):
  cnt = b[i] - a[i]
  if cnt > 0:
    ans += a[i]
    if a[i+1] >= cnt:
      ans += cnt
      a[i+1] -= cnt
    else:
      ans += a[i+1]
      a[i+1] =0
      
    
  else:
    ans += b[i]

print(ans)
import numpy as np
N,K = map(int,input().split())
p = list(map(int,input().split()))

l = []
for i in range(N):
    l.append((1+p[i])/2)

a = [0] * N+1
a[0] = l[0]
for i in range(1,len(l)):
    a[i] = a[i-1] + l[i]

ans = 0
for i in range(K,len(l)):
    ans = max(ans,a[i]-a[i-K])

print(ans)

### FIXED CODE ###

import numpy as np
N,K = map(int,input().split())
p = list(map(int,input().split()))

l = []
for i in range(N):
    l.append((1+p[i])/2)

a = [0] * N
a[0] = l[0]
for i in range(1,len(l)):
    a[i] = a[i-1] + l[i]

ans = 0
for i in range(K,len(l)):
    ans = max(ans,a[i]-a[i-K])

if N == 1 or N - K == 0:
    print(max(a))
else:
    print(ans)
n = int(input())
cnts = [k*d*(d+1)//2 for k in range(1,n//2)]
print(sum(cnts)+ (n//2)*d*(d+1)//2)

### FIXED CODE ###

import numpy as np
n = int(input())
cnt = 0

for k in range(1,n+1):
    d = n//k
    if d == 1:
        cnt += (k+n)*(n-k+1)//2
        break
    cnt += k*d*(d+1)//2
print(cnt)
_ = input()
num_list = input().split(" ")
num_list = list(map(lambda x:int(x), num_list))
min_num = min(num_list)

shift_counter = 0

while(True):
  if min_num == 1:
    break
  
  min_num /= 2
  shift_counter += 1

print(shift_counter)

### FIXED CODE ###

string = input()

one_counter = 0
for s in string:
  if s =="1":
    one_counter += 1

print(one_counter)
import sys
sys.setrecursionlimi(9999)
def dfs(i, z):
    print "." * z + name[i]
    for j in child[i]:
        dfs(j, z + 1)

n = int(raw_input())
name = []
child = [[] for i in xrange(n)]
for i in xrange(n):
    k = int(raw_input())
    m = raw_input()
    name.append(m)
    if k == 0: continue
    child[k - 1].append(i)

dfs(0, 0)

### FIXED CODE ###

import sys
sys.setrecursionlimit(9999)
def dfs(i, z):
    print "." * z + name[i]
    for j in child[i]:
        dfs(j, z + 1)

n = int(raw_input())
name = []
child = [[] for i in xrange(n)]
for i in xrange(n):
    k = int(raw_input())
    m = raw_input()
    name.append(m)
    if k == 0: continue
    child[k - 1].append(i)

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

A.sort()
A.reverse()
ans = 0
ans += A[0]

if len(A) % 2 == 0:
  tmp = 0
  for i in range(1, int((N-2)/2)+1):
    tmp += A[i] * 2
else:
  for i in range(1, int((N-1)/2)+1):
    tmp += A[i] * 2
  tmp -= A[int((N-3)/2)]

ans += tmp
print(ans)


### FIXED CODE ###

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

A.sort()
A.reverse()
ans = 0
ans += A[0]

if len(A) % 2 == 0:
  tmp = 0
  for i in range(1, int((N-2)/2)+1):
    tmp += A[i] * 2
else:
  tmp = 0
  for i in range(1, int((N-1)/2)+1):
    tmp += A[i] * 2
  tmp -= A[int((N-1)/2)]

ans += tmp
print(ans)
sx, sy, tx, ty=map(int,inpu().split())

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

s=''
for j in range(4)"
  s+=d[j]*(dirc[j]+i)
s+='D'
for j in range(2):
  s+=d[j]*(dirc[j]+1)
s+='L'
s+='U'
for j in range(2):
  s+=d[j+2]*(dirc[j+2]+1)
s+='R'
print(s)

### FIXED CODE ###

sx, sy, tx, ty=map(int,input().split())

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

def path(sign,x,y,z,w):
  return d[sign+1]*abs(z-x) + d[sign+2]*abs(y-w)

s=''
s+='R'
s+=path(-1, sx+1, sy, tx, ty-1)
s+='UU'
s+=path(1, tx,ty+1,sx-1,sy)
s+='RD'
s+=path(-1, sx,sy-1,tx+1,ty)
s+='LL'
s+=path(1, tx-1,ty,sx,sy+1)
s+='D'
print(s)
import numpy as np

N = int(input())

LR = []
for i in range(N):
  X, L = map(int, input().split())
  LR.append([X-L, 1, i])
  LR.append([X+L, 0, i])

LR.sort()

tree = np.eye(N, dtype=bool)

is_now = np.zeros(N, dtype=bool)
for y, lr, idx in LR:
  if lr == 1:
    is_now[idx] = True
    tree[idx] += is_now
  else:
    is_now[idx] = False

tree += tree.T

a = np.sum(tree)
B = np.argsort(tree.sum(axis=0))[::-1]

for i, b in enumerate(B):
  if a == N:
    break
  tree[b] = tree[:, b] = False
  tree[b, b] = True
  a = np.sum(tree)

print(N - i)

### FIXED CODE ###

N = int(input())

RL = []
for i in range(N):
  x, l = map(int, input().split())
  RL.append([x+l, x-l])

RL.sort()
right = -10**9

ans = 0
for r, l in RL:
  if l >= right:
    right = r
    ans += 1
    
print(ans)
n,a,b=map(int,input().split())
ans=0
def digitsum(n):
  l=len(str(n))
  re=0
  for i in range(l):
    re+=int(str(n[i]))
  return re
for i in range(n):
  if a<=digitsum(i)<=b:
    ans+=i
print(ans)


### FIXED CODE ###

n,a,b=map(int,input().split())
ans=0
def digitsum(n):
  l=len(str(n))
  re=0
  for i in range(l):
    re+=int(str(n)[i])
  return re
for i in range(n+1):
  if a<=digitsum(i)<=b:
    ans+=i
print(ans)
h, w = map(int, input().split())
h_evan = h // 2
h_odd = h_even + (h % 2)
w_evan = w // 2
w_odd = w_even + (w % 2)
print(h_even * w_even + h_odd * w_odd)

### FIXED CODE ###

h, w = map(int, input().split())
if h > 1 and w > 1:
  print((h // 2) * (w // 2) + (h // 2 + h % 2) * (w // 2 + w % 2))
else:
  print(1)
n = input()
ans = ""
for i in range(n):
  if i%2==0:
    ans += n[i]
print(ans)


### FIXED CODE ###

n = input()
ans = ""
for i in range(len(n)):
  if i%2 == 0:
    ans += n[i]
print(ans)
n, q = map(int, input().split())
g=[[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    g[a-1].append(b-1)
    g[b - 1].append(a - 1)

def dfs(idx,costs,visited):
    visited[idx]=1
    for i in g[idx]:
        if visited[i]==1:
            continue
        costs[i]+=costs[idx]
        costs = dfs(i,costs,visited)
    return costs

costs = [0]*n
for i in range(q):
    p, x = map(int, input().split())
    costs[p-1]+=x
visited = [0]*n
costs = dfs(0,costs,visited)
print(*costs)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

#def input():
#  return sys.stdin.readline()[:-1]

n,q=map(int,input().split())
cnt=[0]*(n)
g=[[] for _ in range(n)]
for _ in range(n-1): #木グラフの隣接リストを作成
  a,b=map(int,input().split())
  g[a-1].append(b-1)
  g[b-1].append(a-1)
for _ in range(q):
    a , b = map(int,input().split())
    a = a - 1
    cnt[a] += b

def dfs(now,prev=-1):
  for next in g[now]:
    if next==prev:
      continue
      
    cnt[next]+=cnt[now]
    dfs(next,now)
dfs(0)
print(*cnt)
N=int(input())
A=list(map(int,input().split()))
flag=0

for x in range(100):
  for y in range(N):
    if  A[y]%2==0:
      A[y]=A[y]/2    
    else:
      print(x)
      flag=1
      break
  if flag==1:
    break



### FIXED CODE ###

S1,S2,S3=map(int,input())
print(S1+S2+S3)
def maxHeapify(heap, i):
    while (i + 1) * 2 <= len(heap):
        left = (i + 1) * 2 - 1
        right = (i + 1) * 2
        largest = left if heap[left] > heap[i] else i
        largest = right if heap[right] > heap[largest]
        if largest != i:
            heap[i], heap[largest] = heap[largest], heap[i]
        else:
            break

def buildMaxHeap(heap):
    for i in range(len(heap), 1):
        maxHeapify(heap, i)


n = int(input())
heap = list(map(int, input().split()))
buildMaxHeap(heap)
out = ''
for key in heap:
    out += ' str(key)'
print(out)

### FIXED CODE ###

def maxHeapify(heap, i):
    left = (i + 1) * 2 - 1
    right = (i + 1) * 2
    largest = left if left < len(heap) and heap[left] > heap[i] else i
    largest = right if right < len(heap) and heap[right] > heap[largest] else largest
    if largest != i:
        heap[i], heap[largest] = heap[largest], heap[i]
        maxHeapify(heap, largest)

def buildMaxHeap(heap):
    for i in range(len(heap) // 2, -1, -1):
        maxHeapify(heap, i)

n = int(input())
heap = list(map(int, input().split()))
buildMaxHeap(heap)

out = ''
for key in heap:
    out += (' {}'.format(str(key)))
print(out)
num=input()
n=len(num)
ans=[]
for i in range(n):
    if num[i]=="1":
        num[i] = "9"
    else:
        num[i] = "1"
print(num)

### FIXED CODE ###

num=list(input())
ans=[]
for i in num:
    if i=="1":
        ans.append("9")
    else:
        ans.append("1")

mojiretu = ' '
for x in ans:
    mojiretu += x

print(mojiretu)
i,m = map(int, input().split())
a = [int(input()) for i in range(m)]

memo = [0]*10**5 #i番目の数列を格納するためのメモ
def fib(n):
    if n in a:
        return 0
    if n<=1:
        return 1 #0,1番目の数列はo,1
    if memo[n] != 0:
        return memo[n] #i番目の数列がmemoにある場合それを返す
    memo[n] = fib(n-1) + fib(n-2) #i番目の数列の計算
    return memo[n]

print(fib(i)%1000000007)

### FIXED CODE ###

n,m = map(int, input().split())
a = set([int(input()) for i in range(m)])
memo = [0]*(n+1)

memo[0] = 1
if 1 in a:
    memo[1] = 0
else:
    memo[1] = 1
for i in range(2,n+1):
    if i in a:
        continue
    memo[i] = (memo[i-1] + memo[i-2])%1000000007

print(memo[n])
n, l = map(int, input().split())
lists = []
for i in n:
    list.apend(input())
lists.sort()
s = ''
for list in lists:
    s += list
print(s)

### FIXED CODE ###

n, l = map(int, input().split())
list = []
for i in range(n):
    list.append(input())
list.sort()
s = ''.join(list)
print(s)
N, K = map(int, input().split())

def combination(a, b):
    minb = min(a-b, b)
    r = 1
    for i in range(1, b+1):
        r = r * (a-b+i)/i
    return r

if K == N:
    print(0)
    import sys
    sys.exit()

for i in range(1, K+1):
    if i-1 == 0:
        must = 1
    else:
        must = combination(K-1, i-1)
    left_ball = N-K-i+1
    if left_ball < 0:
        print(0)
        continue
    elif left_ball == 0:
        print(1)
        continue
    can = combination(left_ball+i, i)
    print(int((must*can)%(1000000007)))

### FIXED CODE ###

N, K = map(int, input().split())
mod = 10**9+7

import math

def combination(a, b):
    minb = min(a-b, b)
    r = 1
    for j in range(1, minb+1):
        r = r * (a-minb+j)//j
    return int(r)

for i in range(1, K+1):
    if N==K and i!=1:
        print(0)
        continue
    must = combination(K-1, i-1)
    if must is None:
        print("K:"+str(K)+", i:"+str(i))
    left_ball = N-K-i+1
    if left_ball < 0:
        print(0)
        continue
    can = combination(left_ball+i, i)
    print((must*can)%mod)
s = input()
a = len(s)
for i in s:
    if s[i] == s[a - 1 -i] :
        b = 1
    else:
        b = 0
        break


if b == 1:
    print('Yes')
else:
    print('No')



### FIXED CODE ###

s = input()
a = len(s)
i = 0
for i in range(a):
    if s[i] == s[a - 1 - i]:
        b = 1
    else:
        b = 0
        break


if b == 1:
    print('Yes')
else:
    print('No')
def main():
    mod = 10**9+7
    #n,a = get_input()
    n = int(input())
    a = [int(x) for x in input().split()]
    aa = [a**2 % mod for x in a]
    ans = 0
    asum = sum(a) 
    p = asum ** 2 % mod
    q = sum(aa) % mod
    ans = (p - q) % mod
    if ans < 0:
      ans += mod
    if ans % 2 == 1:
      ans += mod
    ans = ans // 2
    print(ans)
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    mod = 10**9+7
    #n,a = get_input()
    n = int(input())
    a = [int(x) for x in input().split()]
    ans = 0
    asum = sum(a) 
    for i in range(n):
        asum = asum - a[i]
        ans = ( ans + ((a[i] * asum) % mod)) % mod
    
    print(ans)
    
if __name__ == '__main__':
    main()
n = int(input())
data = []
for i in range(n-1):
    station_data = [int(x) for x in input().split()]
    data.append(station_data)

time_list = []

for i in range(n-1):
    total_time = data[i][1] + data[i][0]

    for j in range(i+1, n-1):
        if total_time <= data[j][1]:
            total_time = data[j][1] + data[j][0]

        elif total_time % data[j][2] == 0:
            total_time += data[j][0]

        else:
            total_time += total_time % data[j][2] + data[j][0]

    time_list.append(total_time)

time_list.append(0)

answer = map(str, time_list)
for i in range(n):
    print(answer[i])

### FIXED CODE ###

n = int(input())
data = []
for i in range(n-1):
    station_data = [int(x) for x in input().split()]
    data.append(station_data)

time_list = []

for i in range(n):
    total_time = 0

    for j in range(i, n-1):
        if total_time <= data[j][1]:
            total_time = data[j][1] + data[j][0]

        elif total_time % data[j][2] == 0:
            total_time += data[j][0]

        else:
            total_time += data[j][2] - total_time % data[j][2] + data[j][0]

    time_list.append(total_time)

answer = map(str, time_list)
print("\n".join(answer))
N=input()
A=input()
N!=0
B=N%500
if(B < A):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")
if a>k and a>0:
    a-=k
else:
    if b>k-a and b>0:
        b-=(k-a)
    else:
        b=0
    a=0
print(str(a)+" "+str(b))

### FIXED CODE ###

a,b,k = map(int,input().split())
if a>k and a>0:
    a-=k
else:
    if b>k-a and b>0:
        b-=(k-a)
    else:
        b=0
    a=0
print(str(a)+" "+str(b))
n=int(input())
cc=[int(input()) for _ in range(n)]


c=[cc[0]]
for i in range(1,n):
    if cc[i]!=cc[i-1]:
        c.append(cc[i])

n=len(c)

right_index=[-1]*n
tmp_right_index=[-1]*n

for i in range(n):
    if tmp_right_index[c[i]]==-1:
        tmp_right_index[c[i]]=i
    else:
        right_index[i]=tmp_right_index[c[i]]
        tmp_right_index[c[i]]=i

dp=[0]*n

#print(0,c)
for i in range(n):
    if i==0:
        dp[i]=1
    else:
        if right_index[i]==-1:
            dp[i]+=dp[i-1]
        else:
            dp[i]+=dp[i-1]+dp[right_index[i]]

print(dp[-1])







    



### FIXED CODE ###

n=int(input())
cc=[int(input()) for _ in range(n)]


c=[cc[0]]
for i in range(1,n):
    if cc[i]!=cc[i-1]:
        c.append(cc[i])

n=len(c)

right_index=[-1]*n
tmp_right_index=[-1]*(max(c)+1)

for i in range(n):
    if tmp_right_index[c[i]]==-1:
        tmp_right_index[c[i]]=i
    else:
        right_index[i]=tmp_right_index[c[i]]
        tmp_right_index[c[i]]=i

dp=[0]*n
mod=10**9+7
#print(0,c)
for i in range(n):
    if i==0:
        dp[i]=1
    else:
        if right_index[i]==-1:
            dp[i]+=dp[i-1]%mod
        else:
            dp[i]+=dp[i-1]+dp[right_index[i]]%mod

print(dp[-1]%mod)
S=input()

for i in range(1<<3):
  tmp+=S[0]
  for j in range(3):
    if i>>j&1==1:
      tmp+='+'
    else:
      tmp+='-'
  if eval(tmp)==7:
    break
print(tmp+'=7')
    

### FIXED CODE ###

S=input()
for i in range(1<<3):
  tmp=S[0]
  for j in range(3):
    if i>>j&1==1:
      tmp+='+'
    else:
      tmp+='-'
    tmp+=S[j+1]
  if eval(tmp)==7:
    break
print(tmp+'=7')
n = int(raw_input())
minv =  10**9
R[0] = 0
maxv = (-1)*10**9

for j in range(0, n-1):
    if minv >= R[j]:
       minv = R[j]
    if maxv <= R[j+1] - minv:
       maxv = R[j+1] - minv
print maxv

### FIXED CODE ###

n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9  

for j in range(n-1):
    a = int(raw_input())
    b = a- minv
    if maxv < b:
       maxv = b 
    if minv > a:
       minv = a

print maxv
def longdist(p, dp_l, out_l):
    if len(out_l[p]) == 0:
        return 0
    for q in out_l[p]:
        if dp_l[q] == -1:
            dp_l[q] = longdist(q, dp_l, out_l)
        dp_l[p] = max(dp_l[p], dp_l[q]+1)
    return dp_l[p]

n, m = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(m)]

input, output = [[] for _ in range(n)], [[] for _ in range(n)]
for x, y in xy:
    input[y - 1].append(x - 1)
    output[x - 1].append(y - 1)

dp = [-1] * n
for i in range(n):
    if dp[i] == -1:
        dp[i] = longdist(i, dp, output)

print(max(dp))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)


def longdist(p, dp_l, out_l):
    if len(out_l[p]) == 0:
        return 0
    for q in out_l[p]:
        if dp_l[q] == -1:
            dp_l[q] = longdist(q, dp_l, out_l)
        dp_l[p] = max(dp_l[p], dp_l[q]+1)
    return dp_l[p]


n, m = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(m)]

input, output = [[] for _ in range(n)], [[] for _ in range(n)]
for x, y in xy:
    input[y - 1].append(x - 1)
    output[x - 1].append(y - 1)

dp = [-1] * n
for i in range(n):
    if dp[i] == -1:
        dp[i] = longdist(i, dp, output)

print(max(dp))
if sum(s)%10 != 0:
    print(sum(s))
else:
    for i in range(N):
        if s[i]%10 != 0:
            print(sum(s)-s[i])
            break
        if i == N-1:
            print(0)

### FIXED CODE ###

N = int(input())
s = sorted([int(input()) for _ in range(N)])
if sum(s)%10 != 0:
    print(sum(s))
else:
    for i in range(N):
        if s[i]%10 != 0:
            print(sum(s)-s[i])
            break
        if i == N-1:
            print(0)
import math
R = range(1,100)
def Circle(R):
    return 2 * math.pi * R
  
Circle(R)

### FIXED CODE ###

import math
R = int(input())
print(2 * math.pi * R)
x = input()
for ans in x:
    if ans < 1200:
        print("ABC")
    else:
        print("ARC")

### FIXED CODE ###

x = int(input())
if x < 1200:
    print("ABC")
else:
    print("ARC")
h,w=map(int,input().split())
s=[list(input()) for i in range(h)]

dxy=[(-1,0),(0,1),(0,-1),(1,0)]
for i in range(h):
  for j in range(w):
    if s[i][j]=="#":
      f=False
      for x,y in dxy:
        
        if 0<=i+x<=h-1 and 0<=j+y<=w-1 and s[i+x][j+y]=="#":
          f=True
      
      if not f:
        print("No")
        
        
if f:
  print("Yes")





### FIXED CODE ###

h,w=map(int,input().split())
s=[list(input()) for i in range(h)]

dxy=[(-1,0),(0,1),(0,-1),(1,0)]
for i in range(h):
  for j in range(w):
    if s[i][j]=="#":
      f=False
      for x,y in dxy:
        
        if 0<=i+x<=h-1 and 0<=j+y<=w-1 and s[i+x][j+y]=="#":
          f=True
      
      if not f:
        print("No")
        exit()
        
        

print("Yes")
a = input()
s = [int(i) for i in a]
count = 0
ans = 0
while True:
    if (len(s) == count+1) or len(s) == 0:
        break
    if (s[count] == 0 and s[count+1] == 1) or (s[count] == 1 and s[count+1] == 0):
        ans += 1
        s.pop(count)
        s.pop(count)
        count -= 1
    else:
        count += 1
print(ans*2)


### FIXED CODE ###

a = input()
s = [int(i) for i in a]
count = 0
ans = 0
while True:
    if (len(s) == count+1) or len(s) == 0:
        break
    if (s[count] == 0 and s[count+1] == 1) or (s[count] == 1 and s[count+1] == 0):
        ans += 1
        s.pop(count)
        s.pop(count)
        if count != 0:
            count -= 1
    else:
        count += 1
print(ans*2)
n = int(input())
h_list = list(map(int,input().split()))
cost_min_list = [0] * n
cost_min_list[0] = 0
cost_min_list[1] = h_list[0]
for i in range(2, n):
    cost_min_list[i] = min(cost_min_list[i - 1] + abs(h_list[i] - h_list[i - 1]),
                           cost_min_list[i - 2] + abs(h_list[i] - h_list[i - 2]))
print(cost_min_list[n])

### FIXED CODE ###

n = int(input())
h_list = list(map(int,input().split()))
cost_min_list = [0] * n
cost_min_list[0] = 0
cost_min_list[1] = abs(h_list[1] - h_list[0])
for i in range(2, n):
    cost_min_list[i] = min(cost_min_list[i - 1] + abs(h_list[i] - h_list[i - 1]),
                           cost_min_list[i - 2] + abs(h_list[i] - h_list[i - 2]))
print(cost_min_list[n - 1])
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort(
y = []
for i in range(m - 1):
    y.append(x[i + 1] - x[i])
y.sort()
count = 0
for i in range(m - n):
    count += y[i]
print(count)

### FIXED CODE ###

n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
y = []
for i in range(m - 1):
    y.append(x[i + 1] - x[i])
y.sort()
count = 0
for i in range(m - n):
    count += y[i]
print(count)
N  = int(input())
num = list(map(int, input().split()))
num.sort()
count = 1

for i in range(N-1):
    if not num[i] == num[i+1]:
        count += 1
print(count)

### FIXED CODE ###

N  = int(input())
num = list(map(int, (input() for h in range(N))))
num.sort()
count = 1

for i in range(N-1):
    if not num[i] == num[i+1]:
        count += 1
print(count)
from collections import defaultdict
X, Y = map(int, input().split())
d = defaultdict(int)
d[1] = 300000
d[2] = 200000
d[3] = 100000
ans = d[X]+d[Y]
if X==1 and Y==1:
  ans += 400000
print(ans

### FIXED CODE ###

from collections import defaultdict
X, Y = map(int, input().split())
d = defaultdict(int)
d[1] = 300000
d[2] = 200000
d[3] = 100000
ans = d[X]+d[Y]
if X==1 and Y==1:
  ans += 400000
print(ans)
a,b,c=map(int,input().split())
print(max(a,b,c)*9+a+b+C)

### FIXED CODE ###

a,b,c=map(int,input().split())
print(max(a,b,c)*9+a+b+c)
h,w=map(int,input().split())
graph=[]
for i in range(h):
  graph.append(list(input()))
#print(graph)
dp=[[0]*(w) for _ in range(h)]
dp[0][0]=1
for i in range(1,w):
  dp[0][i]=dp[0][i-1] if graph[0][i]=='.' else 0
for i in range(1,h):
  dp[i][0]=dp[i-1][0] if graph[0][i]=='.' else 0
for i in range(1,h):
  for j in range(1,w):
    #print(i-1,j-1)
    if(graph[i-1][j-1]=='#'):
      dp[i][j]=0
    else:
      dp[i][j]=(dp[i-1][j]+dp[i][j-1])%(1e9 + 7)

print(int(dp[-1][-1]))

### FIXED CODE ###

MOD = 1000000007
h,w=map(int,input().split())
graph=[]
for i in range(h):
  graph.append(list(input()))
#print(graph)
dp=[[0]*(w) for _ in range(h)]
dp[0][0]=1
for i in range(1,w):
  if graph[0][i]=='#':
    break
  dp[0][i]=1
for i in range(1,h):
  if graph[i][0]=='#':
    break
  dp[i][0]=1
for i in range(1,h):
  for j in range(1,w):
    #print(i-1,j-1)
    if(graph[i][j]=='#'):
      dp[i][j]=0
    else:
      dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD

print(dp[-1][-1])
k = input('整数を入力してください：')

while k.replace('-', '').isdigit() == False or int(k) > 100 or int(k) < 1:
    print('Error')
    k = input('整数を入力してください：')
else:
    k = int(k)
k = int(k)

x = input('整数を入力してください：')

while x.replace('-', '').isdigit() == False or int(x) > 100 or int(x) < 0:
    print('Error')
    x = input('整数を入力してください：')
else:
    x = int(x)
x = int(x)


result = []
for i in range(x,-k,-1):
    result.append(i)
for j in range(x+1,k):
    result.append(j)
result.sort()
print(format(result))

### FIXED CODE ###

k,x = map(int, input().split())

for i in range(x-k+1,x+k):
    print(i, end = " ")
has_seven = False
for i in range(str(N)):
  if N[i] == '7':
    has_seven = True
    break
if has_seven:
  print("Yes")
else:
  print("No")


### FIXED CODE ###


has_seven = False
N = str(input())
for i in range(len(N)):
  if N[i] == '7':
      has_seven = True
      break

if has_seven:
  print("Yes")
else:
  print("No")
s=input()
n=len(s)
r=""
c=0
for i in range (n):
    if s[i]=='?':
        r.append('D')
    else:
        r.append(s[i])
print(r)

### FIXED CODE ###

s=input()
print(s.replace("?", "D"))
import sys # モジュール属性 argv を取得するため
 
argvs = sys.argv  # コマンドライン引数を格納したリストの取得
argc = len(argvs) # 引数の個数
# デバッグプリント
print argvs
print argc

### FIXED CODE ###

# -*- coding: utf-8 -*-
# get a integer
num = int(raw_input())
# get two integers separated with half-width break
array = map(int, raw_input().split())
# get a string
#s = raw_input()

state = 0
way_total = 0
for j in range(0,num):
    way_total += abs(array[j] - state)
    state = array[j]
way_total += abs(state)

for i in range(0,num):
    if i != num - 1 and i != 0:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i+1] - array[i]) + abs(array[i-1] - array[i+1])
    elif i == 0:
        way = way_total - abs(array[i])- abs(array[i+1] - array[i]) + abs(array[i+1])
    elif i == num - 1:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i]) + abs(array[i-1] - 0)
    print(way)