#include <iostream>

using namespace std;

int main() {
    int t;
    cin >> t;

    while (t--) {
        int N, M;
        cin >> N >> M;

        int r = min(N, M - N);

        long long ans = 1;

        for (int i = 0; i < r; i++) {
            ans = ans * (M - i) / (i + 1);
        }

        cout << ans << "\n";
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: