stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <cstdlib>

#include <iostream>

#include <algorithm>

#include <cstdlib>

#include <cstring>

#include <string>

#include <vector>

#include <cstdio>

#include <queue>

#include <stack>

#include <cmath>

#include <time.h>

using namespace std;



#define LL long long 

#define clr(x) memset(x,0,sizeof(x))

#define eps 1e-6

#define PI 3.1415926535897932384626433832795028          

#define MAXN 105



struct color

{

	double a,b,c;



}e[105];



double d[105][105];



int check[1005];



int main()

{

	int n,m;

	while(scanf("%d%d",&n,&m)!=EOF)

	{

		for(int i=0;i<n;i++)

			scanf("%lf%lf%lf",&e[i].a,&e[i].b,&e[i].c);



		for(int i=0;i<n;i++)

		{

			for(int j=i+1;j<n;j++)

			{

			    d[i][j]=(e[i].a-e[j].a)*(e[i].a-e[j].a)+(e[i].b-e[j].b)*(e[i].b-e[j].b)+(e[i].c-e[j].c)*(e[i].c-e[j].c);

				//printf("%lf\n",d[i][j]);

			}

		}

		double s=0,min=0;

		

		clr(check);



		for(int i=n-m;i<n;i++)

		{

			check[i]=1;

		}

		//s=0;

			//for(int i=0;i<n;i++)

			//	printf("%d",check[i]);

			//printf("\n");

			for(int i=0;i<n;i++)

			{   

				if(check[i])

				{

					for(int j=i+1;j<n;j++)

					{

						if(check[j])

							s+=d[i][j];

					}

				}

			}

			//printf("%d\n",s);

			if(s>min)

				min=s;

		while(next_permutation(check,check+n))

		{

			s=0;

			//for(int i=0;i<n;i++)

				//printf("%d",check[i]);

			//printf("\n");

			for(int i=0;i<n;i++)

			{   

				if(check[i])

				{

					for(int j=i+1;j<n;j++)

					{

						if(check[j])

							s+=d[i][j];

					}

				}

			}

			//printf("%d\n",s);

			if(s>min)

				min=s;

		}		

		printf("%lf\n",min);

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.815264960073712x):
#include<cmath>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<algorithm>

using namespace std;

const double eps = 1e-10;

const int N=25;



struct point {

    double x,y,z;

}pt[N];

int n,m;

double dis[N][N];



double dist(point p1,point p2) {

    return (p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)+(p1.z-p2.z)*(p1.z-p2.z);

}



double ret;

int ans[N];

void dfs(int idx,int k,double sum) {

    if(k+(n-idx)+2<m) return;

    if(k==m) {

        ret=max(ret,sum);

        return;

    }



    dfs(idx+1,k,sum);

    double tmp=0;

    for(int i=0;i<k;i++) tmp+=dis[ans[i]][idx];

    ans[k]=idx;

    dfs(idx+1,k+1,sum+tmp);

}



int main()

{

    int i,j,t,cas=0;

    while(scanf("%d%d",&n,&m)!=EOF) {

        for(i=1;i<=n;i++) {

            scanf("%lf%lf%lf",&pt[i].x,&pt[i].y,&pt[i].z);

        }

        for(i=1;i<=n;i++) {

            for(j=1;j<=n;j++) {

                dis[i][j]=dist(pt[i],pt[j]);

            }

        }



        ret=0.0;

        dfs(1,0,0);



        printf("%.10f\n",ret);

    }

    return 0;

}



/*

20 10

0 0 0

1 1 1

2 2 2

3 3 3

4 4 4

5 5 5

6 6 6

7 7 7

8 8 8

9 9 9

10 10 10

11 11 11

12 12 12

13 13 13

14 14 14

15 15 15

16 16 16

17 17 17

18 18 18

19 19 19

*/
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<cmath>

#include<algorithm>

using namespace std;

#define dis2(x) (x)*(x)

double map[21][21],maxn;

int m,n;

bool num[21];

struct node{

	double l,a,b;

}p[21];

double dis(node x,node y){

	return dis2(x.a-y.a)+dis2(x.b-y.b)+dis2(x.l-y.l);

}

void check(){

	int ln=0,cnt[21];

	double ans=0;

	for(int i=1;i<=n;i++)

		if(num[i])

			cnt[++ln]=i;

	if(ln>m)

		return;

	for(int i=1;i<=ln;i++)

		for(int j=i+1;j<=ln;j++)

			ans+=map[cnt[i]][cnt[j]];

	if(ans>maxn)

		maxn=ans;

}

void solve(int t){

	if(t>n){

		check();

		return;

	}

	num[t]=true;

	solve(t+1);

	num[t]=false;

	solve(t+1);



}

int main(){

	while(scanf("%d%d",&n,&m)!=EOF){

		for(int i=1;i<=n;i++)

			scanf("%lf%lf%lf",&p[i].l,&p[i].a,&p[i].b);

		memset(num,false,sizeof(num));

		for(int i=1;i<=n;i++){

			map[i][i]=0;

			for(int j=i+1;j<=n;j++)

				map[i][j]=map[j][i]=dis(p[i],p[j]);

		}

		maxn=-1;

		solve(1);

		printf("%lf\n",maxn);

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.798710898133713x):
#include<cmath>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<algorithm>

using namespace std;

const double eps = 1e-10;

const int N=25;



struct point {

    double x,y,z;

}pt[N];

int n,m;

double dis[N][N];



double dist(point p1,point p2) {

    return (p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)+(p1.z-p2.z)*(p1.z-p2.z);

}



double ret;

int ans[N];

void dfs(int idx,int k,double sum) {

    if(k+(n-idx)+2<m) return;

    if(k==m) {

        ret=max(ret,sum);

        return;

    }



    dfs(idx+1,k,sum);

    double tmp=0;

    for(int i=0;i<k;i++) tmp+=dis[ans[i]][idx];

    ans[k]=idx;

    dfs(idx+1,k+1,sum+tmp);

}



int main()

{

    int i,j,t,cas=0;

    while(scanf("%d%d",&n,&m)!=EOF) {

        for(i=1;i<=n;i++) {

            scanf("%lf%lf%lf",&pt[i].x,&pt[i].y,&pt[i].z);

        }

        for(i=1;i<=n;i++) {

            for(j=1;j<=n;j++) {

                dis[i][j]=dist(pt[i],pt[j]);

            }

        }



        ret=0.0;

        dfs(1,0,0);



        printf("%.10f\n",ret);

    }

    return 0;

}



/*

20 10

0 0 0

1 1 1

2 2 2

3 3 3

4 4 4

5 5 5

6 6 6

7 7 7

8 8 8

9 9 9

10 10 10

11 11 11

12 12 12

13 13 13

14 14 14

15 15 15

16 16 16

17 17 17

18 18 18

19 19 19

*/
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <cstdlib>

#include <iostream>

#include <algorithm>

#include <cstdlib>

#include <cstring>

#include <string>

#include <vector>

#include <cstdio>

#include <queue>

#include <stack>

#include <cmath>

#include <time.h>

using namespace std;



#define LL long long 

#define clr(x) memset(x,0,sizeof(x))

#define eps 1e-6

#define PI 3.1415926535897932384626433832795028          

#define MAXN 105



struct node 

{

	double x,y,z;

}e[105],q[105];



double dis(node a, node b)

{

	return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z);

}

int main()

{

	int m,n,i,j,k,pp=1,t;

	scanf("%d%d",&n,&m);

	for(i=0;i<n;i++)

		scanf("%lf%lf%lf",&e[i].x,&e[i].y,&e[i].z);

	int a[105]={0};

	for(i=n-m;i<n;i++)

		a[i]=1;

	double mm=0;

	do

	{

		int count=0;

		for(i=0;i<n;i++)

			if(a[i]==1)

				q[count++]=e[i];

		double d=0;

		for(i=0;i<count;i++)

			for(j=i+1;j<count;j++)

				d+=dis(q[i],q[j]);

		mm=d>mm?d:mm;

	}while(next_permutation(a,a+n));

	printf("%lf\n",mm);

}

// Faster C++ solution for the same problem (measured speedup: 4.789676396566797x):
#include<cmath>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<algorithm>

using namespace std;

const double eps = 1e-10;

const int N=25;



struct point {

    double x,y,z;

}pt[N];

int n,m;

double dis[N][N];



double dist(point p1,point p2) {

    return (p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)+(p1.z-p2.z)*(p1.z-p2.z);

}



double ret;

int ans[N];

void dfs(int idx,int k,double sum) {

    if(k+(n-idx)+2<m) return;

    if(k==m) {

        ret=max(ret,sum);

        return;

    }



    dfs(idx+1,k,sum);

    double tmp=0;

    for(int i=0;i<k;i++) tmp+=dis[ans[i]][idx];

    ans[k]=idx;

    dfs(idx+1,k+1,sum+tmp);

}



int main()

{

    int i,j,t,cas=0;

    while(scanf("%d%d",&n,&m)!=EOF) {

        for(i=1;i<=n;i++) {

            scanf("%lf%lf%lf",&pt[i].x,&pt[i].y,&pt[i].z);

        }

        for(i=1;i<=n;i++) {

            for(j=1;j<=n;j++) {

                dis[i][j]=dist(pt[i],pt[j]);

            }

        }



        ret=0.0;

        dfs(1,0,0);



        printf("%.10f\n",ret);

    }

    return 0;

}



/*

20 10

0 0 0

1 1 1

2 2 2

3 3 3

4 4 4

5 5 5

6 6 6

7 7 7

8 8 8

9 9 9

10 10 10

11 11 11

12 12 12

13 13 13

14 14 14

15 15 15

16 16 16

17 17 17

18 18 18

19 19 19

*/
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <algorithm>

#include <cstring>



using namespace std;



const int MAXN = 23;

int n, m;

double dis[MAXN][MAXN];

double ans, x[MAXN], y[MAXN], z[MAXN];

bool use[MAXN];

int arr[MAXN];



void dfs(int dp)

{

	if(dp == m + 1)

	{

		double sum=0;

		for(int i=1;i<dp;i++)

			for(int j=i+1;j<dp;j++)

				sum += dis[arr[i]][arr[j]];

		ans = max(ans, sum);

		return;

	}

	for(int i=arr[dp-1]+1;i<=n;i++)	if(!use[i])

	{

		use[i] = 1;

		arr[dp] = i;

		dfs(dp + 1);

		use[i] = 0;

	}

}



double caldis(int i, int j)

{

	double dx = x[i] - x[j],

		   dy = y[i] - y[j],

		   dz = z[i] - z[j];

	return dx * dx + dy * dy + dz * dz;

}



int main()

{

	while(~scanf("%d %d", &n, &m))

	{

		for(int i=1;i<=n;i++)

		{

			scanf("%lf %lf %lf", &x[i], &y[i], &z[i]);

		}

		for(int i=1;i<=n;i++)

			for(int j=1;j<=n;j++)

				dis[i][j] = caldis(i, j);

		ans = 0;

		memset(arr, 0, sizeof(arr));

		memset(use, 0, sizeof(use));

		dfs(1);

		printf("%.6lf\n", ans);

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.798050890218222x):
#include<cmath>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<algorithm>

using namespace std;

const double eps = 1e-10;

const int N=25;



struct point {

    double x,y,z;

}pt[N];

int n,m;

double dis[N][N];



double dist(point p1,point p2) {

    return (p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)+(p1.z-p2.z)*(p1.z-p2.z);

}



double ret;

int ans[N];

void dfs(int idx,int k,double sum) {

    if(k+(n-idx)+2<m) return;

    if(k==m) {

        ret=max(ret,sum);

        return;

    }



    dfs(idx+1,k,sum);

    double tmp=0;

    for(int i=0;i<k;i++) tmp+=dis[ans[i]][idx];

    ans[k]=idx;

    dfs(idx+1,k+1,sum+tmp);

}



int main()

{

    int i,j,t,cas=0;

    while(scanf("%d%d",&n,&m)!=EOF) {

        for(i=1;i<=n;i++) {

            scanf("%lf%lf%lf",&pt[i].x,&pt[i].y,&pt[i].z);

        }

        for(i=1;i<=n;i++) {

            for(j=1;j<=n;j++) {

                dis[i][j]=dist(pt[i],pt[j]);

            }

        }



        ret=0.0;

        dfs(1,0,0);



        printf("%.10f\n",ret);

    }

    return 0;

}



/*

20 10

0 0 0

1 1 1

2 2 2

3 3 3

4 4 4

5 5 5

6 6 6

7 7 7

8 8 8

9 9 9

10 10 10

11 11 11

12 12 12

13 13 13

14 14 14

15 15 15

16 16 16

17 17 17

18 18 18

19 19 19

*/
// Slower C++ solution:
#include<stdio.h>

#include<stdlib.h>

#include<iostream>

#include<stdlib.h>

#define rep(i,s,t) for (i=s;i<=t;i++)

using namespace std;

double a[30][3];

bool vis[30];

int i,j,m,n,k,l,o,p;

double ans,temp;

inline double sqr(double x)

{

	return x*x;

}

inline double dist(int x,int y)

{

	return (sqr(a[x][0]-a[y][0])+sqr(a[x][1]-a[y][1])+sqr(a[x][2]-a[y][2]));

}

void dfs(int k,int s)

{

	if (s == m)

	{

		if (ans < temp) ans = temp;

		return;

	}

	if (k > n) return;

	double st;

	int i;

	rep(i,k,n)

	{

		vis[i] = true;

		st = temp;

		rep(j,1,i-1) if (vis[j]) temp+=dist(i,j);

		dfs(i+1,s+1);

		temp = st;

		vis[i] = false;

	}

	dfs(i+1,s);

}

int main()

{

	while (scanf("%d%d",&n,&m) != EOF)

	{

	

	rep(i,1,n) scanf("%lf%lf%lf",&a[i][0],&a[i][1],&a[i][2]);

	ans = 0;

	temp = 0;

	dfs(1,0);

	printf("%.20f\n",ans);

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.798658054084923x):
#include<cmath>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<algorithm>

using namespace std;

const double eps = 1e-10;

const int N=25;



struct point {

    double x,y,z;

}pt[N];

int n,m;

double dis[N][N];



double dist(point p1,point p2) {

    return (p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)+(p1.z-p2.z)*(p1.z-p2.z);

}



double ret;

int ans[N];

void dfs(int idx,int k,double sum) {

    if(k+(n-idx)+2<m) return;

    if(k==m) {

        ret=max(ret,sum);

        return;

    }



    dfs(idx+1,k,sum);

    double tmp=0;

    for(int i=0;i<k;i++) tmp+=dis[ans[i]][idx];

    ans[k]=idx;

    dfs(idx+1,k+1,sum+tmp);

}



int main()

{

    int i,j,t,cas=0;

    while(scanf("%d%d",&n,&m)!=EOF) {

        for(i=1;i<=n;i++) {

            scanf("%lf%lf%lf",&pt[i].x,&pt[i].y,&pt[i].z);

        }

        for(i=1;i<=n;i++) {

            for(j=1;j<=n;j++) {

                dis[i][j]=dist(pt[i],pt[j]);

            }

        }



        ret=0.0;

        dfs(1,0,0);



        printf("%.10f\n",ret);

    }

    return 0;

}



/*

20 10

0 0 0

1 1 1

2 2 2

3 3 3

4 4 4

5 5 5

6 6 6

7 7 7

8 8 8

9 9 9

10 10 10

11 11 11

12 12 12

13 13 13

14 14 14

15 15 15

16 16 16

17 17 17

18 18 18

19 19 19

*/
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <iostream>

using namespace std;



const int maxn = 2005;

const int P = 924844033;

int n, k, fact[maxn], dp[2][maxn][2][2];



void update(int &a, int b) {

	a += b;

	(a >= P) && (a -= P);

	(a < 0) && (a += P);

}



int main() {

	scanf("%d %d", &n, &k);

	fact[0] = 1;

	for (int i = 1; i <= 2000; i++) {

		fact[i] = 1ll * fact[i - 1] * i % P;

	}

 	int cur = 0, nxt = 1;

 	dp[0][0][1][0] = 1;

	for (int x = 1; x <= k; x++) {

		for (int j = x; j <= n; j += k) {

			memset(dp[nxt], 0, sizeof(dp[nxt]));

			for (int i = 0; i <= n; i++) {

				for (int v0 = 0; v0 < 2; v0++) {

					for (int v1 = 0; v1 < 2; v1++) {

						if (dp[cur][i][v0][v1]) {

							if (j + k > n) {

								update(dp[nxt][i][1][0], dp[cur][i][v0][v1]);

								if (v0 == 0) {

									update(dp[nxt][i + 1][1][0], dp[cur][i][v0][v1]);

								}

							} else {

								update(dp[nxt][i][v1][0], dp[cur][i][v0][v1]);

								if (v0 == 0) {

									update(dp[nxt][i + 1][v1][0], dp[cur][i][v0][v1]);

								}

								update(dp[nxt][i + 1][v1][1], dp[cur][i][v0][v1]);

							}

						}

					}

				}

			}

			swap(cur, nxt);

		}

	}

	int ans = 0;

	for (int i = 0; i <= n; i++) {

		int temp = 0;

		for (int v0 = 0; v0 < 2; v0++) {

			for (int v1 = 0; v1 < 2; v1++) {

				update(temp, dp[cur][i][v0][v1]);

			}

		}

		temp = 1ll * temp * fact[n - i] % P;

		if (i & 1) {

			update(ans, -temp);

		} else {

			update(ans, temp);

		}

	}

	printf("%d\n", ans);

	return 0;//

}

// Faster C++ solution for the same problem (measured speedup: 1.1650557041284189x):
#include<iostream>

#include<cstring>

#include<cstdio>

#include<cstdlib>

#include<algorithm>

#include<cmath>

#define mo  924844033

using namespace std;

typedef long long ll;

int n,k;

ll dp[2][2009][2][2],bin[2009];

int main()

{

  scanf("%d%d",&n,&k);

  dp[0][0][1][0]=1ll;

  int las=0,now=0;

  bin[0]=1;

  for (int i=1;i<=n;i++) bin[i]=(bin[i-1]*(ll)i)%mo;

  for (int t=1;t<=k;t++)

  {

    for (int i=t;i<=n;i+=k)

    {   

      las=now;now=now^1;

      for (int j=0;j<=n;j++)

      for (int x=0;x<=1;x++)

      for (int y=0;y<=1;y++)

      dp[now][j][x][y]=0;

    

      for (int j=0;j<=n;j++)

      for (int x=0;x<=1;x++)

      for (int y=0;y<=1;y++)

  	  {

  	    if (dp[las][j][x][y]==0) continue;

	    ll val=dp[las][j][x][y];

	    if (i+k>n)

	    {

	       dp[now][j][1][0]=(dp[now][j][1][0]+val)%mo;

		   if (x==0) dp[now][j+1][1][0]=(dp[now][j+1][1][0]+val)%mo;  

		}

		else 

		{

	      dp[now][j][y][0]=(dp[now][j][y][0]+val)%mo; 

	      if (x==0) dp[now][j+1][y][0]=(dp[now][j+1][y][0]+val)%mo;

	      dp[now][j+1][y][1]=(dp[now][j+1][y][1]+val)%mo;

	    }

      }

    }

  }

  ll ans=0;

  for (int i=0;i<=n;i++)

  {

  	ll sum=0;

  	for (int x=0;x<=1;x++)

  	for (int y=0;y<=1;y++)

  	sum=(sum+dp[now][i][x][y])%mo;

  	sum=(bin[n-i]*sum)%mo;

  	if (i%2==0) ans=(ans+sum)%mo;

  	else ans=(ans-sum)%mo;

  }

  ans=(ans+mo)%mo;

  printf("%lld\n",ans);

  return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <iostream>

using namespace std;



const int maxn = 2005;

const int P = 924844033;

int n, k, fact[maxn], dp[2][maxn][2][2];



void update(int &a, int b) {

	a += b;

	(a >= P) && (a -= P);

	(a < 0) && (a += P);

}



int main() {

	scanf("%d %d", &n, &k);

	fact[0] = 1;

	for (int i = 1; i <= 2000; i++) {

		fact[i] = 1ll * fact[i - 1] * i % P;

	}

 	int cur = 0, nxt = 1;

 	dp[0][0][1][0] = 1;

	for (int x = 1; x <= k; x++) {

		for (int j = x; j <= n; j += k) {

			memset(dp[nxt], 0, sizeof(dp[nxt]));

			for (int i = 0; i <= n; i++) {

				for (int v0 = 0; v0 < 2; v0++) {

					for (int v1 = 0; v1 < 2; v1++) {

						if (dp[cur][i][v0][v1]) {

							if (j + k > n) {

								update(dp[nxt][i][1][0], dp[cur][i][v0][v1]);

								if (v0 == 0) {

									update(dp[nxt][i + 1][1][0], dp[cur][i][v0][v1]);

								}

							} else {

								update(dp[nxt][i][v1][0], dp[cur][i][v0][v1]);

								if (v0 == 0) {

									update(dp[nxt][i + 1][v1][0], dp[cur][i][v0][v1]);

								}

								update(dp[nxt][i + 1][v1][1], dp[cur][i][v0][v1]);

							}

						}

					}

				}

			}

			swap(cur, nxt);

		}

	}

	int ans = 0;

	for (int i = 0; i <= n; i++) {

		int temp = 0;

		for (int v0 = 0; v0 < 2; v0++) {

			for (int v1 = 0; v1 < 2; v1++) {

				update(temp, dp[cur][i][v0][v1]);

			}

		}

		temp = 1ll * temp * fact[n - i] % P;

		if (i & 1) {

			update(ans, -temp);

		} else {

			update(ans, temp);

		}

	}

	printf("%d\n", ans);

	return 0;//

}

// Faster C++ solution for the same problem (measured speedup: 1.6937556804249867x):
#include<cstdio>

#include<algorithm>

#define MOD 924844033

#define MAXN 2006

using namespace std;

int fac[MAXN],vis[MAXN][2],cnt,ed[MAXN*2],d[MAXN*2][MAXN][2],f[MAXN];

long long ans;

int n,k;

int main()

{

	//freopen("captain.in","r",stdin);

	//freopen("captain.out","w",stdout);

	scanf("%d%d",&n,&k);

	fac[0]=1;

	for(int i=1;i<=n;i++)

		fac[i]=1ll*fac[i-1]*i%MOD;

	for(int i=1;i<=n;i++)

		for(int j=0;j<=1;j++)

			if(!vis[i][j])

			{

				int len=0;

				for(int x=i,y=j;x<=n;x+=k,y^=1)

					vis[x][y]=1,len++;

				cnt+=len;

				ed[cnt]=1;

			}

	ed[0]=1;

	d[0][0][0]=1;

	for(int i=0;i<2*n;i++)

		for(int j=0;j<=n;j++)

		{

			d[i+1][j][0]=(d[i][j][0]+d[i][j][1])%MOD;

			if(!ed[i]) d[i+1][j+1][1]=d[i][j][0];

		}

	for(int i=0;i<=n;i++)

		f[i]=(d[n*2][i][0]+d[n*2][i][1])%MOD;

	long long ans=0;

	for(int i=0,j=1;i<=n;j=-j,i++)

		ans=((ans+1ll*f[i]*fac[n-i]*j)%MOD+MOD)%MOD;

	printf("%lld",ans);

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cstdio>

#include<cstdlib>

#include<algorithm>

#include<cmath>

#define mo  924844033

using namespace std;

typedef long long ll;

int n,k;

ll dp[2][2009][2][2],bin[2009];

int main()

{

  scanf("%d%d",&n,&k);

  dp[0][0][1][0]=1ll;

  int las=0,now=0;

  bin[0]=1;

  for (int i=1;i<=n;i++) bin[i]=(bin[i-1]*(ll)i)%mo;

  for (int t=1;t<=k;t++)

  {

    for (int i=t;i<=n;i+=k)

    {   

      las=now;now=now^1;

      for (int j=0;j<=n;j++)

      for (int x=0;x<=1;x++)

      for (int y=0;y<=1;y++)

      dp[now][j][x][y]=0;

    

      for (int j=0;j<=n;j++)

      for (int x=0;x<=1;x++)

      for (int y=0;y<=1;y++)

  	  {

  	    if (dp[las][j][x][y]==0) continue;

	    ll val=dp[las][j][x][y];

	    if (i+k>n)

	    {

	       dp[now][j][1][0]=(dp[now][j][1][0]+val)%mo;

		   if (x==0) dp[now][j+1][1][0]=(dp[now][j+1][1][0]+val)%mo;  

		}

		else 

		{

	      dp[now][j][y][0]=(dp[now][j][y][0]+val)%mo; 

	      if (x==0) dp[now][j+1][y][0]=(dp[now][j+1][y][0]+val)%mo;

	      dp[now][j+1][y][1]=(dp[now][j+1][y][1]+val)%mo;

	    }

      }

    }

  }

  ll ans=0;

  for (int i=0;i<=n;i++)

  {

  	ll sum=0;

  	for (int x=0;x<=1;x++)

  	for (int y=0;y<=1;y++)

  	sum=(sum+dp[now][i][x][y])%mo;

  	sum=(bin[n-i]*sum)%mo;

  	if (i%2==0) ans=(ans+sum)%mo;

  	else ans=(ans-sum)%mo;

  }

  ans=(ans+mo)%mo;

  printf("%lld\n",ans);

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4537980239254653x):
#include<cstdio>

#include<algorithm>

#define MOD 924844033

#define MAXN 2006

using namespace std;

int fac[MAXN],vis[MAXN][2],cnt,ed[MAXN*2],d[MAXN*2][MAXN][2],f[MAXN];

long long ans;

int n,k;

int main()

{

	//freopen("captain.in","r",stdin);

	//freopen("captain.out","w",stdout);

	scanf("%d%d",&n,&k);

	fac[0]=1;

	for(int i=1;i<=n;i++)

		fac[i]=1ll*fac[i-1]*i%MOD;

	for(int i=1;i<=n;i++)

		for(int j=0;j<=1;j++)

			if(!vis[i][j])

			{

				int len=0;

				for(int x=i,y=j;x<=n;x+=k,y^=1)

					vis[x][y]=1,len++;

				cnt+=len;

				ed[cnt]=1;

			}

	ed[0]=1;

	d[0][0][0]=1;

	for(int i=0;i<2*n;i++)

		for(int j=0;j<=n;j++)

		{

			d[i+1][j][0]=(d[i][j][0]+d[i][j][1])%MOD;

			if(!ed[i]) d[i+1][j+1][1]=d[i][j][0];

		}

	for(int i=0;i<=n;i++)

		f[i]=(d[n*2][i][0]+d[n*2][i][1])%MOD;

	long long ans=0;

	for(int i=0,j=1;i<=n;j=-j,i++)

		ans=((ans+1ll*f[i]*fac[n-i]*j)%MOD+MOD)%MOD;

	printf("%lld",ans);

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <iostream>

using namespace std;



const int maxn = 2005;

const int P = 924844033;

int n, k, fact[maxn], dp[2][maxn][2][2];



void update(int &a, int b) {

	a += b;

	(a >= P) && (a -= P);

	(a < 0) && (a += P);

}



int main() {

	scanf("%d %d", &n, &k);

	fact[0] = 1;

	for (int i = 1; i <= 2000; i++) {

		fact[i] = 1ll * fact[i - 1] * i % P;

	}

 	int cur = 0, nxt = 1;

 	dp[0][0][1][0] = 1;

	for (int x = 1; x <= k; x++) {

		for (int j = x; j <= n; j += k) {

			memset(dp[nxt], 0, sizeof(dp[nxt]));

			for (int i = 0; i <= n; i++) {

				for (int v0 = 0; v0 < 2; v0++) {

					for (int v1 = 0; v1 < 2; v1++) {

						if (dp[cur][i][v0][v1]) {

							if (j + k > n) {

								update(dp[nxt][i][1][0], dp[cur][i][v0][v1]);

								if (v0 == 0) {

									update(dp[nxt][i + 1][1][0], dp[cur][i][v0][v1]);

								}

							} else {

								update(dp[nxt][i][v1][0], dp[cur][i][v0][v1]);

								if (v0 == 0) {

									update(dp[nxt][i + 1][v1][0], dp[cur][i][v0][v1]);

								}

								update(dp[nxt][i + 1][v1][1], dp[cur][i][v0][v1]);

							}

						}

					}

				}

			}

			swap(cur, nxt);

		}

	}

	int ans = 0;

	for (int i = 0; i <= n; i++) {

		int temp = 0;

		for (int v0 = 0; v0 < 2; v0++) {

			for (int v1 = 0; v1 < 2; v1++) {

				update(temp, dp[cur][i][v0][v1]);

			}

		}

		temp = 1ll * temp * fact[n - i] % P;

		if (i & 1) {

			update(ans, -temp);

		} else {

			update(ans, temp);

		}

	}

	printf("%d\n", ans);

	return 0;//

}

// Faster C++ solution for the same problem (measured speedup: 1.532102639183778x):
#include <bits/stdc++.h>

using namespace std;

const int N = 2000 + 10;

const int P = 924844033;

int n, k, dp[N << 1][N][2], a[N << 1], num, fac[N];

int main() {

    scanf("%d%d", &n, &k);

    for (int i = fac[0] = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % P;

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

        for (int j = i; j <= n; j += k) a[++num] = j;

        for (int j = i; j <= n; j += k) a[++num] = j;

    }

    dp[1][0][0] = 1;

    for (int i = 2; i <= (n << 1); i++) {

        for (int j = 0; j <= (i / 2); j++) {

            dp[i][j][0] = (dp[i - 1][j][0] + dp[i - 1][j][1]) % P;

            if (j && a[i] - a[i - 1] == k) dp[i][j][1] = dp[i - 1][j - 1][0];

        }

    }

    int ans = 0;

    for (int i = 0; i <= n; i++) {

        int g = (dp[n << 1][i][0] + dp[n << 1][i][1]) % P;

        if (i & 1)

            ans = (ans - 1ll * fac[n - i] * g % P + P) % P;

        else

            ans = (ans + 1ll * fac[n - i] * g) % P;

    }

    printf("%d\n", ans);

    return 0;

}