stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



using LL = long long;



#define MOD (7 + (int)1e9)



vector<LL> f(100000);



LL factorial(LL k){

    f[1] = 1;

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

    {

        f[i+1] = (f[i] * (i+1)) % MOD;

    }

    return f[k] % MOD;

}



int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);



    LL N, M;



    cin >> N >> M;



    LL res;

    if(labs(N-M) >= 2){

        cout << 0 << endl;

        return 0;

    }else if(labs(N-M) == 1){

        res = ((factorial(N) % MOD) * (factorial(M) % MOD)) % MOD;

    }else{

        res = ((factorial(N) % MOD) * (factorial(M) % MOD) * 2) % MOD;

    }



    cout << res << endl;



    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<cmath>

using namespace std;

#define mod 1000000007

#define MOD(x) ((x)%mod)

long long n,m;

long long ans(long long x)

{

	long long a=1;

	for(long long i=1;i<=x;i++)

		a=MOD(a*i);

	return a;

}

int main()

{

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

	if(abs(n-m)>=2)

	{

		printf("0");

	}

	else if(abs(n-m)==1)

	{

		printf("%lld",MOD(ans(n)*ans(m)));

	}

	else

	{

		printf("%lld",MOD(ans(n)*ans(m)*2));

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

const int INF = 1e9;

const ll LINF = 1e18;



/*

<url:https://arc076.contest.atcoder.jp/tasks/arc076_a>

問題文============================================================

 すぬけ君は、犬を N 匹と猿を M 匹飼っています。すぬけ君は、この N+M 匹を一列に並べようと思っています。

 

 文字通り犬猿の仲の犬たちと猿たちを仲直りさせたいすぬけ君は、

 犬同士、または猿同士が隣り合うところができないように並べようと思っています。

 

 このような並べ方は何通りあるでしょうか。

 犬と猿は 10^9+7 以上の数を理解できないので、並べ方の個数を 10^9+7 で割ったあまりを求めてください。

 ただし、犬同士、また猿同士は互いに区別します。また、左右が反転しただけの列も異なる列とみなします。

=================================================================



解説=============================================================



 良くある組み合わせ問題

 

 NとMの差が２以上であれば、交互に配置することができないので 1

 差が1であれば、 N!*M!

 差が0であれば 2*N!*M!

================================================================

*/

const ll MOD = 1e9+7;

int main(void) {

	cin.tie(0); ios::sync_with_stdio(false);

    ll N,M; cin >> N >> M;

    ll ans = 1;

    if(abs(N-M)>=2){

        ans = 0;

    }else if(abs(N-M)==1){

        if(M < N) swap(N,M);

        for(ll i = 1; i <= N; i++){

            (ans *= i)%=MOD;

        }

        ans = (ans * ((ans*M)%MOD))%MOD;

    }else{

        for(ll i = 1; i <= N; i++){

            (ans *= i)%=MOD;

        }

        ans = (((ans * ans)%MOD)*2)%MOD;

    }

    cout << ans << endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<cmath>

using namespace std;

#define mod 1000000007

#define MOD(x) ((x)%mod)

long long n,m;

long long ans(long long x)

{

	long long a=1;

	for(long long i=1;i<=x;i++)

		a=MOD(a*i);

	return a;

}

int main()

{

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

	if(abs(n-m)>=2)

	{

		printf("0");

	}

	else if(abs(n-m)==1)

	{

		printf("%lld",MOD(ans(n)*ans(m)));

	}

	else

	{

		printf("%lld",MOD(ans(n)*ans(m)*2));

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define LL long long

#define MEM(x,y) memset(x,y,sizeof(x))

#define MOD(x) ((x)%mod)

#define mod 1000000007

#define pb push_back

#define STREAM_FAST ios::sync_with_stdio(false)



using namespace std;

const int maxn = 1e5+7;

LL f[maxn];

int main()

{

    f[0]=1;for (int i=1;i<=100000;i++) f[i]=MOD(f[i-1]*i);

    

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

    LL ans;

    if (abs(n-m)>1) ans=0;

    else if (abs(n-m)==1) ans=MOD(f[n]*f[m]);

    else if (n==m) ans=MOD(2*f[n]*f[m]);

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

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<cmath>

using namespace std;

#define mod 1000000007

#define MOD(x) ((x)%mod)

long long n,m;

long long ans(long long x)

{

	long long a=1;

	for(long long i=1;i<=x;i++)

		a=MOD(a*i);

	return a;

}

int main()

{

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

	if(abs(n-m)>=2)

	{

		printf("0");

	}

	else if(abs(n-m)==1)

	{

		printf("%lld",MOD(ans(n)*ans(m)));

	}

	else

	{

		printf("%lld",MOD(ans(n)*ans(m)*2));

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<bits/stdc++.h>

#define ll long long

#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

ll p[100009], mod=1000000007;

ll n, m ;

int main()

{

	IO;

	p[0]=1;

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

		p[i]=(i*p[i-1])%mod;

	cin>>n>>m;

	if (abs(n-m)>1)

		return cout<<0, 0;

	if (abs(n-m)==1)

		cout<<(p[n]*p[m])%mod;

	else

		cout<<((2*p[n]*p[m])%mod);

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<int, pii> pipii;

typedef pair<pii, pii> piipii;



#define mp make_pair

#define fi first

#define se second

#define all(a) (a).begin(), (a).end()

#define sz(a) (int)(a).size()

#define eb emplace_back

const int mod = 1e9+7;

ll f[100005];

int main(){

    f[0] = 1;

    for(int i=1;i<=100000;i++) f[i] = f[i-1]*i%mod;

    int a, b;

    scanf("%d%d", &a, &b);   

    if(a < b) swap(a, b);

    if(a-b >= 2) printf("0\n");

    else{

        ll ans;

        if(a-b == 1) ans = f[a]*f[b]%mod;

        else ans = f[a]*f[b]%mod*2%mod;

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

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cmath>

#include<cstring>

#include<algorithm>

using namespace std;

long long f[123456];

#define mod 1000000007;

int main(){

	int n,m;

	f[1]=1;

	for(int i=2;i<=100000;i++){

		f[i]=(i*f[i-1])%mod;

		

	}//printf("%lld\n",f[2]);

//	printf("%lld\n",f[100000]);

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

		long long ans=0;

		if(abs(n-m)>2){

			printf("0\n");

		}

		else{

			if(abs(n-m)==1){

				ans+=f[n]*f[m]%mod;

			}

			if(abs(n-m)==0){

				ans+=f[n]*f[m]*2%mod;

			}

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

		}

		

		

	}

		

	

	return 0;

} 

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<string>

#include<math.h>

#include<map>

#include<vector>

#include<queue>

#include<set>

#include<algorithm>

#define MAX 1000000007

using namespace std;

int main(){

    int n,m;

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

        long long ans=1;

        if(n-m>1||m-n>1){

            printf("0\n");

        }

        else{

            if(n==m){

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

                    ans=(ans*i)%MAX;

                    ans=(ans*i)%MAX;

                }

                ans=(ans*2)%MAX;

            }

            else{

                int pp;

                if(m<n){

                    pp=n;

                    n=m;

                    m=pp;

                }

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

                    ans=(ans*i)%MAX;

                    ans=(ans*i)%MAX;

                }

                ans=(ans*m)%MAX;

            }

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

        }

    }

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



using VI = vector<int>;

using VVI = vector<VI>;

using PII = pair<int, int>;

using LL = long long;

using VL = vector<LL>;

using VVL = vector<VL>;

using PLL = pair<LL, LL>;

using VS = vector<string>;



#define ALL(a)  begin((a)),end((a))

#define RALL(a) (a).rbegin(), (a).rend()

#define PB push_back

#define EB emplace_back

#define MP make_pair

#define SZ(a) int((a).size())

#define SORT(c) sort(ALL((c)))

#define RSORT(c) sort(RALL((c)))

#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))



#define FOR(i,a,b) for(int i=(a);i<(b);++i)

#define REP(i,n)  FOR(i,0,n)



#define FF first

#define SS second

template<class S, class T>

istream& operator>>(istream& is, pair<S,T>& p){

  return is >> p.FF >> p.SS;

}

template<class S, class T>

ostream& operator<<(ostream& os, const pair<S,T>& p){

  return os << p.FF << " " << p.SS;

}

template<class T>

void maxi(T& x, T y){

  if(x < y) x = y;

}

template<class T>

void mini(T& x, T y){

  if(x > y) x = y;

}





const double EPS = 1e-10;

const double PI  = acos(-1.0);

const LL MOD = 1e9+7;



int main(){

  cin.tie(0);

  ios_base::sync_with_stdio(false);



  LL N, M;

  cin >> N >> M;



  VL fact(100010);

  fact[0] = 1;

  for(LL i=1;i<100010;++i)

	fact[i] = (fact[i-1] * i) % MOD;



  if(abs(N-M) > 1){

	cout << 0 << endl;

  }

  else if(N == M){

	cout << fact[N] * fact[M] * 2 % MOD << endl;

  }

  else{

	if(N > M) swap(N, M);

	cout << fact[N] * fact[M] % MOD << endl;

  }



  return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

using namespace std;

typedef long long ll;

int main()

{

    ll n,m;

    cin>>n>>m;

    if(abs(n-m)>1)

    {

        cout<<0<<endl;

        return 0;

    }

    if(n==m)

    {

    ll brojac=1;

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

    {

        brojac*=i;

        brojac%=1000000007;

    }

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

    {

        brojac*=i;

        brojac%=1000000007;

    }

    brojac*=2;

    brojac%=1000000007;

    cout<<brojac<<endl;

    }

    else

    {

        ll brojac=1;

        if(n<m)

            swap(n,m);

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

    {

        brojac*=i;

        brojac%=1000000007;

    }

    for(ll i=1;i<=m;i++)

    {

        brojac*=i;

        brojac%=1000000007;

    }

    cout<<brojac<<endl;

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

const int N = 2e5 + 5;

const long long mod = 1e9 + 7;

long long fact[N];

int main(){

    fact[0] = 1;

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

        fact[i] = fact[i - 1] * i;

        fact[i] %= mod;

    }

    int n, m;

    cin >> n >> m;

    if (n == m)

        cout << fact[n] * fact[m] % mod * 2 % mod;

    else if (abs(n - m) == 1){

        cout << fact[n] * fact[m] % mod;

    }

    else

        cout << 0;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



#define ENGZ ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

#define sfi(x) scanf("%d" , &x)

#define sfi2(x, y) scanf("%d%d" , &x,&y)

#define sfl2(x, y) scanf("%I64d%I64d" , &x,&y)

#define sfl(x) scanf("%I64d" , &x)

#define sfl3(x, y, z) scanf("%I64d%I64d%I64d", &x, &y, &z)

#define sfd(x) scanf("%lf", &x)

#define sfd2(x, y) scanf("%lf", &x, &y)

#define sfs(x) scanf("%s", &x)

#define testv(x) cerr << x << ' '

#define wtf(s) freopen((s), "w", stdout)

#define rff(s) freopen((s), "r", stdin)

#define test cerr << "here"

#define fst(x) cout << fixed << setprecision(x)

#define mod 1000000007

#define pi (2 * acos(0))

typedef long double ld;

typedef long long ll;

int main()

{

    ll n, m, a = 1, b = 1;

    cin >> n >> m;

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

        a = (a * i) % mod;

    for (ll i = 1; i <= m; i++)

        b = (b * i) % mod;

    if (abs(n - m) >= 2)

        cout << 0;

    else if (m == n)

        cout << (((a * b) % mod) * 2) % mod;

    else

        cout << (a * b) % mod;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define MOD 1000000007

#define M(x) ((x) % MOD)

#define N 100001

using namespace std;



typedef unsigned ui;

typedef long long ll;

typedef unsigned long long ul;



ul f[N];



int main(void) {

	ios::sync_with_stdio(0); cin.tie(0);

#ifdef _DEBUG

	ifstream cin("1.in");

#endif

	for (ui i = f[0] = 1; i != N; ++i)

		f[i] = M(f[i - 1] * i);

	ll n, m;

	cin >> n >> m;

	if (abs(n - m) > 1) cout << 0 << endl;

	else {

		if (n == m) cout << M(2 * f[n] * f[n]) << endl;

		else cout << M(f[n] * f[m]) << endl;

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;



int main() {

#ifdef purple_bro

    freopen("in.txt", "r", stdin);

#endif // purple_bro

    int n, m;



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



    if (abs(n - m) > 1)

        puts("0");

    else {

        int dog = 1, monkey = 1;

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

            dog = 1LL * dog * i % mod;

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

            monkey = 1LL * monkey * i % mod;

        int res = 1LL * dog * monkey % mod;

        if (!(n - m))

            res = res * 2 % mod;

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

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#include<string.h>



using namespace std;



int main()

{

    int num;

    cin>>num;

    if(num%10==9 || num/10==9)

    {

        cout<<"Yes";

    }

    else{

        cout<<"No";

    }

    return 0;

}




// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

#include<math.h>

int main()

{

    int a,x,y;

    scanf("%d",&a);

    x=a%10;

    y=a/10;

    if(x == 9 || y == 9)

    {

        printf("Yes\n");

    }

    else

        printf("No\n");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):


#include<bits/stdc++.h>

using namespace std;

int main()

{

    string s;

    cin>>s;



    bool  flag = false;

    for(int i = 0 ; i<s.length();i++)

    {

        if(s[i] == '9')

            flag = true;

    }

    if(flag)

        printf("Yes");

    else

        printf("No");

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

#include<math.h>

int main()

{

    int a,x,y;

    scanf("%d",&a);

    x=a%10;

    y=a/10;

    if(x == 9 || y == 9)

    {

        printf("Yes\n");

    }

    else

        printf("No\n");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <math.h>

using namespace std ;

int lg10(int x ){

	int cnt = 0 ;

	while ( x != 0 ) {

		x /= 10 ;

		cnt ++ ;

	}

	return cnt ;

}

int main(int argc, char** argv) {

	int n ;

	cin >> n ;

	int div1 = 10 , div2 = 1 ;

	string ans = "No" ;

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

		if ( ( n % div1 ) / div2 == 9 ) {

			ans = "Yes" ;

			break ;

		} 

		div1 *= 10 ;

		div2 *= 10 ;

	}

	cout << ans ;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	int a;

	scanf("%d",&a);



	if(a/10==9 || a%10==9)

		printf("Yes\n");

	else

		printf("No\n");

	

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//Be Name Khoda

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef long double ld;

const int MOD = (int)1e9 + 7;

const int MAXN = (int)1e6 + 7;

bool f(string s)

{

	if(s.size() < 7)

		return false;

	if(s[0] == 'd' and s[1] == 'r' and s[2] == 'e' and s[3] == 'a' and s[4] == 'm' and s[5] == 'e' and s[6] == 'r')

		return true;

	return false;

}



int main()

{

	ios::sync_with_stdio(false);

	cin.tie(0); cout.tie(0);

	int n;

	cin >> n;

	while(n)

	{

		if((n % 10) == 9)

			return cout << "Yes", 0;

		n /= 10;

	}

	cout << "No";

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	int a;

	scanf("%d",&a);



	if(a/10==9 || a%10==9)

		printf("Yes\n");

	else

		printf("No\n");

	

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int main()

{

    int a;

    cin>>a;

    if(a%10==9||a/10==9)

        {cout<<"Yes"<<endl;}

    else

    {

        cout<<"No"<<endl;

    }return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	int a;

	scanf("%d",&a);



	if(a/10==9 || a%10==9)

		printf("Yes\n");

	else

		printf("No\n");

	

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int main()

{

    int n;

    cin>>n;

    if(n/10==9 || n%10==9)

    {

        cout<<"Yes"<<endl;

    }

    else

    {

        cout<<"No"<<endl;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	int a;

	scanf("%d",&a);



	if(a/10==9 || a%10==9)

		printf("Yes\n");

	else

		printf("No\n");

	

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main()

{

    int n;

    cin >> n;

    if(n % 10 == 9 || n / 10 == 9){

        cout << "Yes";

    }

    else{

        cout << "No";

    }

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	int n = 0;

	scanf("%d",&n);

	

	int modulo = n%10;

	int bagi = n/10;

	

	if(modulo==9 || bagi==9){

		printf("Yes\n");

	}else{

		printf("No\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std;



int main()

{



    int a;

    cin>>a;

    if(a/10==9||a%10==9)cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	int n = 0;

	scanf("%d",&n);

	

	int modulo = n%10;

	int bagi = n/10;

	

	if(modulo==9 || bagi==9){

		printf("Yes\n");

	}else{

		printf("No\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main(){

	int a;

	for(;cin>>a;){

	if(a%10==9||a/10==9)

	cout<<"Yes"<<endl;	

	else

	cout<<"No"<<endl;

}

	return 0;

} 

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	int n = 0;

	scanf("%d",&n);

	

	int modulo = n%10;

	int bagi = n/10;

	

	if(modulo==9 || bagi==9){

		printf("Yes\n");

	}else{

		printf("No\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n;

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

   {

       if(n%10==9||n/10==9)

    {

        printf("Yes\n");

    }

    else

        printf("No\n");

    return 0;

   } 

}




// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	int n = 0;

	scanf("%d",&n);

	

	int modulo = n%10;

	int bagi = n/10;

	

	if(modulo==9 || bagi==9){

		printf("Yes\n");

	}else{

		printf("No\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

const int maxn=50;

const long long maxl=1000000000;

long long sx=maxl+1,bx=-maxl-1,sy=maxl+1,by=-maxl-1;

long long x[maxn+1],y[maxn+1];

int n,k;

long long ans=(maxl*2+1)*(maxl*2+1);

void dfs(int p,int c){

	if(c+n-(p-1)<k)return;

	long long ar=(bx-sx)*(by-sy);

	if(c>0&&ar>=ans)return;

	if(p==n+1){

		ans=min(ans,ar);

		return;

	}

	//point p not chosen

	dfs(p+1,c);

	

	//point p chosen

	long long _sx=sx,_bx=bx,_sy=sy,_by=by;

	sx=min(sx,x[p]);bx=max(bx,x[p]);

	sy=min(sy,y[p]);by=max(by,y[p]);

	dfs(p+1,c+1);

	sx=_sx;bx=_bx;sy=_sy;by=_by;

}

	

int main(int argc,char *argv[]){

	if(argc>=2){freopen(argv[1],"r",stdin);}

	if(argc>=3){freopen(argv[2],"w",stdout);}

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

	for(int i=1;i<=n;++i)scanf("%lld%lld",&x[i],&y[i]);

	dfs(1,0);

	printf("%lld",ans);

	fclose(stdin);fclose(stdout);

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

struct node

{

	long long x,y;

	int a,b;

}point[55];

int incx(const void *a, const void *b)

{

    struct node m = *(struct node *)a;

    struct node n = *(struct node *)b;

    if(m.x<n.x) return -1;

    else return 1;

}

int incy(const void *a, const void *b)

{

    struct node m = *(struct node *)a;

    struct node n = *(struct node *)b;

    if(m.y<n.y) return -1;

    else return 1;

}

int main()

{

	int n,k,mp[55][55],xmax,ymax,temp;

	bool np[55][55];

	long long x[55],y[55],S,min=-1,xx[55],yy[55],Smax=-1;

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

	{

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

		{

			mp[i][j]=0;

			np[i][j]=false;

		}

	}

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

	for(int i=0;i<n;i++)scanf("%lld%lld",&point[i].x,&point[i].y);

	qsort(point,n,sizeof(struct node),incx);

	temp=0;

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

	{

		point[i].a=temp;

		xx[temp]=point[i].x;

		temp++;

	}

	qsort(point,n,sizeof(struct node),incy);

	temp=0;

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

	{

		point[i].b=temp;

		np[point[i].a][point[i].b]=true;

		yy[temp]=point[i].y;

		temp++;

	}

	if(np[0][0]==false)mp[0][0]=0;

	else mp[0][0]=1;

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

	{

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

		{

			if(i==0)mp[i][j]=mp[i][j-1]+np[i][j];

			else if(j==0)mp[i][j]=mp[i-1][j]+np[i][j];

			else mp[i][j]=mp[i-1][j]+mp[i][j-1]-mp[i-1][j-1]+np[i][j];

		}

	}

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

	{

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

		{

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

			{

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

				{

					int sum;

					if(i==0)sum=mp[p][q]-mp[p][j-1];

					else if(j==0)sum=mp[p][q]-mp[i-1][q];

					else sum=mp[p][q]-mp[i-1][q]-mp[p][j-1]+mp[i-1][j-1];

					if(sum>=k)

					{

						if((xx[p]-xx[i])*(yy[q]-yy[j])<=Smax||Smax<0)Smax=(xx[p]-xx[i])*(yy[q]-yy[j]);

					}

				}

			}

		}

	}

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

}

// Fastest known solution for this problem: