Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.

You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.

A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.

just messing with you :>

```
module Kumite where
main = do
putStrLn "<DESCRIBE::>Kumite\n<PASSED::>Test Passed\n"
print $ if if if if if True then True else False then True else False then True else False then True else False then 1 else 0
```

```
/**
This is a Test
*/
function Solution() {
return "Hello World"
}
//
function Test() {
}
```

```
// TODO: Add your tests here
// Starting from Node 10.x, [Mocha](https://mochajs.org) is used instead of our custom test framework.
// [Codewars' assertion methods](https://github.com/Codewars/codewars.com/wiki/Codewars-JavaScript-Test-Framework)
// are still available for now.
//
// For new tests, using [Chai](https://chaijs.com/) is recommended.
// You can use it by requiring:
// const assert = require("chai").assert;
// If the failure output for deep equality is truncated, `chai.config.truncateThreshold` can be adjusted.
describe("Solution", function() {
it("should test for something", function() {
Test.assertEquals(Solution(), 'Hello World');
// assert.strictEqual(1 + 1, 2);
});
});
```

A Windows 95 cd key has ten digits, in the form of XXX-XXXXXXX.

The **first segment** (also named a site) must be 3 digits long, but cannot be 333, 444, 555, 666, 777, 888, or 999.

The **second segment** must be 7 digits long, divisble by 7, but the last digit can **not** be 0 or ≥ 8.

*(adapted from this article)*

```
function validateKey(key) {
var segments = key.split('-');
var illegalSites = [333, 444, 555, 666, 777, 888, 999];
var illegalEnds = [0, 8, 9];
if (segments.length != 2
|| illegalSites.includes(+(segments[0])) || +(segments[0]) > 999 || +(segments[0]) < 0 || segments[0].length != 3
|| +(segments[1]) % 7 == true || illegalEnds.includes(+(segments[1].slice(-1))) || segments[1].length != 7) {return false}
return true;
}
```

```
// TODO: Add your tests here
// Starting from Node 10.x, [Mocha](https://mochajs.org) is used instead of our custom test framework.
// [Codewars' assertion methods](https://github.com/Codewars/codewars.com/wiki/Codewars-JavaScript-Test-Framework)
// are still available for now.
//
// For new tests, using [Chai](https://chaijs.com/) is recommended.
// You can use it by requiring:
// const assert = require("chai").assert;
// If the failure output for deep equality is truncated, `chai.config.truncateThreshold` can be adjusted.
describe("Solution", function() {
it("validate keys", function() {
Test.assertEquals(validateKey('879-5676524'), true);
Test.assertEquals(validateKey('879-5676529'), false);
Test.assertEquals(validateKey('535-5676524'), true);
Test.assertEquals(validateKey('000-5676524'), true);
Test.assertEquals(validateKey('999-5676524'), false);
Test.assertEquals(validateKey('764-2365839'), false);
Test.assertEquals(validateKey('3-5676524'), false);
Test.assertEquals(validateKey('364-17688'), false);
Test.assertEquals(validateKey('5676524'), false);
Test.assertEquals(validateKey('3-'), false);
});
});
```

```
function Solution() {
}
```

```
// TODO: Add your tests here
// Starting from Node 10.x, [Mocha](https://mochajs.org) is used instead of our custom test framework.
// [Codewars' assertion methods](https://github.com/Codewars/codewars.com/wiki/Codewars-JavaScript-Test-Framework)
// are still available for now.
//
// For new tests, using [Chai](https://chaijs.com/) is recommended.
// You can use it by requiring:
// const assert = require("chai").assert;
// If the failure output for deep equality is truncated, `chai.config.truncateThreshold` can be adjusted.
describe("Solution", function() {
it("should test for something", function() {
Test.assertEquals(1 + 1, 2);
// assert.strictEqual(1 + 1, 2);
});
});
```

In our time, probably everyone played computer games, starting from Tetris and ending with grandiose game projects!

In many games with two-dimensional graphics, you can face the following situation. The hero jumps on platforms that hang in the air. Often the essence of such games is that the hero would move from point A to point B. At the same time, the hero has a level of life and energy. When jumping, the hero spends one life and spends energy, which is calculated by the formula |y2-y1|where y1 and y2 are the heights at which these platforms are located.

Let's assume that you know the coordinates of all the platforms in order from left to right. Can you find the minimum amount of energy the hero needs to get from the last platform to the first?

```
using System;
public static class Kata
{
public static int CalculatingTheAmountEnergy(int[] coordinates)
{
// here's your code
}
}
```

```
using NUnit.Framework;
using System;
[TestFixture]
public class SolutionTest
{
[TestCase(new int[] { 1, 5, 10}, ExpectedResult = 9)]
[TestCase(new int[] { 1, 5, 10, 3, 20}, ExpectedResult = 33)]
[TestCase(new int[] { 0, 0, 1}, ExpectedResult = 1)]
public int Tests(int[] values) => Kata.CalculatingTheAmountEnergy(values);
}
```

You have 100 cards, numbered 1 to 100. You distribute them into k piles and collect back the piles in order. For example, if you distribute them into 4 piles, then the first pile will contain the cards numbered 1, 5, 9, and the 4 th pile will contain the cards numbered 4, 8, 12, . While collecting back the cards you collect first the last pile, flip it bottom to top, then take the third pile, flip it bottom to top and put the cards on top of the 4th pile and so on. Next round, you distribute the cards into another set of piles and collect in the same manner (last pile first and first pile last).

If we have 10 cards, and put them into 2 piles, the order of the cards in the piles (top to bottom) would be 9, 7, 5, 3, 1 and 10, 8, 6, 4, 2

We flip the piles to get the order 1, 3, 5, 7, 9 and 2, 4, 6, 8, 10

We put the second pile at the bottom and first on top of it to get the deck 1, 3, 5, 7, 9, 2, 4, 6, 8, 10

Given the number of rounds (m), the number of piles in each round (ki), you need to write a program to find the Nth card from the top at the end of the final round.

Input:

The input consists of a single line of (m+2) comma-separated integers.

The first number is m, the number of rounds. The next m numbers are ki which represent the number of piles in each round.

The last number in the input is N, the position in the final pile whose value is to be determined.

Output:

One integer representing the Nth card after all rounds have been played.

Constraints: Number of rounds <= 10, number of piles in each round <= 13.

Example 1

Input: 2, 2, 2, 4

Output: 13

Explanation:

m = 2, k1 = 2, k2 = 2 and N = 4.

We have two rounds. The first round has two piles. At the end of the round, the deck is in the following order: 1, 3, 5, , 99, 2, 4, 6, , 100

The next round also has 2 piles and after the second round, the cards are in the order 1, 5, 9, 13, .

The fourth card from the top has number 13.

Example 2

Input: 3, 2, 2, 3, 2

Output: 13

Explanation:

m = 3, k1 = 2, k2 = 2, k3 = 3 and N = 2.

After the second round, the cards are in the order 1, 5, 9, 13,

The third round has 3 piles. Thus after this round the cards will be in the order 1, 13, . the Second card is 13.

```
import itertools
L=[i for i in range(1,101)]
L2=[]
A,*B,C=map(int,input().split())
for i in range(A):
for k in range(B[i]):
L2.extend(L[k:99:B[i]])
L.clear()
L.extend(L2)
L2.clear()
print(L[C-1])
```

```
# TODO: Replace examples and use TDD by writing your own tests
# These are some of the methods available:
# test.expect(boolean, [optional] message)
# test.assert_equals(actual, expected, [optional] message)
# test.assert_not_equals(actual, expected, [optional] message)
# You can use Test.describe and Test.it to write BDD style te
```

Add something to the function's logic so that it still returns 1!

```
def rubegoldberg():
return 1
```

`test.assert_equals(rubegoldberg(), 1)`

Find your way to discover an "a1", the inverse of the key(a1: a^(-1)), without using the brute-force loop like the example code

Then return the secret text

Note: a x a1 = 1 (modulo 26)

Example: 7 x -11 = 1 (modulo 26) >> a1 = -11

In order to find the secret text:

secret_text = ""

for c in ciphertext:

e = (a1 * (char2num(c) - b)) % m

secret_text = secret_text + num2char(e)

def char2num(c):

return ord(c) - 65

def num2char(n):

return chr(n + 65)

```
def a_little_decryption(a, b, m, ciphertext):
secret_text = ""
a1 = None
for i in range(0, m):
if (a*i)%m == 1:
a1 = i
break
for c in ciphertext:
e = (a1 * (char2num(c) - b)) % m
secret_text = secret_text + num2char(e)
return secret_text
```

```
test.assert_equals(a_little_decryption(7, 5, 26, "VZZAQZM"), "GOODJOB")
test.assert_equals(a_little_decryption(17, 2 , 26, "HCPBIPA"), "LANDING")
test.assert_equals(a_little_decryption(359, 499 , 26, "TWNYOHLP"), "SHORTKEY")
```

from hex to 1 dec

'a:2:35:af:1' -> 10 + 2 + 53 + 175 + 1 -> 241

'b:356:3af:cba24:100' -> 11 + 854 + 943 + 834084 + 256 -> 836148

`decr = lambda a: sum([int(h,16) for h in a.split(':')])`

```
test.assert_equals(decr('a:2:35:af:1'),241)
test.assert_equals(decr('b:356:3af:cba24:100'),836148)
test.assert_equals(decr('a:bbbcefff:134fdea:100'),3169971955)
test.assert_equals(decr('effbc4:edfc31:aedfc2506'),46973721851)
test.assert_equals(decr('ef23fae:123a'),250761704)
```

Count the number of occurrences of each character and return it as a list of tuples in order of appearance. For empty output return an empty list.

Example:

'''

OrderedCount("abracadabra") == []Tuple{Tuple{'a', 5}, Tuple{'b', 2}, Tuple{'r', 2}, Tuple{'c', 1}, Tuple{'d', 1}}

// Where

type Tuple struct {

Char rune

Count int

}

'''

```
package orderedcount
// Use the preloaded Tuple struct as return type
// type Tuple struct {
// Char rune
// Count int
// }
func OrderedCount(text string) []Tuple {
// to implement
}
```

```
package orderedcount_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "codewarrior/orderedcount"
)
var _ = Describe("Test Suite", func() {
It("Sample Tests", func() {
Expect(OrderedCount("abracadabra")).Should(Equal([]Tuple{Tuple{'a', 5}, Tuple{'b', 2}, Tuple{'r', 2}, Tuple{'c', 1}, Tuple{'d', 1}}))
Expect(OrderedCount("Code Wars")).Should(Equal([]Tuple{Tuple{'C', 1}, Tuple{'o', 1}, Tuple{'d', 1}, Tuple{'e', 1}, Tuple{' ', 1}, Tuple{'W', 1}, Tuple{'a', 1}, Tuple{'r', 1}, Tuple{'s', 1}}))
Expect(OrderedCount("")).Should(Equal([]Tuple{}))
})
})
```