1. Abridged Problem Statement  
Given an n×n chessboard and an integer k, count the number of ways to place k rooks so that no two attack each other (no two share a row or column). Output 0 if k>n.

2. Detailed Editorial  

We want to place k non-attacking rooks on an n×n board. A classic combinatorial argument breaks down as follows:

- Step 1. Choose k distinct rows (out of n) to host the rooks. There are C(n,k) ways.  
- Step 2. Choose k distinct columns (out of n) to host the rooks. Again C(n,k).  
- Step 3. Match each chosen row to a distinct chosen column. That is a permutation of k elements, i.e. k! ways.  

Multiplying:  
   Answer = C(n,k) × C(n,k) × k! = [C(n,k)]² × k!.

Observe also that if k>n, it is impossible to place k non-attacking rooks, so the answer is 0.

Implementation details:  
- Precompute factorials up to n (max 10).  
- Compute C(n,k) = n! / (k! (n−k)!), then plug into the formula.  
- Since n≤10, all intermediates fit in 64-bit.

3. Provided C++ Solution with Detailed Comments  

```cpp
#include <bits/stdc++.h>
using namespace std;

// We will compute answer = C(n,k)^2 * k! or 0 if k>n
int n, k;

// Read inputs n and k
void read() {
    cin >> n >> k;
}

void solve() {
    // If more rooks than rows, impossible
    if (n < k) {
        cout << 0 << '\n';
        return;
    }

    // Precompute factorials up to n
    // We'll store f[i] = i!
    vector<long long> f(n + 1, 1);
    for (int i = 1; i <= n; i++) {
        f[i] = f[i - 1] * i;
    }

    // Compute binomial C(n,k) = n! / (k! * (n-k)!)
    long long cnk = f[n] / (f[k] * f[n - k]);

    // Answer = C(n,k)^2 * k!
    long long answer = cnk * cnk * f[k];
    cout << answer << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    read();
    solve();
    return 0;
}
```

4. Python Solution with Detailed Comments  

```python
import sys
import math

def main():
    data = sys.stdin.read().split()
    n, k = map(int, data)
    
    # If k > n, cannot place k non-attacking rooks
    if k > n:
        print(0)
        return

    # Compute factorials (math.factorial is OK for n up to 10)
    # Compute C(n, k)
    cnk = math.comb(n, k)
    
    # The number of ways = C(n,k) * C(n,k) * k!
    result = cnk * cnk * math.factorial(k)
    print(result)

if __name__ == "__main__":
    main()
```

5. Compressed Editorial  

Select k rows and k columns (each in C(n,k) ways), then pair them by a permutation (k!). Total = C(n,k)²·k!; if k>n the result is zero.