Harryxun/stf_run huggingface dataset:
N,K,S = map(int, input().split())

sa = N-K+1
a = [1 for i in range(N)]

if S-sa+1 >0:
        
    a[0] = S - sa + 1

    for i in range(1,sa):
        a[i] = 1
    j = 0
    for i in range(sa,N):
        a[i] = a[j]

        j +=1
        j %= 3

    for x in a:
        print(x, end = " ")
else:
    for i in range(K):
        a[i] = S    
    for i in range(K,N):
        a[i] = 10**9
    for x in a:
        print(x, end = " ")

### FIXED CODE ###

N,K,S = map(int, input().split())

sa = N-K+1
a = [1 for i in range(N)]
if S-sa+1 >0:
        
    a[0] = S - sa + 1

    for i in range(1,sa):
        if i < N:
    
            a[i] = 1
    j = 0
    for i in range(sa,N):
        a[i] = a[j]

        j +=1
        j %= sa

    for x in a:
        print(x, end = " ")


else:
    for i in range(K):
        a[i] = S
    if S != 10**9:    
        for i in range(K,N):
            a[i] = 10**9
    else:
        for i in range(K,N):
            a[i] == 10**9 -1
    for x in a:
        print(x, end = " ")
x,y = [int(i) for i in input().split()]
if x == 2 or y == 2:
    print("No")
elif (x == 4 or x == 6 or x == 9) and (y == 6 or y == 9 or y == 11):
    print("Yes")
elif (x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10)　and (y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

# -*- coding: utf-8 -*-S
x,y = [int(i) for i in input().split()]

"""
if x == 2 or y == 2:
    print("No")
elif x == 4 or x == 6 or x == 9 and y == 6 or y == 9 or y == 11:
    print("Yes")
elif x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10　and y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12:
    print("Yes")
else:
    print("No")
"""

A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
tmp = False

for i in range(7):
    if A[i] == x:
        for j in range(i,7):
            if A[j] == y:
                tmp = True
for i in range(4):
    if B[i] == x:
        for j in range(i,4):
            if B[j] == y:
                tmp = True
if tmp:
    print("Yes")
if not tmp:
    print("No")
import fractions

i=0
dammy=[0]*(K*K*K)
for a in range(1,K+1):
    for b in range(1,K+1):
        f=fractions.gcd(a,b)
        for c in range(1,K+1):


            ff = fractions.gcd(f,c)
            #dammy.append(ff)
            dammy[i]=ff
            i+=1

print(sum(dammy))

### FIXED CODE ###

import fractions
K = int(input())

gcd = [[0]*K for i in range(K)]
L = [0]*K

for a in range(1,K+1):
    for b in range(1,K+1):
        A = fractions.gcd(a,b)
        gcd[a-1][b-1] = A
        L[A-1] +=1

sum=0
for c in range(1,K+1):
    for i in range(1,K+1):
        B = gcd[c-1][i-1]
        sum +=  B * L[i-1]

print(sum)
import heapq
N,W=map(int,raw_input().split())
wv=[]

w_sum=0
for i in range(N):
	w,v=map(int,raw_input().split())
	w_sum+=w
	wv.append((w,v))


a=[ float("-inf") for i in range(w_sum+1) ]

i=0
i=1
q=[]
for ind_i, i in enumerate(wv):
	w=i[0]
	v=i[1]
	#Initialize
	if ind_i==0:
		a[0]=0
		a[w]=v
		continue
	#Put queue
	for ind_j, j in enumerate(a):
		if j!=float("-inf"):
			heapq.heappush(q,(ind_j,j))
	
	while len(q)!=0:
		ind_j, j=heapq.heappop(q)
		a[ind_j+w]=max(a[ind_j+w], a[ind_j]+v)
		

print max(a[:W+1])




### FIXED CODE ###

from collections import defaultdict
N,W=map(int,raw_input().split())

a=defaultdict(lambda:[])
for i in range(N):
	w,v=map(int,raw_input().split())
	a[w]=a[w]+[v]

for i,j in a.items():
	a[i]=sorted(j,reverse=True)



lst=[]
for i,j in a.items():
	lst.append( (i,len(j)) )

max_val=0
if len(lst)==1:
	w1=lst[0][0]
	c1=lst[0][1]
	for i in range(c1+1):
		if i*w1<=W:
			max_val=max(max_val, sum(a[w1][:i]))

elif len(lst)==2:
	w1=lst[0][0]; w2=lst[1][0]
	c1=lst[0][1]; c2=lst[1][1]
	for i in range(c1+1):
		for j in range(c2+1):
				if i*w1+j*w2<=W:
					max_val=max(max_val, sum(a[w1][:i])+sum(a[w2][:j]))

elif len(lst)==3:
	w1=lst[0][0]; w2=lst[1][0]; w3=lst[2][0]
	c1=lst[0][1]; c2=lst[1][1]; c3=lst[2][1]
	for i in range(c1+1):
		for j in range(c2+1):
			for k in range(c3+1):
				if i*w1+j*w2+k*w3<=W:
					max_val=max(max_val, sum(a[w1][:i])+sum(a[w2][:j])+sum(a[w3][:k]))

elif len(lst)==4:
	w1=lst[0][0]; w2=lst[1][0]; w3=lst[2][0]; w4=lst[3][0]
	c1=lst[0][1]; c2=lst[1][1]; c3=lst[2][1]; c4=lst[3][1]
	for i in range(c1+1):
		for j in range(c2+1):
			for k in range(c3+1):
				for m in range(c4+1):
					if i*w1+j*w2+k*w3+m*w4<=W:
						max_val=max(max_val, sum(a[w1][:i])+sum(a[w2][:j])+sum(a[w3][:k])+sum(a[w4][:m]))

print max_val
a,b = input().split(" ")
if int(a) >= 13:
  print(b)
elif int(a) in range(6,13):
  print(b/2)
elif int(a) <= 5:
  print(0)

### FIXED CODE ###

a,b = input().split(" ")
if int(a) >= 13:
  print(b)
elif int(a) in range(6,13):
  print(int(b)//2)
elif int(a) <= 5:
  print(0)
import sys
input = sys.stdin.readline

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

import fractions
from functools import reduce
import numpy as np

def gcd_list(a):
    return reduce(fractions.gcd, a)

left = [0]*n
right = [0]*n

for i in range(1, n):
    left[i] = np.gcd.reduce(a[:i])

for i in range(n-2, -1, -1):
    right[i] = np.gcd.reduce(a[i+1:])

ans = 0
for i in range(n):
    ans = max(ans, gcd_list([left[i], right[i]]))
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

from fractions import gcd
from functools import reduce
import numpy as np

new_gcd = np.frompyfunc(gcd, 2, 1)

a = np.array(a)
left = new_gcd.accumulate(a, dtype=np.object).astype(np.int)
right = new_gcd.accumulate(a[::-1], dtype=np.object).astype(np.int)[::-1]
left = np.append([0], left[:-1])
right = np.append(right[1:], 0)

ans = 0
for i in range(n):
    ans = max(ans, gcd(left[i], right[i]))
print(ans)
N = input()
A = input()
B = input()

if N == "1":
    print("Hello World")
else:
    print(str(int(A) + int(B)))


### FIXED CODE ###

N = input()

if N == "1":
    print("Hello World")
else:
    A = input()
    B = input()
    print(str(int(A) + int(B)))
#!/usr/bin/env python3
import sys
from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def main():
    n, m, k = MI()
    a = deque(LI())
    b = deque(LI())

    A = [0 for i in range(len(a))]
    B = [0 for i in range(len(b))]
    A[0] = a[0]
    B[0] = b[0]

    for i in range(1, len(a)):
        A[i] = A[i-1]+a[i]
    for i in range(1, len(b)):
        B[i] = B[i-1]+b[i]

    index = m-1
    ans = [0]
    for i in range(len(a)):
        rest = k - A[i]
        if rest < 0:
            break

        while B[index] > rest:
            index -= 1
            if index == 0:
                break
        ans.append(i + index+2)

    print(max(ans))

    # oj t -c "pypy3 main.py"
    # acc s main.py -- --guess-python-interpreter pypy
main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def main():
    n, m, k = MI()
    a = deque(LI())
    b = deque(LI())

    A, B = [0], [0]

    for i in range(len(a)):
        A.append(A[i]+a[i])
    for i in range(len(b)):
        B.append(B[i]+b[i])

    index = m
    ans = [0]
    for i in range(len(a)+1):
        rest = k - A[i]
        if rest < 0:
            break

        while B[index] > rest:
            index -= 1

        ans.append(i + index)

    print(max(ans))


    # oj t -c "pypy3 main.py"
    # acc s main.py -- --guess-python-interpreter pypy
main()
A, B, K = map(int, input())
for i in range(K):
	if i % 2 == 0:
		# takahashi
		if A % 2 == 1:
			A -= 1
		A, B = A // 2, B + A // 2
	else:
		# aoki
		if B % 2 == 1:
			B -= 1
		A, B = A + B // 2, B // 2
print(A, B)


### FIXED CODE ###

A, B, K = map(int, input().split())
for i in range(K):
	if i % 2 == 0:
		# takahashi
		if A % 2 == 1:
			A -= 1
		A, B = A // 2, B + A // 2
	else:
		# aoki
		if B % 2 == 1:
			B -= 1
		A, B = A + B // 2, B // 2
print(A, B)
N , W = map(int , input().
weight = []               
value = []                
for _ in range(N):        
    w , v = map(int , inpu
    weight.append(w)      
    value.append(v)       
                          
def knapsack():           
    dp = [[0] * (W + 1) fo
    def solve(i,w):       
        if N == i:        
            ret_val = 0   
        elif w - weight[i]
            ret_val = solv
        else:             
            ret_val = max(
        dp[i][w] = ret_val
        return dp[i][w]   
    solve(0,W)            
    #print(dp)            
    return max(dp[0])     
                          
if __name__ == "__main__":
    print(knapsack())     
                          

### FIXED CODE ###

import numpy as np
N , W = map(int, input().split())
goods = np.array([list(map(int , input().split())) for _ in range(N)])
dp = np.zeros((N + 1 , W + 1) , dtype = np.int)

for i in range(0,N):
    w, v = goods[i,:]
    dp[i + 1, w:] = np.maximum(dp[i,w:] , dp[i,:-w] + v)
    dp[i + 1, :] = np.maximum(dp[i + 1,:],dp[i,:])
print(int(dp[N,W]))
a=input()
print(a.replace(1,8),replace(9,1),replace(8,9))

### FIXED CODE ###

a=input()
print(a.replace("1","8").replace("9","1").replace("8","9"))
h, w, k = map(int, input().split())
s = [int(input()) for _ in range(h)]

result = []
if h*w<=k:
    result.append(0)
else:
    for i in range(2**(h-1)):
        use_s = s.copy()
        checker, num = 0, i
        while num > 0:
            checker += num%2
            num >>= 1
        x = 0
        c = [0]*(checker+1)

        for j in range(w):
            num = i
            p = 0
            nex = [0]*(checker+1)
            for m in range(h):
                nex[p] += use_s[m]%10
                use_s[m] //= 10
                p += num%2
                num = num >> 1          
            if max(nex)>k:
                x = 10**5
                break

            if all(nex[m]+c[m] <= k for m in range(checker+1)):
                c = [c[I]+nex[I] for I in range(checker+1)]
            else:
                x += 1
                c = nex
        result.append(checker+x)
print(min(result))

### FIXED CODE ###

h, w, k = map(int, input().split())
s = [list(map(int, list(input()))) for _ in range(h)]
result = []
if h*w<=k:
    result.append(0)
else:
    for i in range(2**(h-1)):
        checker, num = 0, i
        while num > 0:
            checker += num%2
            num >>= 1
        x = 0
        c = [0 for _ in range(checker+1)]
        
        num = i
        p = 0
        nex = [0 for _ in range(checker+1)]
        for m in range(h):
            nex[p] += s[m][0]
            p += num%2
            num = num >> 1
        if max(nex) > k:
            x = float('inf')
            continue

        if all(nex[m]+c[m] <= k for m in range(checker+1)):
            c = [c[I]+nex[I] for I in range(checker+1)]
        else:
            x += 1

        for j in range(1, w):
            num = i
            p = 0
            nex = [0 for _ in range(checker+1)]
            for m in range(h):
                nex[p] += s[m][j]
                p += num%2
                num = num >> 1
            if max(nex) > k:
                x = float('inf')
                break            
            
            if all(nex[m]+c[m] <= k for m in range(checker+1)):
                c = [c[I]+nex[I] for I in range(checker+1)]
            else:
                x += 1
                c = nex
        result.append(checker+x)
print(min(result))
import math
from collections import Counter
N,M = map(int,input().split())
a = list(map(int,input().split()))
maxa = max(a)
i = 1
p = 1
while True:
    tmp = (i+0.5)*maxa
    if math.ceil(tmp) == math.floor(tmp):
        p = i
        break
    i += 1
lcm = 0
flag = False
for i in range(p,M+1):
    if flag:
        break
    for j in range(N):
        if flag:
            break
        tmp = i/a[j]
        if int(tmp)+0.5 != tmp:
            break
        if int(tmp)+0.5 == tmp and j == N-1:
            lcm = i
            flag = True
if lcm == 0:
    print(0)
else:
    ans = M/lcm
    print(math.ceil(math.floor(ans)/2))

### FIXED CODE ###

from itertools import permutations
N = int(input())
P = "".join(list(map(str,input().split())))
Q = "".join(list(map(str,input().split())))
ls = permutations(list(range(1,N+1)))
ans = []
for i in list(ls):
    ans.append("".join(list(map(str,i))))
ans = sorted(ans)
a,b = 0,0
for i in range(len(ans)):
    if ans[i] == P:
        a = i+1
    if ans[i] == Q:
        b = i+1
print(abs(int(a)-int(b)))
while True:
    H,W = map(int,input().split())
    if H == W == 0:
        break
    for i in range(H):
        if i = 1:
            print("#"*W)
        elif i = H:
            print("#"*W)
        else:
            print("#","・"*(W-2),"#")
    print()


### FIXED CODE ###

while True:
    H,W = map(int,input().split())
    
    if H == W == 0:
        break
    
    for i in range(H):
        if i == 0 or i == H-1:
            print('#' * W)
        else:
            print('#','.'*(W-2),'#',sep='')
    print('')
### 素因数分解する。
from collections import defaultdict

def factorize(n):
    """

    """
    tmp = n
    for i in range(2, int(n**0.5)+1):
        if tmp % i==0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if i in LCM:
                LCM[i] = max(LCM[i], cnt)
            else:
                LCM[i] = cnt
    if tmp != 1:
        LCM[tmp] = max(LCM[tmp], 1)
    if not LCM:
        LCM[N] = max(LCM[N], 1)

def inv(n, p):
    return pow(n, p-2, p)

LCM = defaultdict()
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7

for i in range(N):
    if A[i] != 1:
        factorize(A[i])

lcm = 1
for key, val in LCM.items():
    lcm *= pow(key, val, mod)
    lcm %= mod

inv_sum = 0
for i in range(N):
    inv_sum += inv(A[i], mod)
    inv_sum %= mod

print(lcm * inv_sum % mod)

### FIXED CODE ###

from math import gcd

def lcm(a, b):
    return a*b//gcd(a,b)
def main():
    N = int(input())
    A = list(map(int, input().split()))
    mod = 10**9 + 7
    LCM = 1
    for a in A:
        LCM = lcm(LCM, a)
    ans = 0
    for a in A:
        ans += (LCM//a)
        

    print(ans % mod)
main()
a,b,c,d,e,k= map(int, input().split())


E-A = e-a

if E-A > k:
    print(":(")
else:
    print("Yay!")

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())



if e-a > k:
    print(":(")
else:
    print("Yay!")
def getxy(pic):
	flag = 0
	for dy in range(m):
		for dx in range(m):
			if pic[dy][dx] > -1:
				ans = str(x+dx+1)+" "+str(y+dy+1)
				flag = 1
				break
		if flag == 1: break
	return ans
	
while 1:
	n,m = map(int,raw_input().split())
	if n == 0: break
	scene = [map(int,raw_input().split()) for i in range(n)]
	pic = [map(int,raw_input().split()) for i in range(m)]
	ans = "NA"
	for rot in range(4):
		if scene == pic:
			ans = getxy(pic)
		for y in range(n-m):
			for x in range(n-m):
				flag = 0
				for dy in range(m):
					for dx in range(m):
						if pic[dy][dx] > -1 and scene[y+dy][x+dx] - pic[dy][dx] != 0:
							flag = 1
							break
					if flag == 1: break
				if flag == 0:
					ans = getxy(pic)
			if flag == 0: break
		if flag == 0: break
		pic = [[pic[j][i] for j in range(m-1,-1,-1)] for i in range(m)]
	print ans

### FIXED CODE ###

def getxy(P,x,y,ans):
	for dy in range(m):
		for dx in range(m):
			if P[dy][dx] > -1:
				xy = [x+dx+1,y+dy+1]
				if xy[1] < ans[1] or (xy[1] == ans[1] and xy[0] < ans[0]):
					return xy
				else:
					return ans

# try-except is necessary
while 1:
	try:
		n,m = map(int,raw_input().split())
		if n == 0: break
		S = [map(int,raw_input().split()) for i in range(n)]
		P = [map(int,raw_input().split()) for i in range(m)]
		ans = [n+1,n+1]
		for rot in range(4):
			for y in range(min(ans[1],n-m+1)):
				for x in range(n-m+1):
					flag = 0
					for dy in range(m):
						for dx in range(m):
							if P[dy][dx] > -1 and S[y+dy][x+dx] - P[dy][dx] != 0:
								flag = 1
								break
						if flag == 1: break
					if flag == 0:
						ans = getxy(P,x,y,ans)
						break
				if flag == 0: break
			P = [[P[j][i] for j in range(m-1,-1,-1)] for i in range(m)]
		print "NA" if ans == [n+1,n+1] else " ".join(map(str,ans))
	except:
		pass
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
res = 0
for i in range(N - 1):
    res += B[i]
    if A[i] + 1 == A[i + 1]:
		res += C[A[i] - 1]
print(res)


### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
res = 0
for i in range(n - 1):
    res += B[i]
    if A[i] + 1 == A[i + 1]:
        res += C[A[i] - 1]
print(res + B[-1])
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k > sum(a):
    print(0)
    exit()

mod = 1000000007
dp = [[0 for _ in range(k+1)]for __ in range(n+1)]
for i in range(n+1):
    dp[i][0] = 1
    dp[0][i] = 0

for i in range(1,n+1):
    for j in range(1,k+1):
        if j > a[i-1]:
            if i is 1:
                break
        dp[i][j] = dp[i-1][j] + dp[i][j-1]
        if j > a[i-1]:
            dp[i][j] -= dp[i-1][j-1-a[i-1]]
        dp[i][j] %= mod
print(dp[n][k])

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
if k > sum(a):
    print(0)
    exit()

mod = 1000000007
dp = [[0 for _ in range(k+1)]for __ in range(n+1)]
for i in range(n+1):
    dp[i][0] = 1
for i in range(k+1):
    dp[0][i] = 0

for i in range(1,n+1):
    for j in range(1,k+1):
        if j > a[i-1]:
            if i is 1:
                break
        dp[i][j] = dp[i-1][j] + dp[i][j-1]
        if j > a[i-1]:
            dp[i][j] -= dp[i-1][j-1-a[i-1]]
        dp[i][j] %= mod
print(dp[n][k])
while True:
    x,y = map(int,input().split())
    if x > y:
        print(f'{y}{x})
    else :
        print(f'{x}{y})


### FIXED CODE ###

while True:
    x,y = map(int,input().split())
    if x == 0 and y == 0:
        break
    if x > y:
        print(f"{y} {x}")
    elif x <= y:
        print(f"{x} {y}")
def lowerBound(nums, target):
  	if nums[-1] < target: return -1
    lp = 0
    rp = len(nums) - 1
    mp = lp + rp >> 1
    while lp <= rp:
        mp = lp + rp >> 1
        if nums[mp] == target:
            return mp
        if nums[mp] < target:
            lp = mp + 1
        else:
            rp = mp - 1
    return mp if target < nums[mp] else -1

if __name__ == '__main__':
    N = int(input())
    L = [int(l) for l in input().split()]
    L.sort()
    ret = 0
    for idx in range(len(L) - 1, 1, -1):
        for jdx in range(idx - 1, 0, -1):
            c = L[idx] - L[jdx] + 1
            ldx = lowerBound(L[:jdx], c)
            if ldx == -1: continue
            ret += jdx - ldx
    print(ret)


### FIXED CODE ###

from bisect import *
if __name__ == '__main__':
    N = int(input())
    L = sorted(map(int, input().split()))
    print(sum(jdx - bisect(L, a - L[jdx], 0, jdx) for idx, a in enumerate(L) for jdx in range(idx)))
s = list(input())
n = len(s)

for i in range(n):
    if i == 0:
        if s[i+1] == "D" or s[i+1] == "?":
            s[i] = "P"
        else:
            if s[i+1] == "P":
                s[i] = "D"
    else:
        if s[i-1] == "P":
            s[i] = "D"
        elif s[i-1] == "D":
            s[i] = "P"

print("".join(s))

### FIXED CODE ###

s = list(input())
n = len(s)

for i in range(n):
    # if i == 0 and s[i] == "?":
    #     if s[i+1] == "D" or s[i+1] == "?":
    #         s[i] = "P"
    #     else:
    #         if s[i+1] == "P":
    #             s[i] = "D"
    # elif i != 0 and s[i] == "?":
    #     if s[i-1] == "P":
    #         s[i] = "D"
    #     elif s[i-1] == "D":
    #         s[i] = "P"
    if s[i] == "?":
        s[i] = "D"

print("".join(s))
import sys
k=sys.stdin
ans=[]
for i in range(int(k)):
  ans.append("ACL")

print("".joint(ans))


### FIXED CODE ###

k = int(input())
ans=[]
for i in range(k):
  ans.append("ACL")

print("".join(ans))
a, b = [int(i) for in input().split()]
print(a//b,int(a%b),float(a%b))

### FIXED CODE ###

a, b = [float(i) for i in input().split()]
print("{0} {1} {2:10f}".format(int(a//b), int(a%b), a/b))
A, B = list(map(int, input().split))

print(A*B)


### FIXED CODE ###

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

print(A*B)
from itertools import product
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = defaultdict(int)
d = defaultdict(int)
e = []
f = []
forsort = []
for i in range(n):
  if i%2 == 0:
    c[a[i]] = b[i]
    d[b[i]] = a[i]
    e.append(a[i])
    f.append(b[i])
    forsort.append((a[i],1))
    forsort.append((b[i],2))
  else:
    c[a[i]] = b[i]
    d[b[i]] = a[i]
    e.append(b[i])
    f.append(a[i])
    forsort.append((a[i],2))
    forsort.append((b[i],1))
forsort.sort()
x = [forsort[i][1] for i in range(2*n)]
change = [0]
for i in range(1,2*n):
  if x[i] != x[i-1]:
    change.append(i)
change.append(2*n)
changels = []
for i in range(1,len(change)):
  changels.append([j for j in range(change[i-1],change[i])])
p = x[0]
ans = []
for ls in product(*changels):
  array = []
  cannotuse = defaultdict(int)
  for i in range(len(ls)):
    l = ls[i]
    if (p+i)%2 == 1:
      if cannotuse[forsort[l][0]] != 1:
        array.append(forsort[l][0])
        cannotuse[c[forsort[l][0]]] = 1
        cannotuse[forsort[l][0]] = 1
      else:
        break
    if (p+i)%2 == 0:
      if cannotuse[forsort[l][0]] != 1:
        array.append(forsort[l][0])
        cannotuse[d[forsort[l][0]]] = 1
        cannotuse[forsort[l][0]] = 1
      else:
        break
  if len(array) >= n:
    print(array)
    array = array[:n]
    anstmp = 0
    for ind,i in enumerate(array):
      if ind%2 == 0:
        anstmp += abs(e.index(i)-ind)
      else:
        anstmp += abs(f.index(i)-ind)
    ans.append(anstmp)
    anstmp = 0
if not ans:
  print(-1)
else:
  print(min(ans))

### FIXED CODE ###

n = int(input())
a = [list(map(int,input().split())) for _ in range(2)]
dp = [[1000]*(2**n) for _ in range(51)]
dp[0][0] = 0
for S in range(2**n):
  j = bin(S).count("1")
  cnt = 0
  for i in range(n):
    if not (S & 1<<i):
      k = a[(i+j)%2][i]
      for l in range(k+1):
        dp[k][S|1<<i] = min(dp[k][S|1<<i],dp[l][S]+cnt)
    if not (S&1<<i):
      cnt += 1
ans = min(dp[i][-1] for i in range(51))
if ans == 1000:
  print(-1)
else:
  print(ans)
N = int(input())
A = list(map(int, input().split()))
count = 1

tmp = A[0]
bf = 1 if tmp < A[1] else 2 if tmp > A[1] else 0
af = 0  # {1: '+', 2: '-'}
for i in range(1, N):
    if tmp < A[i]:
        af = 1
    elif tmp > A[i]:
        af = 2

    tmp = A[i]
    if af != bf:
        count += 1
        if i+1 < N:
            af = 1 if tmp < A[i+1] else 2 if tmp > A[i+1] else 0
    bf = af

print(count)

### FIXED CODE ###

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

conti_flg = 0  # {-1: '-', 0: '=', 1: '+'}
fst = A[0]
for i in A:
    snd = i
    if fst > snd:
        conti_flg = -1 if conti_flg <= 0 else 2
    elif fst < snd:
        conti_flg = 1 if conti_flg >= 0 else 2

    if conti_flg == 2:
        count += 1
        conti_flg = 0
    fst = snd

print(count)