Harryxun/stf_run huggingface dataset:
import heapq

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

h = []
for _ in range(n):
    heapq.heappush(h, int(input()))

q = [heapq.heappop(h) for _ in range(k-1)]

ans = 1e9
while len(h):
    p = i % (k-1)
    s = q[p]
    e = heapq.heappop(h)
    q[p] = e
    ans = min(ans, e - s)

print(ans)


### FIXED CODE ###

import heapq

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

h = []
for _ in range(n):
    heapq.heappush(h, int(input()))

q = [heapq.heappop(h) for _ in range(k-1)]

ans = 1e9
for i in range(len(h)):
    p = i % (k-1)
    s = q[p]
    e = heapq.heappop(h)
    q[p] = e
    ans = min(ans, e - s)

print(ans)
#coding:utf-8
a,b,t = input().split()
x = t // a
print(b*x)


### FIXED CODE ###

#coding:utf-8
a,b,t =map(int,input().split())
x = t // a
print(b*x)
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
	n, a, b = LI()
    print(min(n*a, b))


### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    n, a, b = LI()
    print(min(a*n, b))

main()
N = input()
xx= 0
for i in range(1,N+1):
    if((i%3!=0)&(i%5!=0)):
        xx += i
print(xx)

### FIXED CODE ###

N = int(input())
xx= 0
for i in range(1,N+1):
    if((i%3!=0)&(i%5!=0)):
        xx += i
print(xx)
A, B, K = map(int, input().split())
d = [i for i in range(100,1,-1) if (A%i==0 and B%i==0)]
print(d[K-1])


### FIXED CODE ###

a,b,c=map(int,input().split())
if a*c<=b:
  print(c)
else:
  print(b//a)
N = input()
if N < 1000:
    print("ABC")
else:
    print("ABD")


### FIXED CODE ###

N = int(input())
if N < 1000:
    print("ABC")
else:
    print("ABD")
n, *P = map(int, open(0).read().split())
c = 0
if P[0] == 1:
  c, P[0], P[1] = 1, P[1], 1
for i, (p0, p1) in enumerate(zip(P, P[1:]), 2):
  if i == p1:
    c, P[i-1], P[i] = c+1, P[i], i
print(c)

### FIXED CODE ###

from itertools import groupby
n, *P = map(int, open(0).read().split())
c = 0
for v, g in groupby(p==i for p, i in zip(P, range(1, n+1))):
    c += v * (len(list(g))+1) // 2
print(c)
A, B, K = map(int, input().split())

elif A > K:
    print(A-K, B)
else:
    print(0, max(0, B-(K-A)))


### FIXED CODE ###

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

if A > K:
    print(A-K, B)
else:
    print(0, max(0, B-(K-A)))
def insertionSort( s, n, g ):
    global cnt
    for i in range( g, n ):
        v = s[i]
        j = i - g
        while ( 0 <= j ) and ( v < s[j] ):
            s[ j+g ] = s[j]
            j -= g
            cnt += 1
        s[ j+g ] = v
 
 
def shellSort( s ):
    global cnt
    g = []
    v = 1
    n = len( s )
    while v <= n:
        g.append( v )
        v = 3*v+1     
    g.reverse( )
    m = len( g )
    print( m )
    print( " ".join( map( str, g ) ) )  
    cnt = 0
    for i in range( m ):
        insertionSort( s, n, g[i] )
    print( cnt )

 
n = int( input( ) )
s = [ int( input( ) ) for i in range( n ) ]
shellSort( s )
print( "\n".join( map( str, s ) ) )

### FIXED CODE ###

import sys
 
def insertionSort( nums, n, g ):
    cnt = 0
    i = g
    while i < n:
        v = nums[i]
        j = i - g
        while 0 <= j and v < nums[j]:
            nums[ j+g ] = nums[j]
            j -= g
            cnt += 1
        nums[ j+g ] = v
        i += 1
    return cnt
         
def shellSort( nums, n ):
    g = []
    val = 1
    while val <= n:
        g.append( val )
        val = 3*val+1
     
    g.reverse( )
    m = len( g )
    print( m )
    print( " ".join( map( str, g ) ) )
    cnt = 0
    for i in range( m ):
        cnt += insertionSort( nums, n, g[i] )
    print( cnt )
     
n = int( sys.stdin.readline( ) )
nums = []
for i in range( n ):
    nums.append( int( sys.stdin.readline( ) ) )
 
shellSort( nums, n )
print( "\n".join( map( str, nums ) ) )
X, Y = map(int, input())
print(int(X + Y/2))

### FIXED CODE ###

a, b = map(int, input().split())
print(int(a+b/2))
n,a,b = map(int, input().split())

s = 'b'*a+'r'*b
ind = n%(a+b) 

print(s[ind-1])

### FIXED CODE ###

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

ans = n//(a+b)*a 
x = n%(a+b) 

if x<=a:
  ans += x
else:
  ans += a

print(ans)
n = int(input())
a = [int(i) for i in input().split()]
q = int(input())
hako = [0]*(10^6+1)
ind = list(range(10^6+1))
S = sum(a)
s = []

for i in a:
    hako[i] += 1

for i in range(q):
    b, c = [int(i) for i in input().split()]
    S += (ind[c] - ind[b])*hako[b]
    s.append(S)
    hako[c] += hako[b]
    hako[b] = 0
for i in range(q):
    print(s[i])

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
q = int(input())
hako = [0]*(10**6)
ind = list(range(10**6))
S = sum(a)
s = []

for i in a:
    hako[i] += 1

for i in range(q):
    b, c = [int(i) for i in input().split()]
    S += (ind[c] - ind[b])*hako[b]
    s.append(S)
    hako[c] += hako[b]
    hako[b] = 0
for i in range(q):
    print(s[i])
import sys

X, Y = map(int, input().split())
mod = 10 ** 9 + 7

if (2 * X - Y) % 3 != 0:
    # 整数解がない場合
    print(0)
    sys.exit()


m = (2 * X - Y) // 3
n = (2 * Y - X) // 3

u = m + n
fact = [1] * (u+1)

for i in range(1, u+1):
    fact[i] = (fact[i-1] * i) % mod

fact_inv1 = pow(fact[n], mod-2, mod)
fact_inv2 = pow(fact[m], mod-2, mod)

res = (((fact[u] * fact_inv1) % mod) * fact_inv2) % mod

print(res)

### FIXED CODE ###

import sys

X, Y = map(int, input().split())
mod = 10 ** 9 + 7

# if (2 * X - Y) % 3 != 0 or (2 * Y - X) % 3 != 0:
if (X + Y) % 3 != 0:
    # 整数解がない場合
    print(0)
    sys.exit()


m = (2 * X - Y) // 3
n = (2 * Y - X) // 3

if m < 0 or n < 0:
    print(0)
    sys.exit()

u = m + n
fact = [1] * (u+1)

for i in range(1, u+1):
    fact[i] = (fact[i-1] * i) % mod

fact_inv1 = pow(fact[n], mod-2, mod)
fact_inv2 = pow(fact[m], mod-2, mod)

res = (((fact[u] * fact_inv1) % mod) * fact_inv2) % mod

print(res)
#再帰を使って各ノードのカウンタの値を決定
def decide_count(v,G,c):#vは1始まり
    for u in G[v]:
        print(u)
        c[u-1]+=c[v-1]
        decide_count(u,G,c) 

N,Q = list(map(int,input().split()))
a=[0]*(N-1)
b=[0]*(N-1)
G={}
for i in range(N-1):
    a[i],b[i] = list(map(int,input().split()))
for i in range(N):
    G[i+1]=[]
p=[0]*Q
x=[0]*Q
for i in range(Q):
    p[i],x[i] = list(map(int,input().split()))

#グラフの作成
for i in range(N-1):
    G[a[i]].append(b[i])

c=[0]*N
for i in range(Q):
    c[p[i]-1] += x[i]

decide_count(1,G,c)

ans = ' '.join([str(x) for x in c])

print(ans)

### FIXED CODE ###

'''
pythonの再帰は10^5timesですら厳しい
import sys
sys.setrecursionlimit(10000000)

def dfs(v,p,G,c):
    for u in G[v]:
        if u!=p:
            c[u]+=c[v]
            dfs(u,v,G,c) 
'''
from collections import deque

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

G=[]
for i in range(N):
    G.append([])
for i in range(N-1):
    a,b = list(map(int,input().split()))
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)

p=[0]*Q
x=[0]*Q
c=[0]*N
for i in range(Q):
    p,x = list(map(int,input().split()))
    p-=1
    c[p] += x

stack=deque([0])
parent = [-1]*N

while(stack):
    v = stack.pop()
    for u in G[v]:
        if u!=parent[v]:
            c[u]+=c[v]
            parent[u]=v
            stack.appendleft(u)


ans = ' '.join([str(x) for x in c])

print(ans)
s=input()
k=int(input())
i=0
while s[i]=='1' and i<len(s):
  i+=1
if k<=i or i==len(s):
  print(1)
else:
  print(s[i])

### FIXED CODE ###

s=input()
k=int(input())
i=0
while i<len(s) and s[i]=='1':
  i+=1
if k<=i or i==len(s):
  print(1)
else:
  print(s[i])
def dfs(v, p, ans):
    if p!=-1: ans[v] += ans[p]
    for g in G[v]:
        if g==p: continue
        dfs(g, v, ans)
    return ans

n, q = map(int, input().split())
ans = [0]*n
G = [[] for _ in range(n)]
for i in range(n-1):
    a,b = list(map(lambda x: x-1, map(int, input().split())))
    G[a].append(b)
    G[b].append(a)

for i in range(q):
    p,x = map(int, input().split())
    ans[p-1] += x

dfs(0, -1, ans)

print(*ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
n, q = map(int, input().split())
G = [[] for i in range(n)]
for i in range(n-1):
    a, b = map(lambda x: x-1, map(int, input().split()))
    G[a].append(b)
    G[b].append(a)

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

def dfs(v, pre=-1):  
    for nx in G[v]:
        if nx==pre:
            continue
        ans[nx] += ans[v]
        dfs(nx,v)
dfs(0)
print(*ans)
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np
DIV_NUM = 1000000007


N,K = map(int, input().split())
A = [int(x) for x in input().split()]

tree = [0] * (N+1)

# https://atcoder.jp/contests/chokudai_S001/submissions/6789704
def BIT_update(tree,x):
    while x <= N:
        tree[x] += 1
        x += x&(-x)
def BIT_sum(tree,x):
    s = 0
    while x:
        s += tree[x]
        x -= x&(-x)
    return s

answer = N*(N-1)//2
for x in A:
    answer -= BIT_sum(tree,x)
    BIT_update(tree,x)

B = sorted(A)

q=0
p=B[0]
r=0
for i in range(1,N):
    if B[i]>p:
        p=B[i]
        r=i
    q += r

answer = (K * answer) + q * K * (K-1) // 2
answer = answer % DIV_NUM
print(answer)


### FIXED CODE ###

# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

DIV_NUM = 1000000000 + 7

INPUT_NUMS = list(map(int, input().split()))
N=int(INPUT_NUMS[0])
K=int(INPUT_NUMS[1])

A = [int(x) for x in input().split()]
AA = np.array(A)
if N==1:
    print(0)
    exit()

# https://kira000.hatenadiary.jp/entry/2019/02/23/053917
def bubble_sort(A):
    cnt = 0
    for i in range(len(A)):
        for j in range(len(A)-1, i, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                cnt += 1
    return cnt

answer = bubble_sort(AA)

B = sorted(A)
q=0
p=B[0]
r=0
for i in range(1,N):
    if B[i]>p:
        p=B[i]
        r=i
    q += r

# print(answer,K)
answer = answer % DIV_NUM
answer = int(answer)
answer = (answer * K) % DIV_NUM
q = q % DIV_NUM
answer = answer + q * K * (K-1) // 2
answer = answer % DIV_NUM
print(answer)
s=input()
if len(s)%2:
  print("No")
elif s[:len(s)/2]==s[len(s)/2:]:
  print("Yes")
 else:
  print("No")

### FIXED CODE ###

ln=input()
s=input()
if len(s)%2:
    print("No")
elif s[:(len(s)//2)]==s[(len(s)//2):]:
    print("Yes")
else:
    print("No")
import numpy as np
room, route_count = map(int,input().split())
route = np.array([list(map(int,input().split())) for _ in range(route_count)])
 
object_nums = [1]
ans = np.array([0]*(room-1))
 
def mem_ans(ans, object_num, next_nums):
    next_nums = next_nums - 2
    ans[next_nums-2] = object_num
    return ans
 
for object_num in object_nums:
    object_rows = route[np.any(route==object_num, axis=1)]
    route = route[~np.any(route==object_num, axis=1)]
    next_nums = object_rows[object_rows!=object_num]
    
    if next_nums is not None:
        ans = mem_ans(ans, object_num, next_nums)
        object_nums.extend(next_nums)
    else:
        break
print(ans)
if 0 in set(ans):
  print('No')
else:
  print('Yes')
  for i in ans:
    print(i)

### FIXED CODE ###

import networkx as nx
room, route_count = map(int,input().split())
route = [list(map(int,input().split())) for _ in range(route_count)]

G = nx.Graph()
G.add_nodes_from(range(1,room+1))
G.add_edges_from(route)
pre = nx.predecessor(G, 1)

print('Yes')
for i in range(2,room+1):
  print(pre[i][0])
N, K = input().split()
p = sorted([list(map(int, input().split()))])
res = 0
for x in range(K):
  res += p[x]
print(res)

### FIXED CODE ###

from functools import reduce

N, K = [int(x) for x in input().split()]
p = sorted([int(x) for x in input().split()])
print(reduce(lambda x, y: x + y, p[0:K]))
n,a,b = map(intm,input().split())
print(min(n*a,b))

### FIXED CODE ###

n,a,b = map(int,input().split())
print(min(n*a,b))
r, D, x2000 = map(int, input().split())
for i in range(10):
  x = r*x - D
  print(x)

### FIXED CODE ###

r, D, x2000 = map(int, input().split())
x = x2000
for i in range(10):
  x = r*x - D
  print(x)
n=int(input())
p=[]
for i in range(n):
    p.append(int(input())

print(int(sum(p))-(int(max(p))/2))

### FIXED CODE ###

n=int(input())
p=[int(input()) for i in range(n)]

print(sum(p)-(max(p)//2))
n = int(input())
s = input()

candidates = [0 for i in range(10 ** 3)]

count = 0
for i in range(1000):
    tmp_pass = f'{i:03}'

    index_0 = s.find(tmp_pass[0])
    if index_0 != -1 and index_0 < len(s) - 2:
        s_1 = s[index_0 + 1:]
        index_1 = s_1.find(tmp_pass[1])
        if index_1 != -1 and index_1 < len(s_1) - 1:
            s_2 = s_1[index_1 + 1:]
            # print(tmp_pass)
            # print(s_2)
            # index_2 = s_2.find(tmp_pass[2])
            # print(index_2)
            if s_2.find(tmp_pass[2]) != -1:
                count += 1

print(count)


### FIXED CODE ###

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

candidates = [0 for i in range(10 ** 3)]

count = 0
for i in range(1000):
    tmp_pass = '{:03}'.format(i)

    index_0 = s.find(tmp_pass[0])
    if index_0 != -1 and index_0 < len(s) - 2:
        s_1 = s[index_0 + 1:]
        index_1 = s_1.find(tmp_pass[1])
        if index_1 != -1 and index_1 < len(s_1) - 1:
            s_2 = s_1[index_1 + 1:]
            # print(tmp_pass)
            # print(s_2)
            # index_2 = s_2.find(tmp_pass[2])
            # print(index_2)
            if s_2.find(tmp_pass[2]) != -1:
                count += 1

print(count)
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect


from math import factorial
# 組み合わせ
def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))


def check(left, right, num, max_num, data):
    half = (left + right) // 2
    kari = 0


def main():
    num, max_num = map(int, input().split())
    data = [list(map(int, input().split())) for i in range(num)]

    data.sort(key=lambda x: (-x[1]))

    visit = [0 for i in range(max_num + 1)]

    ans = 0
    left = 0
    # print(data)
    for i in range(num):
        day, value = data[i]
        for j in range(left, max_num + 1 - day)[::-1]:
            if visit[j] == 0:
                ans += value
                visit[j] = 1
                break
        else:
            left = max_num - day
    # print(visit)
    print(ans)







if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect


visit = []

def aaa(ind_lim, dame_num):
    global visit
    if ind_lim >= dame_num:
        return -1
    elif visit[ind_lim] == -1:
        return -1
    elif visit[ind_lim] == 0:
        return ind_lim
    else:
        visit[ind_lim] = aaa(visit[ind_lim], dame_num)
        return visit[ind_lim]

def main():
    num, max_num = map(int, input().split())
    data = [list(map(int, input().split())) for i in range(num)]

    data.sort(key=lambda x:(-x[1]))
    # for

    global visit
    visit = [0 for i in range(max_num + 1)]

    ans = 0

    for i in range(num):
        day, value = data[i]
        ind_lim = day
        # print(i, num, visit)
        ind_insert = aaa(ind_lim, max_num + 1)
        if ind_insert != -1:
            visit[ind_insert] = ind_insert + 1
            ans += value

    # print('uuu')
    print(ans)







if __name__ == '__main__':
    main()
def main():
    h, w = map(int, input().split())

    ans = 0
    if h == 1:
        print(1)
        return 0
    if w&1:
    ans += w * (h//2)
    if h % 2 == 1:
        ans += (w+1)//2
    else:
    ans += h*(w//2)

    print(ans)

main()


### FIXED CODE ###

def main():
    h, w = map(int, input().split())
    if h == 1 or w == 1:
        print(1)
        return 0
    ans = 0
    if w&1:
        ans += w * (h//2)
        if h % 2 == 1:
            ans += (w+1)//2
    else:
        ans += h*(w//2)

    print(ans)

main()
n=int(input())

judge_list=[]
for i in range(n):
    a=input()
    judge_list.append(a)

print("AC ×",judge_list.count("AC"))
print("WA ×",judge_list.count("WA"))
print("TLE ×",judge_list.count("TLE"))
print("RE ×",judge_list.count("RE"))

### FIXED CODE ###

n=int(input())
a=n%1000
if a==0:
    print(0)
else:
    print(1000-a)
S = [int(i) for i in input().split()]
N = S[0]
M = S[1]
X = S[2]
Y = S[3]
C = [int(i) for i in range(N)]
D = [int(i) for i in range(M)]

x = max(C)
y = min(D)

if x < y:
    A = 1
elif x >= y:
    A = 0

if X > x:
    if Y >= y > X:
        B = 1
if Y < y:
    if X < x < Y:
        B = 1
if X < (x + y) / 2 <= Y:
    B = 1
if x < X and y > Y:
    B = 1

if A == 1 and B == 1:
    print('No War')
else:
    print('War')

### FIXED CODE ###

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

A.sort()
M = 10 * int(A[-1]) + int(A[0]) + int(A[1])
print(M)
N,M,K=map(int,input().split())

A=[int(x) for x in input().split()]
B=[int(x) for x in input().split()]

a=0
b=0
ans=0
books=len(A)+len(B)
time=0


while(1):
    if a+b==books or time>=K:
        break
    
    elif (a!=N and b!=M):
        if A[a]>B[b]:
            if time+B[b]<=K:
                time+=B[b]
                b+=1
                ans+=1
            else:
                break
        
        elif B[b]>A[a]:
            if time+A[a]<=K:
                time+=A[a]
                a+=1
                ans+=1
            else:
                break
        
        else:
            if time+A[a]>K:
                break
            else:
                tmpa=a
                tmpb=b
                while(1):
                    tmpa+=1
                    tmpb+=1
                    if A[tmpa]>B[tmpb]:
                        if time+B[b]<=K:
                            time+=B[b]
                            b+=1
                            ans+=1
                        else:
                            break
                    
                    elif A[tmpa]<B[tmpb]:
                        if time+A[a]<=K:
                            time+=A[a]
                            a+=1
                            ans+=1
                        else:
                            break
            
    elif a==N and b!=M:
        time+=B[b]
        b+=1
        ans+=1
        
    elif b==M and a!=N:
        time+=A[a]
        a+=1
        ans+=1
print(ans)
        

### FIXED CODE ###

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

a=[0]
b=[0]

tmp_a=0
tmp_b=0
for i in A:
    tmp_a+=i
    a.append(tmp_a)

for i in B:
    tmp_b+=i
    b.append(tmp_b)
    

ans,j=0,M
for i in range(N+1):#i…A台の本数
    if a[i]>K:
        break
    while(1):
        if b[j]<=(K-a[i]):
            break
        j-=1
    ans=max(ans,i+j)
    
print(ans)
import sys
sys.setrecursionlimit(sys.getrecursionlimit())
def trace(i,j):
    global ans
    if dp[i][j][1] == 0:
        trace(i,j-1)
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        trace(i-1,j-1)
    elif dp[i][j][1] == 2:
        trace(i-1,j)
    else:
        return

s = input()
t = input()
# dp[i][j] = LCS(s[:i+1],t[:j+1])
dp = [ [( 0 , -1 )]*(len(t)+1)  for _ in range(len(s)+1) ]
for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
trace(len(s),len(t))
print(ans[::-1])

### FIXED CODE ###

import sys

s = sys.stdin.readline()
t = sys.stdin.readline()

# dp[i][j] = LCS(s[:i],t[:j])
sLen, tLen = len(s),len(t),
dp = [ [( 0 , -1 )]*(tLen+1)  for _ in range(sLen+1) ]
for i in range(1,sLen+1):
    for j in range(1,tLen+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
i,j = sLen, tLen
for _ in range(sLen+tLen):
    if dp[i][j][1] == 0:
        j -= 1
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        i -= 1
        j -= 1
    elif dp[i][j][1] == 2:
        i -= 1
    else:
        break

print(ans[::-1])
n=int(input())
a=list(map(int,input().split()))
a.sort()

c4=0
c2=0

for i in range(n):
    if a[i]%4==0:
        c4+=1
for i in range(n):
    if a[i]%4!=0 and a[i]%2==0:
        c2+=1

if c4==0:
    if all(for a[i]%2==0 i in range(n)):
       print('Yes')
elif n<=2*c4 + c2:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

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

for i in range(n):
    if a[i]%4==0:
        c4+=1
for i in range(n):
    if a[i]%2==0:
        c2+=1

if n<=(2*c4 + max(1,c2-c4)):
    print('Yes')
else:
    print('No')
a,b,c,k = map(int,input().split())
count = 0
if k = 0:
  print(a-b)
  exit()

while count = k:
  a1 = a
  b1 = b
  c1 = c
  a = b1+c1
  b = a1+c1
  c = a1+b1
  count +=1
print(a-b)


### FIXED CODE ###

a,b,c,k = map(int,input().split())
if k % 2 == 0:
  print(a-b)
else:
  print(b-a)
def findmin(arr,n):
  dp = [0]*n
  dp[1] = abs(arr[0]-arr[1])
  for i in range(2,n):
    dp[i] = min(dp[i-1]+abs(arr[i-1]-arr[i]), dp[i-2]+abs(arr[i-2]-arr[i]))
  return dp[-1]

n = int(input())
arr = list(map(int,input().split())
print(findmin(arr,n))

### FIXED CODE ###




def findmin(arr,n):
  dp = [0]*n
  dp[1] = abs(arr[0]-arr[1])
  for i in range(2,n):
    dp[i] = min(dp[i-1]+abs(arr[i-1]-arr[i]), dp[i-2]+abs(arr[i-2]-arr[i]))
  return dp[-1]

n = int(input())
arr = list(map(int,input().split()))
print(findmin(arr,n))