For this Question: A group of contest writers have written n problems and want to use k of them in an upcoming
contest. Each problem has a difficulty level. A contest is valid if all of its k problems have different
difficulty levels.
Compute how many distinct valid contests the contest writers can produce. Two contests are
distinct if and only if there exists some problem present in one contest but not present in the other.
Print the result modulo 998244353.The first line of input contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 1000).
The next line contains n space-separated integers representing the difficulty levels. The difficulty
levels are between 1 and 10^9
(inclusive).Print the number of distinct contests possible, modulo 998244353Sample input
5 2
1 2 3 4 5

Sample output
10

Sample input 
5 2
1 1 1 2 2

Sample output
6, I have written this Solution Code: #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
 
using namespace std;
 
typedef long long ll;
const int mod = 998244353;
int a[1010];
ll val[1010];
ll dp[1010][1010];
 
int main()
{
	int n, k;
	cin >> n >> k;
	for(int i = 1; i <= n; ++ i)
	{
		scanf("%d", &a[i]);
	}
	sort(a + 1, a + 1 + n);
	int cnt = 1;
	int top = 1;
	for(int i = 2; i <= n; ++ i)
	{
		if(a[i] == a[i - 1])
			cnt++;
		else 
		{
			val[top++] = cnt;
			cnt = 1;
		}
	}
	val[top++] = cnt;
	memset(dp, 0, sizeof(dp));
	for(int i = 0; i <= 1000; ++ i)
		dp[i][0] = 1;
	for(int i = 1; i < top; ++ i)
	{
		for(int j = 1; j <= k; ++ j)
		{
			dp[i][j] = (dp[i - 1][j - 1] * val[i] % mod + dp[i - 1][j]) % mod;
		}
	}
	cout << dp[top - 1][k] << endl;
	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?