You are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python
<code>
```

PROBLEM:
You are given a string target, an array of strings words, and an integer array costs, both arrays of the same length.
Imagine an empty string s.
You can perform the following operation any number of times (including zero):

Choose an index i in the range [0, words.length - 1].
Append words[i] to s.
The cost of operation is costs[i].

Return the minimum cost to make s equal to target. If it's not possible, return -1.

Example 1:

Input: target = "abcdef", words = ["abdef","abc","d","def","ef"], costs = [100,1,1,10,5]
Output: 7
Explanation:
The minimum cost can be achieved by performing the following operations:

Select index 1 and append "abc" to s at a cost of 1, resulting in s = "abc".
Select index 2 and append "d" to s at a cost of 1, resulting in s = "abcd".
Select index 4 and append "ef" to s at a cost of 5, resulting in s = "abcdef".

Example 2:

Input: target = "aaaa", words = ["z","zz","zzz"], costs = [1,10,100]
Output: -1
Explanation:
It is impossible to make s equal to target, so we return -1.

Constraints:

1 <= target.length <= 2000
1 <= words.length == costs.length <= 50
1 <= words[i].length <= target.length
target and words[i] consist only of lowercase English letters.
1 <= costs[i] <= 105

Your solution to the problem should be a method of the class Solution called minimumCost and should pass all tests. Use the following starter code:
```python
class Solution:
    def minimumCost(self, target: str, words: List[str], costs: List[int]) -> int:
        # Add your code here
```

SOLUTION:

Question:
PROBLEM:
You are given a string target, an array of strings words, and an integer array costs, both arrays of the same length.
Imagine an empty string s.
You can perform the following operation any number of times (including zero):

Choose an index i in the range [0, words.length - 1].
Append words[i] to s.
The cost of operation is costs[i].

Return the minimum cost to make s equal to target. If it's not possible, return -1.

Example 1:

Input: target = "abcdef", words = ["abdef","abc","d","def","ef"], costs = [100,1,1,10,5]
Output: 7
Explanation:
The minimum cost can be achieved by performing the following operations:

Select index 1 and append "abc" to s at a cost of 1, resulting in s = "abc".
Select index 2 and append "d" to s at a cost of 1, resulting in s = "abcd".
Select index 4 and append "ef" to s at a cost of 5, resulting in s = "abcdef".

Example 2:

Input: target = "aaaa", words = ["z","zz","zzz"], costs = [1,10,100]
Output: -1
Explanation:
It is impossible to make s equal to target, so we return -1.

Constraints:

1 <= target.length <= 2000
1 <= words.length == costs.length <= 50
1 <= words[i].length <= target.length
target and words[i] consist only of lowercase English letters.
1 <= costs[i] <= 105

Your solution to the problem should be a method of the class Solution called minimumCost and should pass all tests. Use the following starter code:
```python
class Solution:
    def minimumCost(self, target: str, words: List[str], costs: List[int]) -> int:
        # Add your code here
```

SOLUTION:

assert Solution().minimumCost(target = "abc", words = ["abc"], costs = [1]) == 1

assert Solution().minimumCost(target = "abc", words = ["abc"], costs = [10]) == 10

assert Solution().minimumCost(target = "abcd", words = ["ab", "cd"], costs = [1, 1]) == 2

assert Solution().minimumCost(target = "abc", words = ["a","b","c"], costs = [1,1,1]) == 3

assert Solution().minimumCost(target = "hello", words = ["he","ll","o"], costs = [5,7,2]) == 14

assert Solution().minimumCost(target = "abab", words = ["a","b","ab"], costs = [2,3,1]) == 2

assert Solution().minimumCost(target = "abcabc", words = ["abc","bc","c"], costs = [3,1,4]) == 6

assert Solution().minimumCost(target = "xyz", words = ["x","y","z"], costs = [2,2,2]) == 6

assert Solution().minimumCost(target = "hello", words = ["he","ll","o"], costs = [1,2,3]) == 6

assert Solution().minimumCost(target = "abcabc", words = ["abc","abcabc"], costs = [10,5]) == 5

assert Solution().minimumCost(target = "abcdef", words = ["abdef","abc","d","def","ef"], costs = [100,1,1,10,5]) == 7

assert Solution().minimumCost(target = "abcabc", words = ["abc","bc"], costs = [3,4]) == 6

assert Solution().minimumCost(target = "xyz", words = ["xy","yz"], costs = [5,6]) == -1

assert Solution().minimumCost(target = "xyz", words = ["xy","yz","z"], costs = [5,6,7]) == 12

assert Solution().minimumCost(target = "aaaa", words = ["z","zz","zzz"], costs = [1,10,100]) == -1

assert Solution().minimumCost(target = "xyz", words = ["xy", "y", "z"], costs = [2, 1, 1]) == 3

assert Solution().minimumCost(target = "abcde", words = ["a","bc","de"], costs = [1,2,3]) == 6

assert Solution().minimumCost(target = "abcdefg", words = ["abc","def","g","abcdef","efg"], costs = [1,2,3,5,4]) == 6

assert Solution().minimumCost(target = "backtracking", words = ["back","track","ing","backtr","ack"], costs = [7,6,5,10,4]) == 18

assert Solution().minimumCost(target = "abcdabcdabcd", words = ["ab","cd","abcd"], costs = [1,1,5]) == 6

assert Solution().minimumCost(target = "ababababab", words = ["a","ab","aba","bab"], costs = [1,2,3,4]) == 10

assert Solution().minimumCost(target = "abcabcabcabcabcabc", words = ["abc","ab","bc","c","a","b"], costs = [3,2,2,1,1,1]) == 18

assert Solution().minimumCost(target = "programming", words = ["pro","gram","ming","prog","amm"], costs = [10,20,30,5,25]) == 60

assert Solution().minimumCost(target = "mississippi", words = ["mis","sis","sip","i","p"], costs = [3,5,2,1,1]) == 12

assert Solution().minimumCost(target = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz", words = ["zzz","zz","z"], costs = [10,5,1]) == 80

assert Solution().minimumCost(target = "alibaba", words = ["ali","ba","ba","ba","ba","ba"], costs = [6,1,2,3,4,5]) == 8

assert Solution().minimumCost(target = "abcdabcd", words = ["abcd","cdab","bcda","dabc"], costs = [10,20,30,40]) == 20

assert Solution().minimumCost(target = "complexexample", words = ["com","plex","ex","ample","mple","ample","ple","le","e"], costs = [10,20,30,40,50,60,70,80,90]) == 100

assert Solution().minimumCost(target = "abacabadabacaba", words = ["aba","aca","bad","aba"], costs = [1,2,3,4]) == -1

assert Solution().minimumCost(target = "programming", words = ["pro","gram","ming","ming","program","ming"], costs = [10,20,5,15,5,3]) == 8

assert Solution().minimumCost(target = "ababab", words = ["aba","bab","ab"], costs = [2,3,1]) == 3

assert Solution().minimumCost(target = "xyzzzz", words = ["x","y","zz","z"], costs = [10,20,1,5]) == 32

assert Solution().minimumCost(target = "heuristics", words = ["heuri","stics","ric","heu","stic"], costs = [9,8,6,4,5]) == 17

assert Solution().minimumCost(target = "optimization", words = ["opt","imi","za","ti","on"], costs = [10,20,30,40,50]) == 150

assert Solution().minimumCost(target = "abcdeabcde", words = ["abc","de","abcde"], costs = [5,3,10]) == 16

assert Solution().minimumCost(target = "optimization", words = ["opt","imi","zation","tio","n"], costs = [5,7,8,6,2]) == 20

assert Solution().minimumCost(target = "repeated", words = ["rep", "eat", "ed"], costs = [10, 5, 1]) == 16

assert Solution().minimumCost(target = "abracadabra", words = ["abra","brac","cad","abra","dab"], costs = [5,3,7,4,2]) == 15

assert Solution().minimumCost(target = "optimization", words = ["opti","miz","at","iz","izati","on"], costs = [6,5,10,3,8,4]) == -1

assert Solution().minimumCost(target = "aabbcc", words = ["aa","bb","cc","aabb","bbcc"], costs = [3,4,5,8,9]) == 12

assert Solution().minimumCost(target = "abcdabcdabcd", words = ["abcd","bc","c","a","abc"], costs = [10,1,2,3,5]) == 30

assert Solution().minimumCost(target = "programming", words = ["pro","gram","ming","prog","ram","ming"], costs = [7,5,4,8,3,6]) == 15

assert Solution().minimumCost(target = "abcdabcd", words = ["abc","abcd","ab","cd"], costs = [5,1,2,3]) == 2

assert Solution().minimumCost(target = "dynamicprogramming", words = ["dyn","ami","cpro","gram","ming"], costs = [12,11,14,13,9]) == 59

assert Solution().minimumCost(target = "hellohellohello", words = ["hel","lo","hello","helol"], costs = [2,3,6,8]) == 15

assert Solution().minimumCost(target = "banana", words = ["ba","na","an","bana","nana"], costs = [2,3,4,5,6]) == 8

assert Solution().minimumCost(target = "ababababab", words = ["aba","bab"], costs = [5,3]) == -1

assert Solution().minimumCost(target = "longstringlongstring", words = ["long","str","ing","longstring"], costs = [12,9,10,25]) == 50

assert Solution().minimumCost(target = "abcdefgh", words = ["abcd","efgh","abc","def","ghi","ab","cd","ef","gh"], costs = [10,10,5,5,5,1,1,1,1]) == 4

assert Solution().minimumCost(target = "programming", words = ["pro","gram","ming","program","progr"], costs = [5,3,7,12,8]) == 15

assert Solution().minimumCost(target = "zzzzzzzzzz", words = ["zz","zzz","zzzz"], costs = [10,15,20]) == 50

assert Solution().minimumCost(target = "repeatedwords", words = ["rep","eat","edw","ords"], costs = [3,5,2,4]) == 14

assert Solution().minimumCost(target = "xxyyzz", words = ["xx","yy","zz","xy","yz"], costs = [5,5,5,1,1]) == 15

assert Solution().minimumCost(target = "ijklmnopqr", words = ["ijkl","mnop","qrst","ij","kl","mn","op","qr","rst"], costs = [5,5,10,1,1,1,1,1,2]) == 5

assert Solution().minimumCost(target = "programming", words = ["pro","gram","ming","program"], costs = [10,20,30,5]) == 35

assert Solution().minimumCost(target = "mississippi", words = ["miss","is","ppi","issi","pp"], costs = [10,2,5,3,4]) == 18

assert Solution().minimumCost(target = "aabbccddeeff", words = ["aa","bb","cc","dd","ee","ff","abc","def","efg"], costs = [1,2,3,4,5,6,7,8,9]) == 21

assert Solution().minimumCost(target = "abcdefg", words = ["abc","def","g","abcdef","efg","bc"], costs = [5,5,5,10,10,1]) == 15

assert Solution().minimumCost(target = "aaaaaaaaaa", words = ["aaa","aa","a"], costs = [1,2,3]) == 6

assert Solution().minimumCost(target = "repeatedword", words = ["rep","eat","edwo","rd"], costs = [2,3,4,1]) == 10

assert Solution().minimumCost(target = "mississippi", words = ["mis","issi","ssi","ippi","pi"], costs = [3,5,2,4,1]) == -1

assert Solution().minimumCost(target = "zzzzzzzzzzzzzzzzzzzz", words = ["zzz","zz","z"], costs = [100,10,1]) == 20

assert Solution().minimumCost(target = "aaaabbbb", words = ["aaa","bbb","aa","bb","a","b"], costs = [10,20,3,4,1,2]) == 12

assert Solution().minimumCost(target = "xylophone", words = ["x","y","l","o","ph","on","e"], costs = [2,2,2,2,5,4,3]) == 20

assert Solution().minimumCost(target = "complex", words = ["com", "plex", "le", "c", "x"], costs = [3, 7, 5, 2, 1]) == 10

assert Solution().minimumCost(target = "abcdefgabcdefg", words = ["abc","def","g","abcdef","gh"], costs = [10,15,2,30,5]) == 54

assert Solution().minimumCost(target = "abcdefg", words = ["a","bc","def","g"], costs = [2,1,3,1]) == 7

assert Solution().minimumCost(target = "aabbccddeeff", words = ["aa","bb","cc","dd","ee","ff","aabbccdd"], costs = [1,1,1,1,1,1,10]) == 6

assert Solution().minimumCost(target = "abcabcabcabc", words = ["abc","abcabc","ab"], costs = [5,10,1]) == 20

assert Solution().minimumCost(target = "qwert", words = ["qw","w","ert","er","q","t"], costs = [6,3,4,5,2,1]) == 9

assert Solution().minimumCost(target = "abcdefghij", words = ["a","bc","cde","def","efg","fgh","ghi","hij"], costs = [1,2,3,4,5,6,7,8]) == -1

assert Solution().minimumCost(target = "abacaba", words = ["aba","ac","b","c","a"], costs = [10,5,3,2,1]) == 12

assert Solution().minimumCost(target = "mississippi", words = ["mis","issi","ppi","iss","ippi"], costs = [5,2,3,1,4]) == -1

assert Solution().minimumCost(target = "xyzzxy", words = ["xy","zz","z","x","y"], costs = [5,2,1,2,2]) == 10

assert Solution().minimumCost(target = "abacabadabacaba", words = ["aba","aca","cab","bad","da"], costs = [10,20,30,40,50]) == -1

assert Solution().minimumCost(target = "mississippi", words = ["mis","is","ip","i","p"], costs = [5,3,2,1,1]) == -1

assert Solution().minimumCost(target = "zzzzzzzzzz", words = ["zz","zzz"], costs = [1,2]) == 5

assert Solution().minimumCost(target = "mnopqr", words = ["mno","pq","r","mnop","qr"], costs = [3,4,2,7,5]) == 9

assert Solution().minimumCost(target = "zzzzzzzzzzzz", words = ["zz","zzz","zzzz"], costs = [2,3,5]) == 12

assert Solution().minimumCost(target = "aabbccddeeff", words = ["ab","cd","ef","bb","cc","dd","ee","ff"], costs = [1,2,3,4,5,6,7,8]) == -1

assert Solution().minimumCost(target = "abcde", words = ["a","bc","d","e"], costs = [1,2,3,4]) == 10

assert Solution().minimumCost(target = "abcabcabcabc", words = ["abc","bc","c","a"], costs = [10,1,2,3]) == 16

assert Solution().minimumCost(target = "optimization", words = ["opt", "im", "iza", "tion"], costs = [100, 50, 75, 25]) == 250

assert Solution().minimumCost(target = "abcabcabc", words = ["abc","abcabc","ab","c","a"], costs = [10,5,2,3,1]) == 10

assert Solution().minimumCost(target = "recursion", words = ["recur","sion","cur","s","ion"], costs = [9,6,4,2,3]) == 14

assert Solution().minimumCost(target = "mississippi", words = ["mis","issi","ppi","ss","i"], costs = [10,20,30,40,50]) == -1

assert Solution().minimumCost(target = "dynamicprogramming", words = ["dyna","mic","prog","gram","ming","pro"], costs = [8,2,5,7,4,6]) == 27

assert Solution().minimumCost(target = "aaaabbbbcccc", words = ["aa","bb","cc","ab","bc","ca"], costs = [1,2,3,4,5,6]) == 12

assert Solution().minimumCost(target = "abcabcabcabc", words = ["abc","cab","bca"], costs = [10,15,20]) == 40

assert Solution().minimumCost(target = "aabbcc", words = ["aa","bb","cc","abc","bca"], costs = [4,5,6,10,8]) == 15

assert Solution().minimumCost(target = "abcdabc", words = ["a","bc","d","abc","abcd"], costs = [1,5,3,7,10]) == 15

assert Solution().minimumCost(target = "aabbcc", words = ["aa","bb","cc","a","b","c"], costs = [4,5,6,1,2,3]) == 12

assert Solution().minimumCost(target = "concatenation", words = ["conc","at","enate","tati","on"], costs = [12,7,15,8,4]) == -1

assert Solution().minimumCost(target = "longstring", words = ["long", "str", "ing", "longs", "tring"], costs = [20, 15, 10, 18, 12]) == 30

assert Solution().minimumCost(target = "hellohello", words = ["he","ll","o","hello"], costs = [2,1,3,5]) == 10

assert Solution().minimumCost(target = "hellohellohello", words = ["he","el","ll","lo","hello"], costs = [1,2,3,4,10]) == 30

assert Solution().minimumCost(target = "dynamic", words = ["dyn","am","ic","mic","nami","mic"], costs = [10,20,5,15,30,3]) == 35

assert Solution().minimumCost(target = "abcdefghijklmnopqrstuvwxyz", words = ["abc","def","ghi","jkl","mno","pqr","stu","vwx","yz"], costs = [1,2,3,4,5,6,7,8,9]) == 45

assert Solution().minimumCost(target = "hellohellohello", words = ["hello","ello","ll","llo","hel"], costs = [5,6,7,8,9]) == 15

assert Solution().minimumCost(target = "banana", words = ["ba", "na", "an", "nana"], costs = [1, 2, 3, 4]) == 5

assert Solution().minimumCost(target = "mississippi", words = ["mis","issi","ssippi","miss","ippi","is"], costs = [10,5,2,7,4,3]) == -1

assert Solution().minimumCost(target = "ababc", words = ["ab","aba","abc","bc"], costs = [3,4,5,1]) == 5

assert Solution().minimumCost(target = "abacabadabacaba", words = ["aba","abc","c","d","abacaba"], costs = [3,5,1,2,10]) == 16

assert Solution().minimumCost(target = "alphabet", words = ["al","pha","bet","a","l","ph","ab","be","et"], costs = [3,5,2,1,1,4,6,7,8]) == 9

assert Solution().minimumCost(target = "aaaaaaab", words = ["aaa","aa","a","b"], costs = [7,3,1,5]) == 12

assert Solution().minimumCost(target = "dynamicprogramming", words = ["dyn", "amic", "pro", "gram", "ming"], costs = [10, 5, 8, 3, 6]) == 32

assert Solution().minimumCost(target = "abacaba", words = ["a","b","aba","aca"], costs = [1,2,3,4]) == 10

assert Solution().minimumCost(target = "abacabadabacaba", words = ["aba","bac","caba"], costs = [7,8,9]) == -1

assert Solution().minimumCost(target = "xyxyxyxyxyxyxyxy", words = ["xyx","yxy","xy"], costs = [10,20,5]) == 40

assert Solution().minimumCost(target = "optimization", words = ["opt","im","iz","at","ion","optim","izati"], costs = [5,3,4,2,7,10,8]) == 21

assert Solution().minimumCost(target = "algorithms", words = ["algo","rithm","thm","log","orit"], costs = [6,9,7,5,10]) == -1

assert Solution().minimumCost(target = "abcdabcdabcd", words = ["abc","dabc","abcd"], costs = [5,15,10]) == 30

assert Solution().minimumCost(target = "hello", words = ["he", "el", "ll", "lo", "o"], costs = [10, 20, 30, 40, 50]) == 90

assert Solution().minimumCost(target = "mississippi", words = ["mis","issi","ppi","si","ss","pi"], costs = [7,8,5,2,6,4]) == -1

assert Solution().minimumCost(target = "abracadabra", words = ["ab", "ra", "ca", "da", "abra"], costs = [1, 2, 3, 4, 5]) == -1

assert Solution().minimumCost(target = "exampleexampleexample", words = ["ex","ample","exa","ple","eample"], costs = [5,8,4,6,7]) == 39

assert Solution().minimumCost(target = "banana", words = ["ba","na","ana","ban","ana"], costs = [1,2,3,4,5]) == 5

assert Solution().minimumCost(target = "subsequence", words = ["sub", "seq", "uen", "ce"], costs = [5, 3, 7, 2]) == 17

Answer: assert Solution().minimumCost(target = "abc", words = ["abc"], costs = [1]) == 1

Answer: assert Solution().minimumCost(target = "abc", words = ["abc"], costs = [10]) == 10

Answer: assert Solution().minimumCost(target = "abcd", words = ["ab", "cd"], costs = [1, 1]) == 2

Answer: assert Solution().minimumCost(target = "abc", words = ["a","b","c"], costs = [1,1,1]) == 3

Answer: assert Solution().minimumCost(target = "hello", words = ["he","ll","o"], costs = [5,7,2]) == 14

Answer: assert Solution().minimumCost(target = "abab", words = ["a","b","ab"], costs = [2,3,1]) == 2

Answer: assert Solution().minimumCost(target = "abcabc", words = ["abc","bc","c"], costs = [3,1,4]) == 6

Answer: assert Solution().minimumCost(target = "xyz", words = ["x","y","z"], costs = [2,2,2]) == 6

Answer: assert Solution().minimumCost(target = "hello", words = ["he","ll","o"], costs = [1,2,3]) == 6

Answer: assert Solution().minimumCost(target = "abcabc", words = ["abc","abcabc"], costs = [10,5]) == 5

Answer: assert Solution().minimumCost(target = "abcdef", words = ["abdef","abc","d","def","ef"], costs = [100,1,1,10,5]) == 7

Answer: assert Solution().minimumCost(target = "abcabc", words = ["abc","bc"], costs = [3,4]) == 6

Answer: assert Solution().minimumCost(target = "xyz", words = ["xy","yz"], costs = [5,6]) == -1

Answer: assert Solution().minimumCost(target = "xyz", words = ["xy","yz","z"], costs = [5,6,7]) == 12

Answer: assert Solution().minimumCost(target = "aaaa", words = ["z","zz","zzz"], costs = [1,10,100]) == -1

Answer: assert Solution().minimumCost(target = "xyz", words = ["xy", "y", "z"], costs = [2, 1, 1]) == 3

Answer: assert Solution().minimumCost(target = "abcde", words = ["a","bc","de"], costs = [1,2,3]) == 6

Answer: assert Solution().minimumCost(target = "abcdefg", words = ["abc","def","g","abcdef","efg"], costs = [1,2,3,5,4]) == 6

Answer: assert Solution().minimumCost(target = "backtracking", words = ["back","track","ing","backtr","ack"], costs = [7,6,5,10,4]) == 18

Answer: assert Solution().minimumCost(target = "qwerty", words = ["q","w","e","r","t","y","qw","er","ty"], costs = [1,2,3,4,5,6,7,8,9]) == 19

Answer: assert Solution().minimumCost(target = "abcdabcdabcd", words = ["ab","cd","abcd"], costs = [1,1,5]) == 6

Answer: assert Solution().minimumCost(target = "ababababab", words = ["a","ab","aba","bab"], costs = [1,2,3,4]) == 10

Answer: assert Solution().minimumCost(target = "abcabcabcabcabcabc", words = ["abc","ab","bc","c","a","b"], costs = [3,2,2,1,1,1]) == 18

Answer: assert Solution().minimumCost(target = "programming", words = ["pro","gram","ming","prog","amm"], costs = [10,20,30,5,25]) == 60

Answer: assert Solution().minimumCost(target = "mississippi", words = ["mis","sis","sip","i","p"], costs = [3,5,2,1,1]) == 12

Answer: assert Solution().minimumCost(target = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz", words = ["zzz","zz","z"], costs = [10,5,1]) == 80

Answer: assert Solution().minimumCost(target = "alibaba", words = ["ali","ba","ba","ba","ba","ba"], costs = [6,1,2,3,4,5]) == 8

Answer: assert Solution().minimumCost(target = "abcdabcd", words = ["abcd","cdab","bcda","dabc"], costs = [10,20,30,40]) == 20

Answer: assert Solution().minimumCost(target = "complexexample", words = ["com","plex","ex","ample","mple","ample","ple","le","e"], costs = [10,20,30,40,50,60,70,80,90]) == 100

Answer: assert Solution().minimumCost(target = "abacabadabacaba", words = ["aba","aca","bad","aba"], costs = [1,2,3,4]) == -1

Answer: assert Solution().minimumCost(target = "programming", words = ["pro","gram","ming","ming","program","ming"], costs = [10,20,5,15,5,3]) == 8

Answer: assert Solution().minimumCost(target = "ababab", words = ["aba","bab","ab"], costs = [2,3,1]) == 3

Answer: assert Solution().minimumCost(target = "xyzzzz", words = ["x","y","zz","z"], costs = [10,20,1,5]) == 32

Answer: assert Solution().minimumCost(target = "heuristics", words = ["heuri","stics","ric","heu","stic"], costs = [9,8,6,4,5]) == 17

Answer: assert Solution().minimumCost(target = "optimization", words = ["opt","imi","za","ti","on"], costs = [10,20,30,40,50]) == 150

Answer: assert Solution().minimumCost(target = "abcdeabcde", words = ["abc","de","abcde"], costs = [5,3,10]) == 16

Answer: assert Solution().minimumCost(target = "optimization", words = ["opt","imi","zation","tio","n"], costs = [5,7,8,6,2]) == 20

Answer: assert Solution().minimumCost(target = "repeated", words = ["rep", "eat", "ed"], costs = [10, 5, 1]) == 16

Answer: assert Solution().minimumCost(target = "abracadabra", words = ["abra","brac","cad","abra","dab"], costs = [5,3,7,4,2]) == 15

Answer: assert Solution().minimumCost(target = "optimization", words = ["opti","miz","at","iz","izati","on"], costs = [6,5,10,3,8,4]) == -1

Answer: assert Solution().minimumCost(target = "aabbcc", words = ["aa","bb","cc","aabb","bbcc"], costs = [3,4,5,8,9]) == 12

Answer: assert Solution().minimumCost(target = "abcdabcdabcd", words = ["abcd","bc","c","a","abc"], costs = [10,1,2,3,5]) == 30

Answer: assert Solution().minimumCost(target = "programming", words = ["pro","gram","ming","prog","ram","ming"], costs = [7,5,4,8,3,6]) == 15

Answer: assert Solution().minimumCost(target = "abcdabcd", words = ["abc","abcd","ab","cd"], costs = [5,1,2,3]) == 2

Answer: assert Solution().minimumCost(target = "dynamicprogramming", words = ["dyn","ami","cpro","gram","ming"], costs = [12,11,14,13,9]) == 59

Answer: assert Solution().minimumCost(target = "hellohellohello", words = ["hel","lo","hello","helol"], costs = [2,3,6,8]) == 15

Answer: assert Solution().minimumCost(target = "abcdefghijklmnopqrstuvwxyz", words = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"], costs = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]) == 351

Answer: assert Solution().minimumCost(target = "banana", words = ["ba","na","an","bana","nana"], costs = [2,3,4,5,6]) == 8

Answer: assert Solution().minimumCost(target = "ababababab", words = ["aba","bab"], costs = [5,3]) == -1

Answer: assert Solution().minimumCost(target = "longstringlongstring", words = ["long","str","ing","longstring"], costs = [12,9,10,25]) == 50

Answer: assert Solution().minimumCost(target = "abcdefgh", words = ["abcd","efgh","abc","def","ghi","ab","cd","ef","gh"], costs = [10,10,5,5,5,1,1,1,1]) == 4

Answer: assert Solution().minimumCost(target = "programming", words = ["pro","gram","ming","program","progr"], costs = [5,3,7,12,8]) == 15

Answer: assert Solution().minimumCost(target = "zzzzzzzzzz", words = ["zz","zzz","zzzz"], costs = [10,15,20]) == 50

Answer: assert Solution().minimumCost(target = "repeatedwords", words = ["rep","eat","edw","ords"], costs = [3,5,2,4]) == 14

Answer: assert Solution().minimumCost(target = "xxyyzz", words = ["xx","yy","zz","xy","yz"], costs = [5,5,5,1,1]) == 15

Answer: assert Solution().minimumCost(target = "ijklmnopqr", words = ["ijkl","mnop","qrst","ij","kl","mn","op","qr","rst"], costs = [5,5,10,1,1,1,1,1,2]) == 5

Answer: assert Solution().minimumCost(target = "programming", words = ["pro","gram","ming","program"], costs = [10,20,30,5]) == 35

Answer: assert Solution().minimumCost(target = "mississippi", words = ["miss","is","ppi","issi","pp"], costs = [10,2,5,3,4]) == 18

Answer: assert Solution().minimumCost(target = "aabbccddeeff", words = ["aa","bb","cc","dd","ee","ff","abc","def","efg"], costs = [1,2,3,4,5,6,7,8,9]) == 21

Answer: assert Solution().minimumCost(target = "abcdefg", words = ["abc","def","g","abcdef","efg","bc"], costs = [5,5,5,10,10,1]) == 15

Answer: assert Solution().minimumCost(target = "aaaaaaaaaa", words = ["aaa","aa","a"], costs = [1,2,3]) == 6

Answer: assert Solution().minimumCost(target = "repeatedword", words = ["rep","eat","edwo","rd"], costs = [2,3,4,1]) == 10

Answer: assert Solution().minimumCost(target = "mississippi", words = ["mis","issi","ssi","ippi","pi"], costs = [3,5,2,4,1]) == -1

Answer: assert Solution().minimumCost(target = "zzzzzzzzzzzzzzzzzzzz", words = ["zzz","zz","z"], costs = [100,10,1]) == 20

Answer: assert Solution().minimumCost(target = "aaaabbbb", words = ["aaa","bbb","aa","bb","a","b"], costs = [10,20,3,4,1,2]) == 12

Answer: assert Solution().minimumCost(target = "xylophone", words = ["x","y","l","o","ph","on","e"], costs = [2,2,2,2,5,4,3]) == 20

Answer: assert Solution().minimumCost(target = "complex", words = ["com", "plex", "le", "c", "x"], costs = [3, 7, 5, 2, 1]) == 10

Answer: assert Solution().minimumCost(target = "abcdefgabcdefg", words = ["abc","def","g","abcdef","gh"], costs = [10,15,2,30,5]) == 54

Answer: assert Solution().minimumCost(target = "abcdefg", words = ["a","bc","def","g"], costs = [2,1,3,1]) == 7

Answer: assert Solution().minimumCost(target = "aabbccddeeff", words = ["aa","bb","cc","dd","ee","ff","aabbccdd"], costs = [1,1,1,1,1,1,10]) == 6

Answer: assert Solution().minimumCost(target = "abcabcabcabc", words = ["abc","abcabc","ab"], costs = [5,10,1]) == 20

Answer: assert Solution().minimumCost(target = "qwert", words = ["qw","w","ert","er","q","t"], costs = [6,3,4,5,2,1]) == 9

Answer: assert Solution().minimumCost(target = "abcdefghij", words = ["a","bc","cde","def","efg","fgh","ghi","hij"], costs = [1,2,3,4,5,6,7,8]) == -1

Answer: assert Solution().minimumCost(target = "abacaba", words = ["aba","ac","b","c","a"], costs = [10,5,3,2,1]) == 12

Answer: assert Solution().minimumCost(target = "mississippi", words = ["mis","issi","ppi","iss","ippi"], costs = [5,2,3,1,4]) == -1

Answer: assert Solution().minimumCost(target = "xyzzxy", words = ["xy","zz","z","x","y"], costs = [5,2,1,2,2]) == 10

Answer: assert Solution().minimumCost(target = "abacabadabacaba", words = ["aba","aca","cab","bad","da"], costs = [10,20,30,40,50]) == -1

Answer: assert Solution().minimumCost(target = "mississippi", words = ["mis","is","ip","i","p"], costs = [5,3,2,1,1]) == -1

Answer: assert Solution().minimumCost(target = "zzzzzzzzzz", words = ["zz","zzz"], costs = [1,2]) == 5

Answer: assert Solution().minimumCost(target = "abcdefghijklmnopqrstuvwxyz", words = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"], costs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]) == 351

Answer: assert Solution().minimumCost(target = "mnopqr", words = ["mno","pq","r","mnop","qr"], costs = [3,4,2,7,5]) == 9

Answer: assert Solution().minimumCost(target = "zzzzzzzzzzzz", words = ["zz","zzz","zzzz"], costs = [2,3,5]) == 12

Answer: assert Solution().minimumCost(target = "aabbccddeeff", words = ["ab","cd","ef","bb","cc","dd","ee","ff"], costs = [1,2,3,4,5,6,7,8]) == -1

Answer: assert Solution().minimumCost(target = "abcdefg", words = ["a","b","c","d","e","f","g"], costs = [100000, 90000, 80000, 70000, 60000, 50000, 40000]) == 490000

Answer: assert Solution().minimumCost(target = "abcde", words = ["a","bc","d","e"], costs = [1,2,3,4]) == 10

Answer: assert Solution().minimumCost(target = "abcabcabcabc", words = ["abc","bc","c","a"], costs = [10,1,2,3]) == 16

Answer: assert Solution().minimumCost(target = "optimization", words = ["opt", "im", "iza", "tion"], costs = [100, 50, 75, 25]) == 250

Answer: assert Solution().minimumCost(target = "abcabcabc", words = ["abc","abcabc","ab","c","a"], costs = [10,5,2,3,1]) == 10

Answer: assert Solution().minimumCost(target = "recursion", words = ["recur","sion","cur","s","ion"], costs = [9,6,4,2,3]) == 14

Answer: assert Solution().minimumCost(target = "mississippi", words = ["mis","issi","ppi","ss","i"], costs = [10,20,30,40,50]) == -1

Answer: assert Solution().minimumCost(target = "dynamicprogramming", words = ["dyna","mic","prog","gram","ming","pro"], costs = [8,2,5,7,4,6]) == 27

Answer: assert Solution().minimumCost(target = "aaaabbbbcccc", words = ["aa","bb","cc","ab","bc","ca"], costs = [1,2,3,4,5,6]) == 12

Answer: assert Solution().minimumCost(target = "abcabcabcabc", words = ["abc","cab","bca"], costs = [10,15,20]) == 40

Answer: assert Solution().minimumCost(target = "aabbcc", words = ["aa","bb","cc","abc","bca"], costs = [4,5,6,10,8]) == 15

Answer: assert Solution().minimumCost(target = "abcdabc", words = ["a","bc","d","abc","abcd"], costs = [1,5,3,7,10]) == 15

Answer: assert Solution().minimumCost(target = "aabbcc", words = ["aa","bb","cc","a","b","c"], costs = [4,5,6,1,2,3]) == 12

Answer: assert Solution().minimumCost(target = "concatenation", words = ["conc","at","enate","tati","on"], costs = [12,7,15,8,4]) == -1

Answer: assert Solution().minimumCost(target = "longstring", words = ["long", "str", "ing", "longs", "tring"], costs = [20, 15, 10, 18, 12]) == 30

Answer: assert Solution().minimumCost(target = "hellohello", words = ["he","ll","o","hello"], costs = [2,1,3,5]) == 10

Answer: assert Solution().minimumCost(target = "hellohellohello", words = ["he","el","ll","lo","hello"], costs = [1,2,3,4,10]) == 30

Answer: assert Solution().minimumCost(target = "dynamic", words = ["dyn","am","ic","mic","nami","mic"], costs = [10,20,5,15,30,3]) == 35

Answer: assert Solution().minimumCost(target = "abcdefghijklmnopqrstuvwxyz", words = ["abc","def","ghi","jkl","mno","pqr","stu","vwx","yz"], costs = [1,2,3,4,5,6,7,8,9]) == 45

Answer: assert Solution().minimumCost(target = "hellohellohello", words = ["hello","ello","ll","llo","hel"], costs = [5,6,7,8,9]) == 15

Answer: assert Solution().minimumCost(target = "banana", words = ["ba", "na", "an", "nana"], costs = [1, 2, 3, 4]) == 5

Answer: assert Solution().minimumCost(target = "mississippi", words = ["mis","issi","ssippi","miss","ippi","is"], costs = [10,5,2,7,4,3]) == -1

Answer: assert Solution().minimumCost(target = "ababc", words = ["ab","aba","abc","bc"], costs = [3,4,5,1]) == 5

Answer: assert Solution().minimumCost(target = "abacabadabacaba", words = ["aba","abc","c","d","abacaba"], costs = [3,5,1,2,10]) == 16

Answer: assert Solution().minimumCost(target = "alphabet", words = ["al","pha","bet","a","l","ph","ab","be","et"], costs = [3,5,2,1,1,4,6,7,8]) == 9

Answer: assert Solution().minimumCost(target = "aaaaaaab", words = ["aaa","aa","a","b"], costs = [7,3,1,5]) == 12

Answer: assert Solution().minimumCost(target = "dynamicprogramming", words = ["dyn", "amic", "pro", "gram", "ming"], costs = [10, 5, 8, 3, 6]) == 32

Answer: assert Solution().minimumCost(target = "abacaba", words = ["a","b","aba","aca"], costs = [1,2,3,4]) == 10

Answer: assert Solution().minimumCost(target = "abacabadabacaba", words = ["aba","bac","caba"], costs = [7,8,9]) == -1

Answer: assert Solution().minimumCost(target = "xyxyxyxyxyxyxyxy", words = ["xyx","yxy","xy"], costs = [10,20,5]) == 40

Answer: assert Solution().minimumCost(target = "optimization", words = ["opt","im","iz","at","ion","optim","izati"], costs = [5,3,4,2,7,10,8]) == 21

Answer: assert Solution().minimumCost(target = "algorithms", words = ["algo","rithm","thm","log","orit"], costs = [6,9,7,5,10]) == -1

Answer: assert Solution().minimumCost(target = "abcdabcdabcd", words = ["abc","dabc","abcd"], costs = [5,15,10]) == 30

Answer: assert Solution().minimumCost(target = "hello", words = ["he", "el", "ll", "lo", "o"], costs = [10, 20, 30, 40, 50]) == 90

Answer: assert Solution().minimumCost(target = "mississippi", words = ["mis","issi","ppi","si","ss","pi"], costs = [7,8,5,2,6,4]) == -1

Answer: assert Solution().minimumCost(target = "abracadabra", words = ["ab", "ra", "ca", "da", "abra"], costs = [1, 2, 3, 4, 5]) == -1

Answer: assert Solution().minimumCost(target = "exampleexampleexample", words = ["ex","ample","exa","ple","eample"], costs = [5,8,4,6,7]) == 39

Answer: assert Solution().minimumCost(target = "banana", words = ["ba","na","ana","ban","ana"], costs = [1,2,3,4,5]) == 5

Answer: assert Solution().minimumCost(target = "subsequence", words = ["sub", "seq", "uen", "ce"], costs = [5, 3, 7, 2]) == 17

import random
import functools
import collections
import string
import math
import datetime

from typing import *
from functools import *
from collections import *
from itertools import *
from heapq import *
from bisect import *
from string import *
from operator import *
from math import *

inf = float('inf')

class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next

def list_node(values: list):
    if not values:
        return None
    head = ListNode(values[0])
    p = head
    for val in values[1:]:
        node = ListNode(val)
        p.next = node
        p = node
    return head

def is_same_list(p1, p2):
    if p1 is None and p2 is None:
        return True
    if not p1 or not p2:
        return False
    return p1.val == p2.val and is_same_list(p1.next, p2.next)

class TreeNode:
    def __init__(self, val=0, left=None, right=None):
        self.val = val
        self.left = left
        self.right = right

def tree_node(values: list):
    if not values:
        return None
    root = TreeNode(values[0])
    i = 1
    queue = deque()
    queue.append(root)
    while queue:
        node = queue.popleft()
        if i < len(values) and values[i] is not None:
            node.left = TreeNode(values[i])
            queue.append(node.left)
        i += 1
        if i < len(values) and values[i] is not None:
            node.right = TreeNode(values[i])
            queue.append(node.right)
        i += 1
    return root

def is_same_tree(p, q):
    if not p and not q:
        return True
    elif not p or not q:
        return False
    elif p.val != q.val:
        return False
    else:
        return is_same_tree(p.left, q.left) and is_same_tree(p.right, q.right)

class Trie:
    def __init__(self):
        self.children: List[Optional[Trie]] = [None] * 26
        self.cost = inf

    def insert(self, word: str, cost: int):
        node = self
        for c in word:
            idx = ord(c) - ord("a")
            if node.children[idx] is None:
                node.children[idx] = Trie()
            node = node.children[idx]
        node.cost = min(node.cost, cost)

class Solution:
    def minimumCost(self, target: str, words: List[str], costs: List[int]) -> int:
        @cache
        def dfs(i: int) -> int:
            if i >= len(target):
                return 0
            ans = inf
            node = trie
            for j in range(i, len(target)):
                idx = ord(target[j]) - ord("a")
                if node.children[idx] is None:
                    return ans
                node = node.children[idx]
                ans = min(ans, node.cost + dfs(j + 1))
            return ans

        trie = Trie()
        for word, cost in zip(words, costs):
            trie.insert(word, cost)
        ans = dfs(0)
        return ans if ans < inf else -1

class Solution:
    def minimumCost(self, target: str, words: List[str], costs: List[int]) -> int:


You are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python
<code>
```

PROBLEM:
You are given an array of integers nums of length n and a positive integer k.
The power of an array is defined as:

Its maximum element if all of its elements are consecutive and sorted in ascending order.
-1 otherwise.

You need to find the power of all subarrays of nums of size k.
Return an integer array results of size n - k + 1, where results[i] is the power of nums[i..(i + k - 1)].

Example 1:

Input: nums = [1,2,3,4,3,2,5], k = 3
Output: [3,4,-1,-1,-1]
Explanation:
There are 5 subarrays of nums of size 3:

[1, 2, 3] with the maximum element 3.
[2, 3, 4] with the maximum element 4.
[3, 4, 3] whose elements are not consecutive.
[4, 3, 2] whose elements are not sorted.
[3, 2, 5] whose elements are not consecutive.

Example 2:

Input: nums = [2,2,2,2,2], k = 4
Output: [-1,-1]

Example 3:

Input: nums = [3,2,3,2,3,2], k = 2
Output: [-1,3,-1,3,-1]

Constraints:

1 <= n == nums.length <= 500
1 <= nums[i] <= 105
1 <= k <= n

Your solution to the problem should be a method of the class Solution called resultsArray and should pass all tests. Use the following starter code:
```python
class Solution:
    def resultsArray(self, nums: List[int], k: int) -> List[int]:
        # Add your code here
```

SOLUTION:

Question:
PROBLEM:
You are given an array of integers nums of length n and a positive integer k.
The power of an array is defined as:

Its maximum element if all of its elements are consecutive and sorted in ascending order.
-1 otherwise.

You need to find the power of all subarrays of nums of size k.
Return an integer array results of size n - k + 1, where results[i] is the power of nums[i..(i + k - 1)].

Example 1:

Input: nums = [1,2,3,4,3,2,5], k = 3
Output: [3,4,-1,-1,-1]
Explanation:
There are 5 subarrays of nums of size 3:

[1, 2, 3] with the maximum element 3.
[2, 3, 4] with the maximum element 4.
[3, 4, 3] whose elements are not consecutive.
[4, 3, 2] whose elements are not sorted.
[3, 2, 5] whose elements are not consecutive.

Example 2:

Input: nums = [2,2,2,2,2], k = 4
Output: [-1,-1]

Example 3:

Input: nums = [3,2,3,2,3,2], k = 2
Output: [-1,3,-1,3,-1]

Constraints:

1 <= n == nums.length <= 500
1 <= nums[i] <= 105
1 <= k <= n

Your solution to the problem should be a method of the class Solution called resultsArray and should pass all tests. Use the following starter code:
```python
class Solution:
    def resultsArray(self, nums: List[int], k: int) -> List[int]:
        # Add your code here
```

SOLUTION:

assert Solution().resultsArray(nums = [1,2,3,4,5], k = 5) == [5]

assert Solution().resultsArray(nums = [2,2,2,2,2], k = 4) == [-1, -1]

assert Solution().resultsArray(nums = [1,3,5,7,9], k = 5) == [-1]

assert Solution().resultsArray(nums = [5,6,7,8,9,10], k = 5) == [9, 10]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5], k = 5) == [5]

Answer: assert Solution().resultsArray(nums = [2,2,2,2,2], k = 4) == [-1, -1]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11], k = 5) == [-1, -1]

Answer: assert Solution().resultsArray(nums = [10,9,8,7,6,5], k = 4) == [-1, -1, -1]

Answer: assert Solution().resultsArray(nums = [10,20,30,40,50], k = 1) == [10, 20, 30, 40, 50]

Answer: assert Solution().resultsArray(nums = [1,3,2,4,5,6], k = 4) == [-1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9], k = 5) == [-1]

Answer: assert Solution().resultsArray(nums = [5,6,7,8,9,10], k = 5) == [9, 10]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,3,2,5], k = 3) == [3, 4, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [10,9,8,7,6,5,4,3,2,1], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [3,2,3,2,3,2], k = 2) == [-1, 3, -1, 3, -1]

Answer: assert Solution().resultsArray(nums = [10,9,8,7,6,5], k = 3) == [-1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [5,4,3,2,1], k = 3) == [-1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 7) == [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [10,20,30,40,50,60,70,80,90,100,110], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], k = 7) == [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35], k = 15) == [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]

Answer: assert Solution().resultsArray(nums = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,1,2,3,4,5,6,7,8,9,10], k = 5) == [5, -1, -1, -1, -1, 5, 6, 7, 8, 9, 10]

Answer: assert Solution().resultsArray(nums = [7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 7) == [13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41, 40, 43, 42, 45, 44, 47, 46, 49, 48], k = 20) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10], k = 10) == [10, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10]

Answer: assert Solution().resultsArray(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112], k = 9) == [108, 109, 110, 111, 112]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50], k = 25) == [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31], k = 7) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,1,1,1,1,2,3,4,5,1,1,1,1,1,2,3,4,5], k = 5) == [-1, -1, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, 5]

Answer: assert Solution().resultsArray(nums = [3, 4, 5, 1, 2, 6, 7, 8, 9, 10], k = 4) == [-1, -1, -1, -1, -1, 9, 10]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59], k = 15) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,3,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 5) == [-1, -1, -1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1,2,3,5,6,7,8,10,11,12,14,15], k = 3) == [3, -1, -1, 7, 8, -1, -1, 12, -1, -1]

Answer: assert Solution().resultsArray(nums = [3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12], k = 6) == [-1, -1, -1, 9, 10, 11, 12]

Answer: assert Solution().resultsArray(nums = [5,6,7,8,9,10,11,12,13,14,15], k = 5) == [9, 10, 11, 12, 13, 14, 15]

Answer: assert Solution().resultsArray(nums = [1,2,3,5,6,7,8,9,10,11], k = 5) == [-1, -1, -1, 9, 10, 11]

Answer: assert Solution().resultsArray(nums = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], k = 15) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 5, 6, 7, 8, 10, 11, 12], k = 5) == [-1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [100,101,102,103,104,105,106,107,108,109,110], k = 6) == [105, 106, 107, 108, 109, 110]

Answer: assert Solution().resultsArray(nums = [50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31], k = 6) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [3,2,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 5) == [-1, -1, -1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150], k = 10) == [109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5], k = 15) == [15, 16, 17, 18, 19, 20, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,1,2,3,4], k = 7) == [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5], k = 4) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], k = 30) == [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40], k = 5) == [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]

Answer: assert Solution().resultsArray(nums = [1,3,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 4) == [-1, -1, -1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119], k = 5) == [104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119]

Answer: assert Solution().resultsArray(nums = [5,6,7,8,9,10,5,6,7,8,9,10,5,6,7,8,9,10], k = 6) == [10, -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, 10]

Answer: assert Solution().resultsArray(nums = [7,8,9,10,11,12,13,14,15,16], k = 5) == [11, 12, 13, 14, 15, 16]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,1], k = 5) == [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1]

Answer: assert Solution().resultsArray(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39], k = 8) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40], k = 10) == [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 6) == [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], k = 5) == [-1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 3, 2, 4, 6, 5, 7, 9, 8, 10, 12, 11, 13, 15, 14, 16, 18, 17, 19, 21, 20, 22, 24, 23, 25, 27, 26, 28, 30, 29, 31, 33, 32, 34, 36, 35, 37, 39, 38, 40, 42, 41, 43, 45, 44, 46, 48, 47, 49, 50], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5], k = 6) == [6, 7, 8, 9, 10, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,4,5,6,7,8,9,10], k = 3) == [-1, -1, 6, 7, 8, 9, 10]

Answer: assert Solution().resultsArray(nums = [10,9,8,7,6,5,4,3,2,1,1,1,1,1,1,1,1,1,1,1], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], k = 7) == [7, 8, 9, 10, 11, 12, 13]

Answer: assert Solution().resultsArray(nums = [9,8,7,6,5,4,3,2,1,10,11,12], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 5, 6, 7, 8, 10, 11, 12], k = 4) == [-1, -1, -1, 8, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [10,9,8,7,6,5,4,3,2,1,10,9,8,7,6,5,4,3,2,1], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,3,2,5,4,7,6,9,8,11,10,13,12,15,14,17,16,19,18,20], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 9) == [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30], k = 5) == [-1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5], k = 5) == [5, -1, -1, -1, -1, 5, -1, -1, -1, -1, 5, -1, -1, -1, -1, 5]

Answer: assert Solution().resultsArray(nums = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 10) == [-1, -1, -1, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40], k = 9) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,5,6,7,8,9,10], k = 4) == [-1, -1, -1, 8, 9, 10]

Answer: assert Solution().resultsArray(nums = [10,20,30,40,50,60,70,80,90,100,110,120,130,140,150], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [3,5,7,9,11,13,15,17,19,21], k = 6) == [-1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,2,3,4,5,4,5,6,7,8,9,8,7,6,5,4,3,2,1], k = 3) == [3, -1, -1, 4, 5, -1, -1, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], k = 7) == [-1, -1, -1, -1, -1, 9, 10, 11, 12, 13]

Answer: assert Solution().resultsArray(nums = [2,3,4,5,6,7,8,9,10,1,11,12,13,14,15,16,17,18,19,20], k = 5) == [6, 7, 8, 9, 10, -1, -1, -1, -1, -1, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26], k = 15) == [21, 22, 23, 24, 25, 26]

Answer: assert Solution().resultsArray(nums = [10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200], k = 10) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,1,2,3,4,5,6,7,8,9,10,11,12], k = 7) == [-1, 7, 8, 9, 10, 11, 12]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30], k = 10) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]

Answer: assert Solution().resultsArray(nums = [1, 2, 4, 5, 6, 7, 8, 9, 10], k = 4) == [-1, -1, 7, 8, 9, 10]

Answer: assert Solution().resultsArray(nums = [1,2,3,5,6,7,8,9,10,11,12], k = 5) == [-1, -1, -1, 9, 10, 11, 12]

Answer: assert Solution().resultsArray(nums = [7,8,9,10,11,12,13,14,15], k = 5) == [11, 12, 13, 14, 15]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], k = 50) == [50]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], k = 10) == [10, 11, 12, 13, 14, 15]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], k = 8) == [8, 9, 10, 11, 12, 13, 14, 15]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 5) == [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1,2,3,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20], k = 5) == [-1, -1, -1, 9, 10, -1, -1, -1, -1, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k = 5) == [5, 6, 7, 8, 9, 10]

Answer: assert Solution().resultsArray(nums = [10,20,30,40,50,60,70,80,90,100], k = 4) == [-1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,3,4,5,6,7,8,9,10,8,9,10,11,12,13,14], k = 5) == [5, -1, -1, -1, -1, 7, 8, 9, 10, -1, -1, -1, -1, 12, 13, 14]

Answer: assert Solution().resultsArray(nums = [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], k = 15) == [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [5,6,7,8,9,1,2,3,4], k = 5) == [9, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], k = 8) == [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 5, 6, 8, 9, 11, 12, 14, 15, 17, 18, 20, 21, 23, 24, 26, 27, 29], k = 6) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], k = 20) == [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]

Answer: assert Solution().resultsArray(nums = [10,20,30,40,50,60,70,80,90,100], k = 2) == [-1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], k = 1) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]

Answer: assert Solution().resultsArray(nums = [1,1,2,2,3,3,4,4,5,5], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,2,3,4,5,6,7,8,9], k = 5) == [-1, -1, 6, 7, 8, 9]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 10) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39], k = 7) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], k = 6) == [10, 11, 12, 13, 14, 15]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], k = 10) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]

Answer: assert Solution().resultsArray(nums = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 10) == [14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [2, 1, 3, 5, 4, 7, 6, 8, 10, 9, 11, 13, 12, 14, 16, 15, 17, 19, 18, 20, 22, 21, 23, 25, 24, 26, 28, 27, 29, 31, 30, 32, 34, 33, 35, 37, 36, 38, 40, 39, 41, 43, 42, 44, 46, 45, 47, 49, 48], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [3,2,1,4,3,2,1,5,4,3,2,1,6,5,4,3,2,1,7,6,5,4,3,2,1], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,2,1,2,3,4,3,2,1,2,3,4,5,4,3,2,1,2,3,4], k = 4) == [-1, -1, -1, -1, 4, -1, -1, -1, -1, -1, 4, 5, -1, -1, -1, -1, -1, -1, 4]

Answer: assert Solution().resultsArray(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25], k = 4) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [3, 2, 1, 6, 5, 4, 9, 8, 7, 12, 11, 10, 15, 14, 13, 18, 17, 16, 21, 20, 19], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 10) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1,2,2,3,4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,18,19,20], k = 5) == [-1, -1, 6, 7, 8, 9, 10, -1, -1, -1, -1, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 6) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39], k = 15) == [-1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9], k = 4) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 3, 2, 4, 6, 5, 7, 9, 8, 10, 12, 11, 13, 15, 14, 16], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,3,4,5,6,7,8,9,10,11,12,13,14,15], k = 5) == [5, -1, -1, -1, -1, 7, 8, 9, 10, 11, 12, 13, 14, 15]

Answer: assert Solution().resultsArray(nums = [1,3,2,4,5,6,7,8,9,10,11,12,13,14,15], k = 5) == [-1, -1, -1, 8, 9, 10, 11, 12, 13, 14, 15]

Answer: assert Solution().resultsArray(nums = [7,8,9,10,11,12,13,14,15,16,17,18,19], k = 7) == [13, 14, 15, 16, 17, 18, 19]

Answer: assert Solution().resultsArray(nums = [1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], k = 10) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10], k = 4) == [4, 5, 6, 7, 8, 9, 10]

Answer: assert Solution().resultsArray(nums = [5,6,7,8,9,4,3,2,1,10,11,12,13,14,15,16,17,18,19,20], k = 4) == [8, 9, -1, -1, -1, -1, -1, -1, -1, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12], k = 6) == [6, 7, 8, 9, 10, 11, 12]

import random
import functools
import collections
import string
import math
import datetime

from typing import *
from functools import *
from collections import *
from itertools import *
from heapq import *
from bisect import *
from string import *
from operator import *
from math import *

inf = float('inf')

class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next

def list_node(values: list):
    if not values:
        return None
    head = ListNode(values[0])
    p = head
    for val in values[1:]:
        node = ListNode(val)
        p.next = node
        p = node
    return head

def is_same_list(p1, p2):
    if p1 is None and p2 is None:
        return True
    if not p1 or not p2:
        return False
    return p1.val == p2.val and is_same_list(p1.next, p2.next)

class TreeNode:
    def __init__(self, val=0, left=None, right=None):
        self.val = val
        self.left = left
        self.right = right

def tree_node(values: list):
    if not values:
        return None
    root = TreeNode(values[0])
    i = 1
    queue = deque()
    queue.append(root)
    while queue:
        node = queue.popleft()
        if i < len(values) and values[i] is not None:
            node.left = TreeNode(values[i])
            queue.append(node.left)
        i += 1
        if i < len(values) and values[i] is not None:
            node.right = TreeNode(values[i])
            queue.append(node.right)
        i += 1
    return root

def is_same_tree(p, q):
    if not p and not q:
        return True
    elif not p or not q:
        return False
    elif p.val != q.val:
        return False
    else:
        return is_same_tree(p.left, q.left) and is_same_tree(p.right, q.right)

class Solution:
    def resultsArray(self, nums: List[int], k: int) -> List[int]:
        n = len(nums)
        f = [1] * n
        for i in range(1, n):
            if nums[i] == nums[i - 1] + 1:
                f[i] = f[i - 1] + 1
        return [nums[i] if f[i] >= k else -1 for i in range(k - 1, n)]


You are an expert Python programmer. Write correct, efficient Python 3 code that solves the problem and passes all tests. Output the code in the following format: ```python
<code>
```

PROBLEM:
You are given an array of integers nums of length n and a positive integer k.
The power of an array is defined as:

Its maximum element if all of its elements are consecutive and sorted in ascending order.
-1 otherwise.

You need to find the power of all subarrays of nums of size k.
Return an integer array results of size n - k + 1, where results[i] is the power of nums[i..(i + k - 1)].

Example 1:

Input: nums = [1,2,3,4,3,2,5], k = 3
Output: [3,4,-1,-1,-1]
Explanation:
There are 5 subarrays of nums of size 3:

[1, 2, 3] with the maximum element 3.
[2, 3, 4] with the maximum element 4.
[3, 4, 3] whose elements are not consecutive.
[4, 3, 2] whose elements are not sorted.
[3, 2, 5] whose elements are not consecutive.

Example 2:

Input: nums = [2,2,2,2,2], k = 4
Output: [-1,-1]

Example 3:

Input: nums = [3,2,3,2,3,2], k = 2
Output: [-1,3,-1,3,-1]

Constraints:

1 <= n == nums.length <= 105
1 <= nums[i] <= 106
1 <= k <= n

Your solution to the problem should be a method of the class Solution called resultsArray and should pass all tests. Use the following starter code:
```python
class Solution:
    def resultsArray(self, nums: List[int], k: int) -> List[int]:
        # Add your code here
```

SOLUTION:

Question:
PROBLEM:
You are given an array of integers nums of length n and a positive integer k.
The power of an array is defined as:

Its maximum element if all of its elements are consecutive and sorted in ascending order.
-1 otherwise.

You need to find the power of all subarrays of nums of size k.
Return an integer array results of size n - k + 1, where results[i] is the power of nums[i..(i + k - 1)].

Example 1:

Input: nums = [1,2,3,4,3,2,5], k = 3
Output: [3,4,-1,-1,-1]
Explanation:
There are 5 subarrays of nums of size 3:

[1, 2, 3] with the maximum element 3.
[2, 3, 4] with the maximum element 4.
[3, 4, 3] whose elements are not consecutive.
[4, 3, 2] whose elements are not sorted.
[3, 2, 5] whose elements are not consecutive.

Example 2:

Input: nums = [2,2,2,2,2], k = 4
Output: [-1,-1]

Example 3:

Input: nums = [3,2,3,2,3,2], k = 2
Output: [-1,3,-1,3,-1]

Constraints:

1 <= n == nums.length <= 105
1 <= nums[i] <= 106
1 <= k <= n

Your solution to the problem should be a method of the class Solution called resultsArray and should pass all tests. Use the following starter code:
```python
class Solution:
    def resultsArray(self, nums: List[int], k: int) -> List[int]:
        # Add your code here
```

SOLUTION:

assert Solution().resultsArray(nums = [2,2,2,2,2], k = 4) == [-1, -1]

assert Solution().resultsArray(nums = [1], k = 1) == [1]

assert Solution().resultsArray(nums = [1,3,5,7,9], k = 5) == [-1]

Answer: assert Solution().resultsArray(nums = [100,101,102,103,104,105], k = 2) == [101, 102, 103, 104, 105]

Answer: assert Solution().resultsArray(nums = [2,2,2,2,2], k = 4) == [-1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10], k = 1) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10], k = 10) == [10]

Answer: assert Solution().resultsArray(nums = [10,9,8,7,6], k = 2) == [-1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,3,2,5], k = 3) == [3, 4, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [3,2,3,2,3,2], k = 2) == [-1, 3, -1, 3, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,5,6,7,8,9,10], k = 4) == [-1, -1, -1, 8, 9, 10]

Answer: assert Solution().resultsArray(nums = [5,6,7,8,9,10,11,12,13], k = 5) == [9, 10, 11, 12, 13]

Answer: assert Solution().resultsArray(nums = [1], k = 1) == [1]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11,13,15,17], k = 4) == [-1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [5,6,7,8,9,10,11,12,13,14], k = 10) == [14]

Answer: assert Solution().resultsArray(nums = [9,8,7,6,5,4,3,2,1], k = 3) == [-1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,1,2,1,2,1,2,1,2], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9], k = 5) == [-1]

Answer: assert Solution().resultsArray(nums = [10,9,8,7,6,5,4,3,2,1], k = 4) == [-1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,1,1,1,1,1,1,1,1], k = 2) == [-1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [10,20,30,40,50,60,70,80,90], k = 3) == [-1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,1,2,2,3,3,4,4,5,5], k = 2) == [-1, 2, -1, 3, -1, 4, -1, 5, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], k = 6) == [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], k = 7) == [7, 8, 9, 10, 11, 12]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k = 5) == [5, 6, 7, 8, 9, 10, -1, -1, -1, -1, 5, 6, 7, 8, 9, 10]

Answer: assert Solution().resultsArray(nums = [1000000,999999,999998,999997,999996,999995,999994,999993,999992,999991], k = 5) == [-1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 7) == [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], k = 9) == [9, 10, 11, 12, 13, 14, 15]

Answer: assert Solution().resultsArray(nums = [2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1], k = 5) == [6, 7, 8, 9, 10, -1, -1, -1, -1, 5, 6, 7, 8, 9, 10, -1]

Answer: assert Solution().resultsArray(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111], k = 6) == [105, 106, 107, 108, 109, 110, 111]

Answer: assert Solution().resultsArray(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [10,20,30,40,50,60,70,80,90,100,110,120,130,140,150], k = 10) == [-1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [10,11,12,13,14,15,16,17,18,19,20], k = 7) == [16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [100,99,98,97,96,95,94,93,92,91,90], k = 5) == [-1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], k = 25) == [25]

Answer: assert Solution().resultsArray(nums = [1,3,2,4,6,5,8,7,9,11,10,12], k = 4) == [-1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,3,2,4,5,6,7,8,9,10], k = 5) == [-1, -1, -1, 8, 9, 10]

Answer: assert Solution().resultsArray(nums = [39,37,35,33,31,29,27,25,23,21,19,17,15,13,11,9,7,5,3,1], k = 9) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], k = 2) == [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35], k = 12) == [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]

Answer: assert Solution().resultsArray(nums = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], k = 10) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120], k = 5) == [104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]

Answer: assert Solution().resultsArray(nums = [1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19], k = 5) == [-1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]

Answer: assert Solution().resultsArray(nums = [1,3,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 5) == [-1, -1, -1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], k = 6) == [-1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1], k = 6) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30], k = 8) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]

Answer: assert Solution().resultsArray(nums = [1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3], k = 6) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], k = 10) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81,80,79,78,77,76,75], k = 6) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [100,101,102,103,104,105,106,107,108,109,110], k = 6) == [105, 106, 107, 108, 109, 110]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 15) == [15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 3) == [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30], k = 15) == [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]

Answer: assert Solution().resultsArray(nums = [9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, 7, 8, 9, 10]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 1) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7], k = 5) == [-1, -1, -1, -1, 5, 6, 7]

Answer: assert Solution().resultsArray(nums = [2, 3, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], k = 10) == [-1, -1, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]

Answer: assert Solution().resultsArray(nums = [3,5,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22], k = 8) == [-1, -1, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]

Answer: assert Solution().resultsArray(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], k = 4) == [-1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10], k = 4) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10], k = 4) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 20) == [20]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], k = 5) == [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [10,12,11,13,15,14,16,18,17,19,20], k = 4) == [-1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5], k = 3) == [3, 4, 5, -1, -1, 3, 4, 5]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], k = 6) == [6, 7, 8, 9, 10, 11, 12, 13, 14, 15]

Answer: assert Solution().resultsArray(nums = [3, 5, 4, 6, 7, 8, 9, 10, 11, 12, 13], k = 7) == [-1, -1, -1, 12, 13]

Answer: assert Solution().resultsArray(nums = [3,2,1,4,5,6,7,8,9,10,11,12,13,14,15], k = 5) == [-1, -1, -1, 8, 9, 10, 11, 12, 13, 14, 15]

Answer: assert Solution().resultsArray(nums = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 8) == [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 4) == [-1, -1, -1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11,13,15,17,19], k = 7) == [-1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29], k = 7) == [-1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 1) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120], k = 10) == [109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 9) == [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], k = 4) == [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], k = 10) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8], k = 7) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30], k = 20) == [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]

Answer: assert Solution().resultsArray(nums = [1,2,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 10) == [-1, -1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23], k = 15) == [18, 19, 20, 21, 22, 23]

Answer: assert Solution().resultsArray(nums = [15, 16, 14, 17, 18, 19, 20, 21, 22, 23, 24], k = 8) == [-1, -1, -1, 24]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11,13,15,17,19], k = 5) == [-1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1], k = 3) == [3, -1, -1, -1, 3, -1, -1, -1, 3, -1, -1, -1, 3, -1, -1, -1, 3, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], k = 20) == [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]

Answer: assert Solution().resultsArray(nums = [5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 7) == [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37], k = 14) == [22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37]

Answer: assert Solution().resultsArray(nums = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], k = 8) == [9, 10, -1, -1, -1, -1, -1, -1, -1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26], k = 15) == [21, 22, 23, 24, 25, 26]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 15) == [15, 16, 17, 18, 19, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], k = 5) == [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]

Answer: assert Solution().resultsArray(nums = [1000000,999999,999998,999997,999996,999995,999994,999993,999992,999991], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6], k = 12) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30], k = 10) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], k = 3) == [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], k = 8) == [9, 10, 11, 12, 13, 14]

Answer: assert Solution().resultsArray(nums = [1,3,2,4,6,5,7,9,8,10,12,11,13,15,14,16,18,17,19,20], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30], k = 20) == [23, 24, 25, 26, 27, 28, 29, 30]

Answer: assert Solution().resultsArray(nums = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27], k = 18) == [20, 21, 22, 23, 24, 25, 26, 27]

Answer: assert Solution().resultsArray(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21], k = 4) == [-1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [10,20,30,40,50,60,70,80,90,100], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], k = 15) == [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], k = 4) == [-1, -1, -1, 7, 8, 9, 10, 11, 12, 13]

Answer: assert Solution().resultsArray(nums = [20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40], k = 15) == [34, 35, 36, 37, 38, 39, 40]

Answer: assert Solution().resultsArray(nums = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], k = 15) == [21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [5,4,3,2,1,5,4,3,2,1,5,4,3,2,1,5,4,3,2,1], k = 4) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k = 5) == [-1, -1, -1, 5, 6, 7, 8, 9, 10]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], k = 25) == [25, 26, 27, 28, 29]

Answer: assert Solution().resultsArray(nums = [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [6,5,4,3,2,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 15) == [-1, -1, -1, -1, -1, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], k = 12) == [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120], k = 15) == [114, 115, 116, 117, 118, 119, 120]

Answer: assert Solution().resultsArray(nums = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], k = 20) == [24]

Answer: assert Solution().resultsArray(nums = [1,3,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 6) == [-1, -1, -1, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1,2,3,5,6,7,9,10,11,13,14,15,17,18,19,21,22,23,25,26,27,29,30,31], k = 3) == [3, -1, -1, 7, -1, -1, 11, -1, -1, 15, -1, -1, 19, -1, -1, 23, -1, -1, 27, -1, -1, 31]

Answer: assert Solution().resultsArray(nums = [2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 5) == [-1, -1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30], k = 1) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 20) == [20]

Answer: assert Solution().resultsArray(nums = [2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 10) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39], k = 7) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 11) == [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], k = 7) == [16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 10) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11,13,15,17,19], k = 4) == [-1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,2,3,4,5,5,6,7,8,8,9,10,10,11,12,13,13,14], k = 4) == [-1, -1, 5, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, 13, -1, -1]

Answer: assert Solution().resultsArray(nums = [20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1], k = 15) == [-1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], k = 6) == [15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [5,4,3,2,1,2,3,4,5,6,7,8,9,10,11,12], k = 6) == [-1, -1, -1, -1, 6, 7, 8, 9, 10, 11, 12]

Answer: assert Solution().resultsArray(nums = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1, 2, 3, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 17, 18, 19, 20], k = 4) == [-1, -1, -1, 8, 9, -1, -1, -1, 14, 15, -1, -1, -1, 20]

Answer: assert Solution().resultsArray(nums = [10,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1], k = 5) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39], k = 3) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

Answer: assert Solution().resultsArray(nums = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25], k = 10) == [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

Answer: assert Solution().resultsArray(nums = [5,4,3,2,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], k = 6) == [-1, -1, -1, -1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Answer: assert Solution().resultsArray(nums = [10,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], k = 12) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 13, 14, 15, 16]

Answer: assert Solution().resultsArray(nums = [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5], k = 10) == [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

import random
import functools
import collections
import string
import math
import datetime

from typing import *
from functools import *
from collections import *
from itertools import *
from heapq import *
from bisect import *
from string import *
from operator import *
from math import *

inf = float('inf')

class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next

def list_node(values: list):
    if not values:
        return None
    head = ListNode(values[0])
    p = head
    for val in values[1:]:
        node = ListNode(val)
        p.next = node
        p = node
    return head

def is_same_list(p1, p2):
    if p1 is None and p2 is None:
        return True
    if not p1 or not p2:
        return False
    return p1.val == p2.val and is_same_list(p1.next, p2.next)

class TreeNode:
    def __init__(self, val=0, left=None, right=None):
        self.val = val
        self.left = left
        self.right = right

def tree_node(values: list):
    if not values:
        return None
    root = TreeNode(values[0])
    i = 1
    queue = deque()
    queue.append(root)
    while queue:
        node = queue.popleft()
        if i < len(values) and values[i] is not None:
            node.left = TreeNode(values[i])
            queue.append(node.left)
        i += 1
        if i < len(values) and values[i] is not None:
            node.right = TreeNode(values[i])
            queue.append(node.right)
        i += 1
    return root

def is_same_tree(p, q):
    if not p and not q:
        return True
    elif not p or not q:
        return False
    elif p.val != q.val:
        return False
    else:
        return is_same_tree(p.left, q.left) and is_same_tree(p.right, q.right)

class Solution:
    def resultsArray(self, nums: List[int], k: int) -> List[int]:
        n = len(nums)
        f = [1] * n
        for i in range(1, n):
            if nums[i] == nums[i - 1] + 1:
                f[i] = f[i - 1] + 1
        return [nums[i] if f[i] >= k else -1 for i in range(k - 1, n)]