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. C++ Solution

```cpp
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

int n, k;

void read() { cin >> n >> k; }

void solve() {
    // Placing k non-attacking rooks means choosing k of the n rows, k of the n
    // columns, and a bijection between them: C(n, k) * C(n, k) * k! ways. We
    // compute this as (n!)^2 / (k! * ((n-k)!)^2), accumulating n! squared in
    // the numerator and dividing out the k! and (n-k)!^2 factors. If k > n no
    // placement is possible, so the answer is 0.

    if(n < k) {
        cout << 0 << '\n';
        return;
    }

    int64_t answer = 1;
    for(int i = 1; i <= n; i++) {
        answer *= i * i;
    }

    for(int i = 1; i <= k; i++) {
        answer /= i;
    }

    for(int i = 1; i <= n - k; i++) {
        answer /= i * i;
    }

    cout << answer << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        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.