Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/funksiya-kombinatsiyalar-soni

Number of combinations

Easy 1000 ms 128 MB 27%
Share

Write a function Combinations(n, k) that returns the number of ways to choose $k$ items out of $n$:

$$C_{n}^{k} = \frac{n!}{k! * (n - k)!}$$

Here $0! = 1$.

Example 1: Combinations(5, 2) → 10

Example 2: Combinations(6, 3) → 20

Write only the function body.

The numbers n and k go into the function Combinations, which returns the number of ways to choose

Input

One line with two non-negative integers $n$ and $k$ — the arguments of the function.

Output

The value returned by the function: an integer.

Note

$0 \le n \le 50$
$0 \le k \le 50$
$k \le n$

Examples

Input #1
5 2
Output #1
10
Input #2
6 3
Output #2
20

Sign in to submit a solution

Signing up is free and takes a minute.