meetforever/GRPO_CL huggingface dataset:
user: Complete the function that takes a string as an input, and return a list of all the unpaired characters (i.e. they show up an odd number of times in the string), in the order they were encountered as an array. 

In case of multiple appearances to choose from, take the last occurence of the unpaired character.

**Notes:**
* A wide range of characters is used, and some of them may not render properly in your browser.
* Your solution should be linear in terms of string length to pass the last test.


## Examples

```
"Hello World"   -->  ["H", "e", " ", "W", "r", "l", "d"]
"Codewars"      -->  ["C", "o", "d", "e", "w", "a", "r", "s"]
"woowee"        -->  []
"wwoooowweeee"  -->  []
"racecar"       -->  ["e"]
"Mamma"         -->  ["M"]
"Mama"          -->  ["M", "m"]
```

Answer: {"fn_name": "odd_one_out", "inputs": [["Hello World"], ["Codewars"], ["woowee"], ["wwoooowweeee"], ["racecar"], ["Mamma"], ["Mama"], ["\u00bc x 4 = 1"], ["\u00bc x 4 = 1 and \u00bd x 4 = 2"]], "outputs": [[["H", "e", " ", "W", "r", "l", "d"]], [["C", "o", "d", "e", "w", "a", "r", "s"]], [[]], [[]], [["e"]], [["M"]], [["M", "m"]], [["\u00bc", "x", "4", "=", "1"]], [["\u00bc", "1", "a", "n", "d", "\u00bd", "2"]]]}
user: Write a function that returns the index of the first occurence of the word "Wally".  "Wally" must not be part of another word, but it can be directly followed by a punctuation mark.  If no such "Wally" exists, return -1.


Examples:

"Wally" => 0

"Where's Wally" => 8

"Where's Waldo" => -1

"DWally Wallyd .Wally" => -1

"Hi Wally." => 3

"It's Wally's." => 5

"Wally Wally" => 0

"'Wally Wally" => 7

Answer: {"fn_name": "wheres_wally", "inputs": [[""], ["WAlly"], ["wAlly"], ["DWally"], [".Wally"], ["Wallyd"], ["wally mollyWally Wallybrolly 'Wally"], ["Walley ,Wally -Wally ;Wally +Wally :Wally"], ["Walley Wally, Wally- Wally: Wally+ Wally:"], ["12Wally Wally01 W.ally"], ["Where's Waldo"], ["Wally"], ["Wally Wally"], ["W ally Wally"], ["Where's Wally"], ["Hi Wally."], ["It's Wally's."], ["'Wally Wally"], ["Hello Wally my name is Dolly"]], "outputs": [[-1], [-1], [-1], [-1], [-1], [-1], [-1], [-1], [7], [-1], [-1], [0], [0], [7], [8], [3], [5], [7], [6]]}
user: # Task 

**_Given_**   *a number* , **_Return_**  **_The Maximum number _**  *could be formed from the digits of the number given* . 
___
# Notes

* **_Only Natural numbers_** *passed to the function , numbers Contain digits [0:9] inclusive*

* **_Digit Duplications_** *could occur* , So also **_consider it when forming the Largest_**

____
# Input >> Output Examples:

```
maxNumber (213) ==> return (321)
```
## **_Explanation_**:

As `321` is **_The Maximum number _**  *could be formed from the digits of the number   **_213_*** . 
___

```
maxNumber (7389) ==> return (9873)
```
## **_Explanation_**:

As `9873` is **_The Maximum number _**  *could be formed from the digits of the number  **_7389_*** . 
___

```
maxNumber (63729) ==> return (97632)
```
## **_Explanation_**:

As `97632` is **_The Maximum number _**  *could be formed from the digits of the number  **_63729_*** . 
___

```
maxNumber (566797) ==> return (977665)
```
## **_Explanation_**:

As `977665` is **_The Maximum number _**  *could be formed from the digits of the number  **_566797_*** .

**_Note_** : **_Digit duplications are considered when forming the largest_** . 
___

```
maxNumber (17693284) ==> return (98764321)
```
## **_Explanation_**:
 
As `98764321` is **_The Maximum number _**  *could be formed from the digits of the number  **_17693284_*** .
___
___
___

# [Playing with Numbers Series](https://www.codewars.com/collections/playing-with-numbers)

# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)

# [For More Enjoyable Katas](http://www.codewars.com/users/MrZizoScream/authored)
___

## ALL translations are welcomed

## Enjoy Learning !!
# Zizou

Answer: {"fn_name": "max_number", "inputs": [[213], [7389], [63792], [566797], [1000000]], "outputs": [[321], [9873], [97632], [977665], [1000000]]}
user: Rick wants a faster way to get the product of the largest pair in an array. Your task is to create a performant solution to find the product of the largest two integers in a unique array of positive numbers. All inputs will be valid.
Passing [2, 6, 3] should return 18, the product of [6, 3].

```Disclaimer: Mr. Roll will only accept solutions that are faster than his, which has a running time O(nlogn).``` 

```python
max_product([2, 1, 5, 0, 4, 3])              # => 20
max_product([7, 8, 9])                       # => 72
max_product([33, 231, 454, 11, 9, 99, 57])   # => 104874
```

Answer: {"fn_name": "max_product", "inputs": [[[56, 335, 195, 443, 6, 494, 252]], [[154, 428, 455, 346]], [[39, 135, 47, 275, 37, 108, 265, 457, 2, 133, 316, 330, 153, 253, 321, 411]], [[136, 376, 10, 146, 105, 63, 234]], [[354, 463, 165, 62, 472, 53, 347, 293, 252, 378, 420, 398, 255, 89]], [[346, 446, 26, 425, 432, 349, 123, 269, 285, 93, 75, 14]], [[134, 320, 266, 299]], [[114, 424, 53, 272, 128, 215, 25, 329, 272, 313, 100, 24, 252]], [[375, 56, 337, 466, 203]]], "outputs": [[218842], [194740], [187827], [87984], [218536], [192672], [95680], [139496], [174750]]}
user: Vasya wants to climb up a stair of certain amount of steps (Input parameter 1). There are 2 simple rules that he has to stick to.

1. Vasya can climb 1 or 2 steps at each move.
2. Vasya wants the number of moves to be a multiple of a certain integer. (Input parameter 2).

### Task:
What is the `MINIMAL` number of moves making him climb to the top of the stairs that satisfies his conditions?

### Input

1. Number of stairs:    `0 <  N  ≤ 10000` ;
2. Integer to be multiplied : `1 < M ≤ 10 `;

### Output

1. Return a single integer - the minimal number of moves being a multiple of M;
2. If there is no way he can climb satisfying condition return - 1 instead. (`Nothing` in Haskell)

### Examples

```python
numberOfSteps(10, 2) => 6  # Sequence of steps : {2, 2, 2, 2, 1, 1}

numberOfSteps(3, 5) => -1 # !Possible sequences of steps : {2, 1}, {1, 2}, {1, 1, 1}
```
``` haskell
numberOfSteps 10 2 == Just 6  -- Sequence of steps : {2, 2, 2, 2, 1, 1}
numberOfSteps  3 5 == Nothing -- Not possible, since the sequences of steps would be {2, 1}, {1, 2} or {1, 1, 1}
```

Answer: {"fn_name": "numberOfSteps", "inputs": [[10, 2], [3, 5], [29, 7], [2, 2], [1, 2], [10000, 2], [10000, 3], [10000, 10], [9999, 3], [9999, 2], [9999, 10], [9999, 9], [18, 10], [19, 10], [20, 10], [7688, 5], [4608, 5], [3979, 2], [5, 2]], "outputs": [[6], [-1], [21], [2], [-1], [5000], [5001], [5000], [5001], [5000], [5000], [5004], [10], [10], [10], [3845], [2305], [1990], [4]]}
user: **DESCRIPTION:**

  Your strict math teacher is teaching you about right triangles, and the Pythagorean Theorem --> a^2 + b^2 = c^2 whereas a and b are the legs of the right triangle and c is the hypotenuse of the right triangle. On the test however, the question asks: What are the possible integer lengths for the other side of the triangle, but since you never learned anything about that in class, you realize she meant What are the possible integer lengths for the other side of the right triangle. Because you want to address the fact that she asked the wrong question and the fact that you're smart at math, you've decided to answer all the possible values for the third side EXCLUDING the possibilities for a right triangle in increasing order.
  
**EXAMPLES:**

```
side_len(1, 1) --> [1]
side_len(3, 4) --> [2, 3, 4, 6]
side_len(4, 6) --> [3, 4, 5, 6, 7, 8, 9]
```
**RETURN:**

  Return your answer as a list of all the possible third side lengths of the triangle without the right triangles in increasing order.
  
By the way, after finishing this kata, please try some of my other katas: [Here](https://www.codewars.com/collections/tonylicodings-authored-katas)

NOTE:
  
  When given side_len(x, y), y will always be greater than or equal to x. Also, if a right triangle's legs are passed in, exclude the hypotenuse. If a right triangle's leg and hypotenuse are passed in, exclude the other leg.

Answer: {"fn_name": "side_len", "inputs": [[1, 1], [3, 4], [4, 6], [5, 12], [8, 10]], "outputs": [[[1]], [[2, 3, 4, 6]], [[3, 4, 5, 6, 7, 8, 9]], [[8, 9, 10, 11, 12, 14, 15, 16]], [[3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]]]}
user: In this Kata, you will be given an integer `n` and your task will be to return `the largest integer that is <= n and has the highest digit sum`.

For example:
```
solve(100) = 99. Digit Sum for 99 = 9 + 9 = 18. No other number <= 100 has a higher digit sum.
solve(10) = 9
solve(48) = 48. Note that 39 is also an option, but 48 is larger.
```

Input range is `0 < n < 1e11`

More examples in the test cases.

Good luck!

Answer: {"fn_name": "solve", "inputs": [[79320], [99004], [99088], [99737], [29652], [100], [48], [521], [1], [2], [3], [39188], [5], [10], [1000], [10000], [999999999992], [59195], [19930], [110], [1199], [120], [18], [2090], [72694]], "outputs": [[78999], [98999], [98999], [98999], [28999], [99], [48], [499], [1], [2], [3], [38999], [5], [9], [999], [9999], [999999999989], [58999], [19899], [99], [999], [99], [18], [1999], [69999]]}
user: A number is simply made up of digits.  
The number 1256 is made up of the digits 1, 2, 5, and 6.  
For 1256 there are 24 distinct permutations of the digits:  
1256, 1265, 1625, 1652, 1562, 1526, 2156, 2165, 2615, 2651, 2561, 2516,   
5126, 5162, 5216, 5261, 5621, 5612, 6125, 6152, 6251, 6215, 6521, 6512.
  
Your goal is to write a program that takes a number, n, and returns the average value of all distinct permutations of the digits in n.  Your answer should be rounded to the nearest integer. For the example above the return value would be 3889. * 
  
  n will never be negative
  
A few examples:
```python
permutation_average(2)
return 2

permutation_average(25)
>>> 25 + 52 = 77
>>> 77 / 2 = 38.5
return 39 *

permutation_average(20)
>>> 20 + 02 = 22
>>> 22 / 2 = 11
return 11

permutation_average(737)
>>> 737 + 377 + 773 = 1887
>>> 1887 / 3 = 629
return 629

```

Note: Your program should be able to handle numbers up to 6 digits long
~~~if:python
\* Python version 3 and above uses Banker Rounding so the expected values for those tests would be 3888 and 38 respectively
~~~
~~~if-not:python
\* ignore these marks, they're for Python only
~~~

Answer: {"fn_name": "permutation_average", "inputs": [[2], [25], [737]], "outputs": [[2], [38], [629]]}
user: Given the number pledged for a year, current value and name of the month, return string that gives information about the challenge status:

- ahead of schedule
- behind schedule
- on track
- challenge is completed

Examples:

`(12, 1, "February")` - should return `"You are on track."`

`(12, 1, "March")` - should return `"You are 1 behind schedule."`

`(12, 5, "March")` - should return `"You are 3 ahead of schedule."`

`(12, 12, "September")` - should return `"Challenge is completed."`

Details:
- you do not need to do any prechecks (input will always be a natural number and correct name of the month)
- months should be as even as possible (i.e. for 100 items: January, February, March and April - 9, other months 8)
- count only the item for completed months (i.e. for March check the values from January and February) and it means that for January you should always return `"You are on track."`.

Answer: {"fn_name": "check_challenge", "inputs": [[12, 5, "January"], [12, 1, "February"], [12, 1, "March"], [12, 12, "September"], [12, 5, "March"], [100, 5, "March"], [100, 52, "July"], [100, 51, "July"], [100, 53, "July"]], "outputs": [["You are on track."], ["You are on track."], ["You are 1 behind schedule."], ["Challenge is completed."], ["You are 3 ahead of schedule!"], ["You are 13 behind schedule."], ["You are on track."], ["You are 1 behind schedule."], ["You are 1 ahead of schedule!"]]}
user: *SCHEDULE YOUR DA(RRA)Y*
        
The best way to have a productive day is to plan out your work schedule. Given the following three inputs, please create an an array of time alloted to work, broken up with time alloted with breaks:
        
Input 1: Hours - Number of hours available to you to get your work done! 
Input 2: Tasks - How many tasks you have to do througout the day
Input 3: Duration (minutes)- How long each of your tasks will take to complete
Criteria to bear in mind:
- Your schedule should start with work and end with work.
- It should also be in minutes, rounded to the nearest whole minute. 
- If your work is going to take more time than you have, return "You're not sleeping tonight!"
Example:

```python
day_plan(8, 5, 30) == [ 30, 82, 30, 82, 30, 82, 30, 82, 30 ]
day_plan(3, 5, 60) == "You're not sleeping tonight!"
```

Answer: {"fn_name": "day_plan", "inputs": [[8, 5, 30], [3, 5, 60], [2, 2, 60], [2, 1, 60], [2, 0, 60]], "outputs": [[[30, 82, 30, 82, 30, 82, 30, 82, 30]], ["You're not sleeping tonight!"], [[60, 0, 60]], [[60]], [[]]]}
user: Steve and Josh are bored and want to play something. They don't want to think too much, so they come up with a really simple game. Write a function called winner and figure out who is going to win.

They are dealt the same number of cards. They both flip the card on the top of their deck. Whoever has a card with higher value wins the round and gets one point (if the cards are of the same value, neither of them gets a point). After this, the two cards are discarded and they flip another card from the top of their deck. They do this until they have no cards left.

`deckSteve` and `deckJosh` are arrays representing their decks. They are filled with *cards*, represented by a single character. The card rank is as follows (from lowest to highest):
```
'2','3','4','5','6','7','8','9','T','J','Q','K','A'
```

Every card may appear in the deck more than once. Figure out who is going to win and return who wins and with what score:
* `"Steve wins x to y"` if Steve wins; where `x` is Steve's score, `y` is Josh's score;
* `"Josh wins x to y"` if Josh wins; where `x` is Josh's score, `y` is Steve's score;
* `"Tie"` if the score is tied at the end of the game.


## Example

* Steve is dealt: `['A','7','8']`
* Josh is dealt: `['K','5','9']`

1. In the first round, ace beats king and Steve gets one point.
2. In the second round, 7 beats 5 and Steve gets his second point.
3. In the third round, 9 beats 8 and Josh gets one point.

So you should return: `"Steve wins 2 to 1"`

Answer: {"fn_name": "winner", "inputs": [[["A", "7", "8"], ["K", "5", "9"]], [["T"], ["T"]], [["T", "9"], ["T", "8"]], [[], []]], "outputs": [["Steve wins 2 to 1"], ["Tie"], ["Steve wins 1 to 0"], ["Tie"]]}
user: ## Your task

You are given a dictionary/hash/object containing some languages and your test results in the given languages. Return the list of languages where your test score is at least `60`, in descending order of the results.

Note: the scores will always be unique (so no duplicate values)

## Examples

```python
{"Java": 10, "Ruby": 80, "Python": 65}    -->  ["Ruby", "Python"]
{"Hindi": 60, "Dutch" : 93, "Greek": 71}  -->  ["Dutch", "Greek", "Hindi"]
{"C++": 50, "ASM": 10, "Haskell": 20}     -->  []
```
---

## My other katas

If you enjoyed this kata then please try [my other katas](https://www.codewars.com/collections/katas-created-by-anter69)! :-)

### _Translations are welcome!_

Answer: {"fn_name": "my_languages", "inputs": [[{"Java": 10, "Ruby": 80, "Python": 65}], [{"Hindi": 60, "Greek": 71, "Dutch": 93}], [{"C++": 50, "ASM": 10, "Haskell": 20}]], "outputs": [[["Ruby", "Python"]], [["Dutch", "Greek", "Hindi"]], [[]]]}
user: Truncate the given string (first argument) if it is longer than the given maximum length (second argument). Return the truncated string with a `"..."` ending.

Note that inserting the three dots to the end will add to the string length.

However, if the given maximum string length num is less than or equal to 3, then the addition of the three dots does not add to the string length in determining the truncated string.


## Examples
```
('codewars', 9)  ==>  'codewars'
('codewars', 7)  ==>  'code...'
('codewars', 2)  ==>  'co...'
```

[Taken from FCC](https://www.freecodecamp.com/challenges/truncate-a-string)

Answer: {"fn_name": "truncate_string", "inputs": [["pippi", 3], ["Peter Piper picked a peck of pickled peppers", 14], ["A-tisket a-tasket A green and yellow basket", 43], ["A-tisket a-tasket A green and yellow basket", 45], ["A-", 1], ["Chingel loves his Angel so much!!!", 27], ["I like ice-cream.Do you?", 19], ["Seems like you have passed the final test. Congratulations", 53]], "outputs": [["pip..."], ["Peter Piper..."], ["A-tisket a-tasket A green and yellow basket"], ["A-tisket a-tasket A green and yellow basket"], ["A..."], ["Chingel loves his Angel ..."], ["I like ice-cream..."], ["Seems like you have passed the final test. Congrat..."]]}
user: Write a function `consonantCount`, `consonant_count` or `ConsonantCount` that takes a string of English-language text and returns the number of consonants in the string.

Consonants are all letters used to write English excluding the vowels `a, e, i, o, u`.

Answer: {"fn_name": "consonant_count", "inputs": [[""], ["aaaaa"], ["helLo world"], ["h^$&^#$&^elLo world"], ["0123456789"], ["012345_Cb"]], "outputs": [[0], [0], [7], [7], [0], [2]]}
user: Convert integers to binary as simple as that. You would be given an integer as a argument and you have to return its binary form.
To get an idea about how to convert a decimal number into a binary number, visit here.

**Notes**: negative numbers should be handled as two's complement; assume all numbers are integers stored using 4 bytes (or 32 bits) in any language.

Your output should ignore leading 0s.

So, for example:
```python
to_binary(3)=="11"
to_binary(-3)=="11111111111111111111111111111101"
```

*Be Ready for Large Numbers. Happy Coding ^_^*

Answer: {"fn_name": "to_binary", "inputs": [[2], [3], [4], [5], [7], [10], [-3], [0], [1000], [-15], [-1000], [-999999], [999999]], "outputs": [["10"], ["11"], ["100"], ["101"], ["111"], ["1010"], ["11111111111111111111111111111101"], ["0"], ["1111101000"], ["11111111111111111111111111110001"], ["11111111111111111111110000011000"], ["11111111111100001011110111000001"], ["11110100001000111111"]]}
user: Basic regex tasks. Write a function that takes in a numeric code of any length. The function should check if the code begins with 1, 2, or 3 and return `true` if so. Return `false` otherwise. 

You can assume the input will always be a number.

Answer: {"fn_name": "validate_code", "inputs": [[123], [248], [8], [321], [9453]], "outputs": [[true], [true], [false], [true], [false]]}
user: The image shows how we can obtain the Harmonic Conjugated Point of three aligned points A, B, C.

- We choose any point L, that is not in the line with A, B and C. We form the triangle ABL

- Then we draw a line from point C that intersects the sides of this triangle at points M and N respectively.

- We draw the diagonals of the quadrilateral ABNM; they are AN and BM and they intersect at point K

- We unit, with a line L and K, and this line intersects the line of points A, B and C at point D

The point D is named the Conjugated Harmonic Point of the points A, B, C.
You can get more knowledge related with this point at: (https://en.wikipedia.org/wiki/Projective_harmonic_conjugate)

If we apply the theorems of Ceva (https://en.wikipedia.org/wiki/Ceva%27s_theorem)
and Menelaus (https://en.wikipedia.org/wiki/Menelaus%27_theorem) we will have this formula:



AC, in the above formula is the length of the segment of points A to C in this direction and its value is:

```AC = xA - xC```

Transform the above formula using the coordinates ```xA, xB, xC and xD```

The task is to create a function ```harmon_pointTrip()```, that receives three arguments, the coordinates of points xA, xB and xC, with values such that : ```xA < xB < xC```, this function should output the coordinates of point D for each given triplet, such that

`xA < xD < xB < xC`, or to be clearer

let's see some cases:
```python
harmon_pointTrip(xA, xB, xC) ------> xD # the result should be expressed up to four decimals (rounded result)
harmon_pointTrip(2, 10, 20) -----> 7.1429 # (2 < 7.1429 < 10 < 20, satisfies the constraint)
harmon_pointTrip(3, 9, 18) -----> 6.75
```


Enjoy it and happy coding!!

Answer: {"fn_name": "harmon_pointTrip", "inputs": [[2, 10, 20], [3, 9, 18], [6, 10, 11], [4, 12, 24], [5, 17, 20]], "outputs": [[7.1429], [6.75], [9.3333], [9.0], [15.0]]}
user: We have the number ```12385```. We want to know the value of the closest cube but higher than 12385. The answer will be ```13824```.

Now, another case. We have the number ```1245678```. We want to know the 5th power, closest and higher than that number. The value will be ```1419857```.

We need a function ```find_next_power``` ( ```findNextPower``` in JavaScript, CoffeeScript and Haskell), that receives two arguments, a value ```val```, and the exponent of the power,``` pow_```, and outputs the value that we want to find.

Let'see some cases:
```python
find_next_power(12385, 3) == 13824

find_next_power(1245678, 5) == 1419857
```
The value, ```val``` will be always a positive integer.

The power, ```pow_```, always higher than ```1```.

Happy coding!!

Answer: {"fn_name": "find_next_power", "inputs": [[12385, 3], [1245678, 5], [1245678, 6]], "outputs": [[13824], [1419857], [1771561]]}
user: The goal of this Kata is to remind/show you, how Z-algorithm works and test your implementation.

For a string str[0..n-1], Z array is of same length as string. An element Z[i] of Z array stores length of the longest substring starting from str[i] which is also a prefix of str[0..n-1]. The first entry of Z array is meaning less as complete string is always prefix of itself.

Example:

Index:            0   1   2   3   4   5   6   7   8   9  10  11


Text:             "a   a   b   c   a   a   b   x   a   a   a   z"


Z values:         [11,   1,   0,   0,   3,   1,   0,   0,   2,   2,   1,   0]



Your task will be to implement Z algorithm in your code and return Z-array.

For empty string algorithm should return [].

Input: string str 

Output: Z array

For example:

print zfunc('ababcaba')

[8, 0, 2, 0, 0, 3, 0, 1]

Note, that an important part of this kata is that you have to use
efficient way to get Z-array (O(n))


Answer: {"fn_name": "zfunc", "inputs": [["ababcaba"], [""], ["aaaaaaaa"], ["ababababab"], ["aaaa$aaaa"], ["abracadabra"]], "outputs": [[[8, 0, 2, 0, 0, 3, 0, 1]], [[]], [[8, 7, 6, 5, 4, 3, 2, 1]], [[10, 0, 8, 0, 6, 0, 4, 0, 2, 0]], [[9, 3, 2, 1, 0, 4, 3, 2, 1]], [[11, 0, 0, 1, 0, 1, 0, 4, 0, 0, 1]]]}
user: Create a function that takes an input String and returns a String, where all the uppercase words of the input String are in front and all the lowercase words at the end.
The order of the uppercase and lowercase words should be the order in which they occur.

If a word starts with a number or special character, skip the word and leave it out of the result. 

Input String will not be empty.

For an input String: "hey You, Sort me Already!" 
the function should return: "You, Sort Already! hey me"

Answer: {"fn_name": "capitals_first", "inputs": [["hey You, Sort me Already"], ["sense Does to That Make you?"], ["i First need Thing In coffee The Morning"], ["123 baby You and Me"], ["Life gets Sometimes pretty !Hard"]], "outputs": [["You, Sort Already hey me"], ["Does That Make sense to you?"], ["First Thing In The Morning i need coffee"], ["You Me baby and"], ["Life Sometimes gets pretty"]]}