Harryxun/stf_run huggingface dataset:
s = input()
t = input()

if len()

def match(i):
  for j in range(len(t)):
    if not s[i+j] == '?' and s[i+j] != t[j]:
      return False
  return True

for i in range(len(s) - len(t), -1, -1):
  if not match(i):
    continue

  for j in range(i):
    print('a' if s[j] == '?' else s[j], end='')
  print(t, end='')
  for j in range(i+len(t), len(s)):
    print('a' if s[j] == '?' else s[j], end='')
  print()
  exit()
    
print('UNRESTORABLE')

### FIXED CODE ###

s = input()
t = input()

def match(i):
  for j in range(len(t)):
    if not s[i+j] == '?' and s[i+j] != t[j]:
      return False
  return True

for i in range(len(s) - len(t), -1, -1):
  if not match(i):
    continue

  for j in range(i):
    print('a' if s[j] == '?' else s[j], end='')
  print(t, end='')
  for j in range(i+len(t), len(s)):
    print('a' if s[j] == '?' else s[j], end='')
  print()
  exit()
    
print('UNRESTORABLE')
s,t = map(int,input().split())
a,b = map(int,input().split())
u = input()
if u == s:
  a -= 1
else:
  b -= 1
print('{0} {1}'.format(a,b))

### FIXED CODE ###

s,t = input().split()
a,b = map(int,input().split())
u = input()
if u == s:
  a -= 1
else:
  b -= 1
print('{0} {1}'.format(a,b))
# coding: utf-8
# Your code here!
x=input()
y=input()

if x<=0 or x>=10 or y<=0 or y>=10:
    print("-1")
else:
    print(x*y)

### FIXED CODE ###

# coding: utf-8
# Your code here!
x,y=input().split()

if int(x)<=0 or int(x)>=10 or int(y)<=0 or int(y)>=10:
    print("-1")
else:
    print(int(x)*int(y))
from collections import defaultdict


def dfs(p, x):
    counter[p] += x
    for c in children[p]:
        dfs(c, x)


children = defaultdict(list)

N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N-1)]
px = [list(map(int, input().split())) for _ in range(Q)]
counter = [0] * N

for i in range(N-1):
    a = ab[i][0] - 1
    b = ab[i][1] - 1
    children[a] += [b]
for i in range(Q):
    p = px[i][0] - 1
    x = px[i][1]
    dfs(p, x)
ans = []
for i in range(N):
    ans.append(counter[i])
print(' '.join(map(str, ans)))


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def dfs(cur, par):
    for child in edge[cur]:
        if child == par:
            continue
        counter[child] += counter[cur]
        dfs(child, cur)


N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N-1)]
px = [list(map(int, input().split())) for _ in range(Q)]
counter = [0] * N

edge = [[] for _ in range(N)]
for i in range(N-1):
    a = ab[i][0] - 1
    b = ab[i][1] - 1
    edge[a].append(b)
    edge[b].append(a)

for i in range(Q):
    p = px[i][0] - 1
    x = px[i][1]
    counter[p] += x


dfs(0, -1)
print(*counter)
import sys
def getmax():
    max = 0
    for i in p:
        if i > max:
            max = i
    return max
def getmin():
    min = p[0]
    for i in p:
        if i < min:
            min = i
    return min
X,N = map(int,input().split())
if N ==0:
    print(X)
    sys.exit()
if N == 1:
    p = int(input())
else:
    p = list(map(int,input().split()))  #
MIN = 101   #
minnum = 0
for i in range(-101,102):
    if not i in p:
        if abs(i-X) < MIN:
            MIN = abs(i-X)
            minnum = i
print(minnum)


### FIXED CODE ###

import sys
def getmax():
    max = 0
    for i in p:
        if i > max:
            max = i
    return max
def getmin():
    min = p[0]
    for i in p:
        if i < min:
            min = i
    return min
X,N = map(int,input().split())
if N ==0:
    print(X)
    sys.exit()
if N == 1:
    p = int(input())
    print(p-1)
    sys.exit()
p = list(map(int,input().split()))  #
MIN = 101   #
minnum = 0
for i in range(-101,102):
    if not i in p:
        if abs(i-X) < MIN:
            MIN = abs(i-X)
            minnum = i
print(minnum)
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N,M = input_int()

data = []
for i in range(M):
    s,c = input_int()
    data.append([s,c])

output = [0 for i  in range(N)]

def solve(N, data):
    mins = 100000000000
    for i in range(10**N):

        temp = str(i)
        flg = True
        for d in data:
            if temp[d[0]-1] != str(d[1]) and len(temp)==N:
                flg = False
                break
        if flg==True:
            return temp
    return -1

output = solve(N,data)
print(output)

### FIXED CODE ###

def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N,M = input_int()

data = []
for i in range(M):
    s,c = input_int()
    data.append([s,c])

def solve(N, data):
    mins = 100000000000
    for i in range(10**N):

        temp = str(i)
        flg = True
        if len(temp)==N:
            for d in data:
                if temp[d[0]-1] != str(d[1]):
                    flg = False
                    break
            if flg==True:
                return temp
    return -1

output = solve(N,data)
print(output)
import fractions,sys

n,m=map(int,input().split())
a = list(map(int, input().split()))
# ans = a[0]
# for i in range(1,n):
#     ans = ans * a[i] // fractions.gcd(ans, a[i])
ff=[]
for j in  a:
    count=0
    for i in range(1,36):
        if j%(2**i)==0:
            count+=1
    ff.append(count)
ff=[i==ff[0] for i in ff]

 
# b = [int(i/2) for i in a]
# b_list=[i%4==0 for i in b]
# bb=sum(b_list)
# if bb!=0 and bb!=n:
if all(ff)==False:
    print(0)
#     exit()

ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // fractions.gcd(ans2, b[i])

# tf=[(ans2/i)%2==0 for i in b]
# and any(tf)
if ans2>m:
    print(0)
else:
    print((m-ans2)//(ans2*2)+1)

### FIXED CODE ###

import fractions,sys

n,m=map(int,input().split())
a = list(map(int, input().split()))
# ans = a[0]
# for i in range(1,n):
#     ans = ans * a[i] // fractions.gcd(ans, a[i])
ff=[]
for j in  a:
    count=0
    for i in range(1,36):
        if j%(2**i)==0:
            count+=1
    ff.append(count)
ff=[i==ff[0] for i in ff]

 
b = [int(i/2) for i in a]
# b_list=[i%4==0 for i in b]
# bb=sum(b_list)
# if bb!=0 and bb!=n:
if all(ff)==False:
    print(0)
    exit()

ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // fractions.gcd(ans2, b[i])

# tf=[(ans2/i)%2==0 for i in b]
# and any(tf)
if ans2>m:
    print(0)
else:
    print((m-ans2)//(ans2*2)+1)
N, X = map(int, input().split())
x = [abs(X - int(i)) for i in input().split()]

def f(a, b):
    if b == 0:
        return a
    return f(b, a % b)

tmp = 1
for i in range(len(x)-1):
    x[i+1] = f(x[i], x[i+1])

print(x[len(x)])


### FIXED CODE ###

N, X = map(int, input().split())
x = [abs(X - int(i)) for i in input().split()]

def f(a, b):
    if b == 0:
        return a
    return f(b, a % b)

tmp = 1
for i in range(len(x)-1):
    x[i+1] = f(x[i], x[i+1])

print(x[len(x)-1])
R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
 L=[];t=''
 for e in input()[:-1]:
  if e.isdigit():t+=e
  else:
   if t:L+=[t];t=''
   L+=e
 if t:L+=[t]
 P,S=[],[]
 for i in L:
  if"("==i:S+=i
  elif")"==i:
   while"("!=S[-1]:P+=S.pop()
   S.pop()
  elif i in R:
   while S and R[S[-1]]>=R[i]:P+=S.pop()
   S+=i
  else:P+=[i]
 while S:P+=S.pop()
 for x in P:
  S+=[str(eval(S.pop(-2)+p+S.pop()))if x in"+-*/"else x]
 print(*S)


### FIXED CODE ###

R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
 L=[];t=''
 for e in input()[:-1]:
  if e.isdigit():t+=e
  else:
   if t:L+=[t];t=''
   L+=e
 if t:L+=[t]
 P,S=[],[]
 for i in L:
  if"("==i:S+=i
  elif")"==i:
   while"("!=S[-1]:P+=S.pop()
   S.pop()
  elif i in R:
   while S and R[S[-1]]>=R[i]:P+=S.pop()
   S+=i
  else:P+=[i]
 while S:P+=S.pop()
 for x in P:
  S+=[str(int(eval(S.pop(-2)+x+S.pop())))if x in"+-*/"else x]
 print(*S)
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
  
N,K = map(int,imput().split())
A = Base_10_to_n(N, K)
print(len(A))


### FIXED CODE ###

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
  
N,K = map(int,input().split())
A = Base_10_to_n(N, K)
print(len(A))
a,b = map(int, input().split())
c = a * b
if c % 2 == 0:
	print('Even')
  else:
  	print('Odd')

### FIXED CODE ###

a,b = map(int, input().split())
c = a * b
if c % 2 == 0:
	print('Even')
else:
  	print('Odd')
k = int(input())
gx,gy = map(int,input().split())
if k%2 == 0 and (gx+gy)%2:
  print(-1)
  exit()
flgx = 1
flgy = 1
if gx < 0:
  flgx -= 2
  gx *= -1
if gy < 0:
  flgy -= 2
  gy *= -1
px = 0
py = 0
ansls = []
while True:
  if (gx-px+gy-py) <= 2*k:
    break
  if gx-px >= k:
    px += k
  elif gy-py >= k:
    py += k
  ansls.append((px,py))
if (gx-px+gy-px)//k <= 2:
  if gx-px+gy-px == k:
    ansls.append((gx-px,gy-px))
    px,py = gx,gy
  else:
    if (gx-px+gy-py)%2:
      if px+k <= gx:
        px += k
      elif py+k <= gy:
        py += k
      elif px+py+k <= gx+gy:
        px = gx
        py += k-(gx-px)
      else:
        py -= gx-px
        px -= k-(gx-px)
      ansls.append((px,py))
    if gx-px <= gy-py:
      ansls.append((px+(gx-px+gy-py)//2-k,py+(gx-px+gy-py)//2))
    else:
      ansls.append((px+(gx-px+gy-py)//2,py+(gx-px+gy-py)//2-k))
    ansls.append((gx,gy))
for i in range(len(ansls)-1):
  if abs(ansls[i+1][0]-ansls[i][0])+abs(ansls[i+1][1]-ansls[i][1]) != k:
    print(2/0)
print(len(ansls))
for x,y in ansls:
  print(x*flgx,y*flgy)

### FIXED CODE ###

k = int(input())
gx,gy = map(int,input().split())
if k%2 == 0 and (gx+gy)%2:
  print(-1)
  exit()
flgx = 1
flgy = 1
if gx < 0:
  flgx -= 2
  gx *= -1
if gy < 0:
  flgy -= 2
  gy *= -1
px = 0
py = 0
ansls = []
while True:
  if (gx-px+gy-py) <= 2*k:
    break
  if gx-px >= k:
    px += k
  elif gy-py >= k:
    py += k
  ansls.append((px,py))
if gx-px+gy-py <= 2*k:
  if gx-px+gy-py == 2*k:
    if px+k <= gx:
      px += k
    else:
      py += k
    ansls.append((px,py))
  if gx-px+gy-py == k:
    ansls.append((gx,gy))
  else:
    if (gx-px+gy-py)%2:
      if px+k <= gx:
        px += k
      elif py+k <= gy:
        py += k
      elif px+py+k <= gx+gy:
        py += k-(gx-px)
        px = gx
      else:
        py -= gx-px
        px -= k-(gx-px)
      ansls.append((px,py))
    if gx-px <= gy-py:
      ansls.append((px+(gx-px+gy-py)//2-k,py+(gx-px+gy-py)//2))
    else:
      ansls.append((px+(gx-px+gy-py)//2,py+(gx-px+gy-py)//2-k))
    ansls.append((gx,gy))
for i in range(len(ansls)-1):
  if abs(ansls[i+1][0]-ansls[i][0])+abs(ansls[i+1][1]-ansls[i][1]) != k:
    print("error")
print(len(ansls))
for x,y in ansls:
  print(x*flgx,y*flgy)
A, B = map(int, input().strip().split())

def is_palind(x):
  sx = str(x)
  if x[0]==x[-1] and x[1]==x[-2]:
    return True
  else:
    return False

c = 0
for a in range(A, B+1):
  if is_palind(a):
    c+=1

print(c)

### FIXED CODE ###

A, B = map(int, input().strip().split())

def is_palind(x):
  sx = str(x)
  if sx[0]==sx[-1] and sx[1]==sx[-2]:
    return True
  else:
    return False

c = 0
for a in range(A, B+1):
  if is_palind(a):
    c+=1

print(c)
n = int(input())
p = [int(input()) for in range(n)]
print(sum(p) - max(p)//2)
 

### FIXED CODE ###

n = int(input())
p = [int(input()) for i in range(n)]
print(sum(p) - max(p)//2)
# -*- coding: utf-8 -*-
line = map(int, input().split())

ans = "YES" if line.count(5) == 2 and line.count(7) == 1 else "NO"

print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
line = map(int, input().split())
#ans = "YES" if line.count(5) == 2 and line.count(7) == 1 else "NO"

if sorted(line) == [5, 5, 7]:
    print("YES")
else:
    print("NO")
n,m = map(int,input().split())
a = []
mod = 10**9+7
for i in range(m):
    b = int(input())
    a.append(b)
d = [0 for i in range(n+1)]
d[0] = 0
d[1] = 1
d[2] = 2
for i in range(3,n+1):
    d[i] = d[i-1] + d[i-2]
d.append(0)
ans = 1
if a[0] == 1:
    ans = 1
else:
    ans = ans*d[a[0]-1]%mod
for i in range(m-1):
    ans = ans*d[a[i+1]-a[i]-2]%mod
ans = ans*d[n-a[m-1]-1]%mod
print(ans)




### FIXED CODE ###

n,m = map(int,input().split())
a = []
mod = 10**9+7
d = [0 for i in range(n+1)]
d[0] = 1
d[1] = 1
if n >1 :
    d[2] = 2
for i in range(3,n+1):
    d[i] = d[i-1] + d[i-2]
if m != 0:
    d.append(0)
    for i in range(m):
        b = int(input())
        a.append(b)
    ans = 1
    if a[0] == 1:
        ans = 1
    else:
        ans = ans*d[a[0]-1]%mod
    for i in range(m-1):
        ans = ans*d[a[i+1]-a[i]-2]%mod
    ans = ans*d[n-a[m-1]-1]%mod
else:
    ans = d[n]%mod
print(ans)
S = list(input())
A = ['A', 'C', 'G', 'T']
T = []
ans = 0
for e in S:
	if e in A:
		ans += 1
	else:
		T.append(ans)
		ans = 0
print(max(T))

### FIXED CODE ###

S = list(input())
A = ['A', 'C', 'G', 'T']
T = []
ans = 0
for e in S:
	if e in A:
		ans += 1
	else:
		T.append(ans)
		ans = 0
T.append(ans)
print(max(T))
list = []
while True:
    num = list(map(int,input().split()))
    if(num[0] == 0 and num[1] == 0):
        break
    else:
        if(num[0] > num[1]):
            print("%d %d" %(num[1],num[0]))
        else:
            print("%d %d" %(num[0],num[1]))
            


### FIXED CODE ###

while True:
    num = list(map(int,input().split()))
    if(num[0] == 0 and num[1] == 0):
        break
    else:
        if(num[0] > num[1]):
            print("%d %d" %(num[1],num[0]))
        else:
            print("%d %d" %(num[0],num[1]))
from math import trunc
a,b = input().split()
a = int(a)
b = float(b)

print("{}".format(int(a*b)))


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
new = 1
if 0 in a:
	print(0)
	exit()
for i in a:
	new *= i
	if new > (10**18):
		new = -1
		break
print(new)
from string import*
from itertools import*
b = ascii_lowercase
s = input()
if len(s) < 26:
    x = z = s, y = b, d = 0
else:
    d = [p*len(list(k)) for p, k in groupby([i < j for i, j in zip(s[-1::-1], s[-2::-1])])][0] - 2
    x, y, z = s[:d], s[d+1:], b[:ord(s[d]) - 97]
print(-(d < -26) or x + sorted(set(y) - set(z))[0])

### FIXED CODE ###

#!/usr/bin/env python3
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    t = s[::-1]
    a = [(p, len(list(k))) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0]
    d = - a[0]*a[1] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])
from collections import deque
n = int(input())
a = deque(list(map(int, input().split())))
ans = []
for i in range(1,n+1):
    ans[a.popleft()] = i
    
print(*ans)

### FIXED CODE ###

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

ans = [0 for i in range(n)]
for i, name in enumerate(a):
    ans[name-1] = i+1
print(*ans)
A, B, C, D = map(int, input().split())
print(
  len(set(list(range(A, B+1)))
      - set(list(range(C, B+1, C)))
      - set(list(range(D, B+1, D))))
)

### FIXED CODE ###

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

a, b, c, d = map(int, input().split())
g = gcd(c, d)
l = int(c*d/g)

print((b - a + 1) - ((b//c - (a-1)//c) + (b//d - (a-1)//d) - (b//l - (a-1)//l)))
a,b,c=map(int,input().split())

if a%2==b%2 and b%2==c%2 and a%2==c%2:
    m=max(a,b,c)
    count=(m-a)//2+(m-b)//2+(m-c)//2
else:
    count=(m-a)//2+(m-b)//2+(m-c)//2+1
print(count)

### FIXED CODE ###

a,b,c=map(int,input().split())
m=max(a,b,c)*3
f=a+b+c
if (m-f)%2==0:
    print((m-f)//2)
else:
    print((m-f)//2+2)
import fractions

a,b=map(int,input().split())
print(int((a * b /fraction.gcd(a, b))))

### FIXED CODE ###

import fractions
 
a,b=map(int,input().split())
print(int((a * b /fractions.gcd(a, b))))
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N, M = map(int, input().split())
    a_list = [int(input()) for _ in range(M)]

    def comb(N):
        if N<0:
            return 0
        if N==0:
            return 1

        dp=[[0 for _ in range(N+1)] for _ in range(3)]

        for j in range(1,N+1):
            for i in [1,2]:
                if j == i:
                    dp[i][j] = 1
                else:
                    dp[i][j] = dp[1][j-i] + dp[2][j-i]
        return dp[1][N]+dp[2][N]

    divider = 1000000007
    p = 0
    ans = 1

    for a in a_list:
        r = comb(a-1-p)%divider
        ans = ans%divider 
        ans = (ans*r)%divider 
        p = a + 1
    else:
        if a < N:
            r = comb(N-p)%divider
            ans = ans%divider
            ans = (ans*r)%divider

    print(ans)
        

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc129","c",main)

### FIXED CODE ###

#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N, M = map(int, input().split())
    a_list = [int(input()) for _ in range(M)]

    p = 0
    steps=[]
    m = 0
    for a in a_list:
        if a != 1:
            steps.append((p, a-1))
            m = max(m, a-p)
        p = a + 1
    else:
        steps.append((p, N))
        m = max(m, N-p+1)

    dp=[0 for _ in range(m+1)]

    divider = 1000000007
    dp[0], dp[1] = 1, 1
    for i in range(2,m+1):
        dp[i]=(dp[i-1]+dp[i-2])%divider

    ans = 1
    for p, n in steps:
        if n < p:
            ans = 0
            break
        else:
            r = dp[n-p]
        ans = (ans*r)%divider 

    print(ans)
        

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc129","c",main)
import sys
from collections import deque


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
A = inintl()

m = min(A)

mod_min = 10**9

for a in A:
    if a % m == 0:
        continue
    mod_min = min(mod_min, a % m)

if mod_min == 10**9:
    print(m)
else:
    print(max(mod_min % (m % mod_min), 1))


### FIXED CODE ###

import sys
import math


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
A = inintl()

m = min(A)

mod_min = 10**9

for a in A:
    if a % m == 0:
        continue
    mod_min = min(mod_min, a % m)

if mod_min == 10**9:
    print(m)
else:
    print(math.gcd(m, mod_min))
def li():
    return [int(x) for x in input().split()]

N, K = li()
P = [0] + li()
C = [0] + li()
max_scores = [-10**12] * (N+10)
for init_i in range(1, N+1):
    i = init_i
    scores = [-10**9] * (K+10000)
    scores[0] = 0
    for l in range(1, K+1):
        i = P[i]
        scores[l] = scores[l-1] + C[i]
    scores[0] = -10**12
    max_scores[i] = max(scores)
print(max(max_scores))

### FIXED CODE ###

def li():
    return [int(x) for x in input().split()]

N, K = li()
P = [0] + li()
C = [0] + li()

def get_cycle(start_i):
    cycle = []
    i = start_i
    while True:
        i = P[i]
        if i == start_i:
            break
        cycle.append(i)
    cycle.append(start_i)
    return cycle

def get_cycle_scores(cycle):
    score = 0
    scores = [score]
    for i in cycle:
        score += C[i]
        scores.append(score)
    return scores

max_scores = []
for start_i in range(1,N+1):
    cycle = get_cycle(start_i)
    scores = get_cycle_scores(cycle)
    cycle_len = len(cycle)
    score_per_cycle = scores[cycle_len]
    # 1cycle以下の場合は全て調べればよし
    if K <= len(cycle):
        max_score = max(scores[move] for move in range(1, K+1))
        max_scores.append(max_score)
        continue
    # 1サイクルごとのスコアがマイナスならサイクルを回らないのがハイスコア
    if score_per_cycle <= 0:
        max_score = max(scores[move] for move in range(1, cycle_len+1))
        max_scores.append(max_score)
        continue
    # 1サイクルごとのスコアがプラスなら限界までサイクルを回るのがハイスコア
    # ラスト1cycleのスコアを調べる
    scores_last_cycle = []
    for move in range(K-cycle_len+1, K+1):
        # 何周したか
        loop_cnt = move // cycle_len
        # あまり
        rest_move = move % cycle_len
        # スコア = 1周ごとのスコア * 何周したか + あまり
        score = loop_cnt * score_per_cycle + scores[rest_move]
        scores_last_cycle.append(score)

    max_scores.append(max(scores_last_cycle))

print(max(max_scores))
N,K = list(map(int,input().split()))
h = list(map(int,input().split()))

cost = [0]

for i in range(1,N):
    cost.append(1000)
    for j in range(max(i,K)):
        cost[i] = min(cost[i],cost[i-j]+abs(h[i]-h[i-j]))

print(cost[N])

### FIXED CODE ###

import sys
input = sys.stdin.readline
N, K = map(int,input().split())
h = list(map(int,input().split()))
dp = [0]*(N)

for i in range(1,N):
    now = h[i]
    dp[i] = min([abs(now-h[j])+dp[j] for j in range(max(i-K,0),i)])

print(dp[N-1])
o = str(input())
e = str(input())
s = []
for i in range(len(o)):
    s.append(o[i])
    s.append(e[i])
print(*s, sep="")

### FIXED CODE ###

o = str(input())
e = str(input())
s = []
for i in range(len(e)):
    s.append(o[i])
    s.append(e[i])
if len(o) > len(e):
    s.append(o[-1])
print(*s, sep = "")
import numpy
N = int(input())
H = list(map(int, input().split()))
Dif = numpy.array([(H[i] - H[i + 1]) for i in range(N - 1)])
Dif = numpy.append(Dif, -1)
S = list(numpy.where(Dif <= 0)[0])
T = [S[j + 1] - S[j] - 1 for j in range(len(S) - 1)]
print(max(T))

### FIXED CODE ###

import numpy
N = int(input())
H = list(map(int, input().split()))
Dif = numpy.array([(H[i] - H[i + 1]) for i in range(N - 1)])
Dif = numpy.append(Dif, -1)

S = list(numpy.where(Dif < 0)[0])

if len(S) == 0:
    print(0)
else:
    if len(S) == 1:
        print(S[0])
    else:
        T = [S[j + 1] - S[j] - 1 for j in range(len(S) - 1)]
        print(max(T))
from collections import deque

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


BC = [list(map(int, input().split())) for i in range(M)]
BC.sort(key=lambda x: x[1])
D = deque([])
for i in range(M):
        D.extend([BC[i][1]] * BC[i][0])


sum = 0
for i in range(N):
        if A[-1] >= D[-1]:
                sum += A.pop()
        else:
                sum += D.pop()

print(sum)

### FIXED CODE ###

from collections import deque

N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [[1, A[i]] for i in range(N)]
A = deque(A)

BC = [list(map(int, input().split())) for i in range(M)]
A.extend(BC)
A = list(A)
A.sort(key=lambda x: x[1], reverse=1)


sum = 0
k = 0
for b, c in A:
        if k + b <= N:
                sum += b * c
                k += b
        elif k <= N:
                sum += (N - k) * c
                break

print(sum)
n,k=map(int,input().split())
v=[0]+list(map(int,input().split()))+[0]

ans=0

getl_sum=0
for lc in range(min(51,k+1)):
    getl_sum += v[lc]
    getr_sum =0
    for rc in range(min(51-lc,k-lc+1)):
        getr_sum += v[-rc-1]
        get = v[:lc] + v[-rc-1:]
        get.sort()
        get_sum = getl_sum + getr_sum
        ans = max(ans,get_sum)
        for bc in range(min(lc+rc,k-lc-rc)):
            get_sum-=get[bc]
            ans = max(ans,get_sum)
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
v=[0]+list(map(int,input().split()))+[0]

ans=0

getl_sum=0
for lc in range(min(n,k)+1):
    getl_sum += v[lc]
    getr_sum =0
    for rc in range(min(n,k)-lc+1):
        getr_sum += v[-rc-1]
        get = v[:lc] + v[-rc-1:]
        get.sort()
        get_sum = getl_sum + getr_sum
        ans = max(ans,get_sum)
        for bc in range(min(lc+rc,k-lc-rc)):
            get_sum-=get[bc]
            ans = max(ans,get_sum)
print(ans)
N, K = [int(item) for item in input().split()]
candles = []
for item in input().split():
  if int(item) == 0:
    K -= 1
    continue
  candles.append(int(item))
K-=1
l = []
for i in range(N):
  sign = candles[i] > 0
  s = 1 if sign else -1
  ik = i-K if sign else i+K
  if ik > N or ik < 0:
    continue
  if (candles[ik] > 0) == sign:
    l.append(candles[i] * s)
  else:
    l.append(candles[i] * s + candles[ik] * -2 * s)
l.sort()
print(l[0])

### FIXED CODE ###

N, K = [int(item) for item in input().split()]
candles = [int(item) for item in input().split()]
ans = []
for i in range(N-K+1):
  l, r = i, i+K-1
  ans.append(abs(candles[l]) + abs(candles[l] - candles[r]))
  ans.append(abs(candles[r]) + abs(candles[r] - candles[l]))
ans.sort()
print(ans[0])