QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#703770#100. TetrahedronsTheZoneAC ✓523ms66048kbC++2060.8kb2024-11-02 18:28:102024-11-02 18:28:12

Judging History

你现在查看的是最新测评结果

  • [2024-11-02 18:28:12]
  • 评测
  • 测评结果:AC
  • 用时:523ms
  • 内存:66048kb
  • [2024-11-02 18:28:10]
  • 提交

answer

#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}

/*
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std
int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}
*/

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3600kb

input:

2

output:

12

result:

ok 1 number(s): "12"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

37

output:

65561472

result:

ok 1 number(s): "65561472"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

3

output:

417

result:

ok 1 number(s): "417"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

4

output:

2481

result:

ok 1 number(s): "2481"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

5

output:

8448

result:

ok 1 number(s): "8448"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

6

output:

21492

result:

ok 1 number(s): "21492"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

7

output:

45765

result:

ok 1 number(s): "45765"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

8

output:

86349

result:

ok 1 number(s): "86349"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

9

output:

149280

result:

ok 1 number(s): "149280"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

10

output:

241548

result:

ok 1 number(s): "241548"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

11

output:

371121

result:

ok 1 number(s): "371121"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

12

output:

547137

result:

ok 1 number(s): "547137"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

13

output:

778968

result:

ok 1 number(s): "778968"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3736kb

input:

14

output:

1077852

result:

ok 1 number(s): "1077852"

Test #15:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

15

output:

1455501

result:

ok 1 number(s): "1455501"

Test #16:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

16

output:

1924269

result:

ok 1 number(s): "1924269"

Test #17:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

17

output:

2498208

result:

ok 1 number(s): "2498208"

Test #18:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

18

output:

3192204

result:

ok 1 number(s): "3192204"

Test #19:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

19

output:

4021137

result:

ok 1 number(s): "4021137"

Test #20:

score: 0
Accepted
time: 1ms
memory: 3728kb

input:

20

output:

5002401

result:

ok 1 number(s): "5002401"

Test #21:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

21

output:

6152520

result:

ok 1 number(s): "6152520"

Test #22:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

22

output:

7490148

result:

ok 1 number(s): "7490148"

Test #23:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

23

output:

9035637

result:

ok 1 number(s): "9035637"

Test #24:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

24

output:

10808829

result:

ok 1 number(s): "10808829"

Test #25:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

25

output:

12830472

result:

ok 1 number(s): "12830472"

Test #26:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

26

output:

15122892

result:

ok 1 number(s): "15122892"

Test #27:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

27

output:

17710593

result:

ok 1 number(s): "17710593"

Test #28:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

28

output:

20615985

result:

ok 1 number(s): "20615985"

Test #29:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

29

output:

23865144

result:

ok 1 number(s): "23865144"

Test #30:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

30

output:

27485172

result:

ok 1 number(s): "27485172"

Test #31:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

31

output:

31500117

result:

ok 1 number(s): "31500117"

Test #32:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

32

output:

35941269

result:

ok 1 number(s): "35941269"

Test #33:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

33

output:

40835784

result:

ok 1 number(s): "40835784"

Test #34:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

34

output:

46213188

result:

ok 1 number(s): "46213188"

Test #35:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

35

output:

52106697

result:

ok 1 number(s): "52106697"

Test #36:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

36

output:

58545057

result:

ok 1 number(s): "58545057"

Test #37:

score: 0
Accepted
time: 523ms
memory: 66048kb

input:

4000

output:

10164196900132989

result:

ok 1 number(s): "10164196900132989"

Test #38:

score: 0
Accepted
time: 316ms
memory: 44600kb

input:

3172

output:

4018224734920449

result:

ok 1 number(s): "4018224734920449"

Test #39:

score: 0
Accepted
time: 42ms
memory: 9956kb

input:

1194

output:

80475788752884

result:

ok 1 number(s): "80475788752884"

Test #40:

score: 0
Accepted
time: 7ms
memory: 4548kb

input:

479

output:

2072359159125

result:

ok 1 number(s): "2072359159125"

Test #41:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

126

output:

9654636228

result:

ok 1 number(s): "9654636228"

Test #42:

score: 0
Accepted
time: 19ms
memory: 6312kb

input:

822

output:

18045550290852

result:

ok 1 number(s): "18045550290852"

Test #43:

score: 0
Accepted
time: 262ms
memory: 38312kb

input:

2928

output:

2916975738011877

result:

ok 1 number(s): "2916975738011877"

Test #44:

score: 0
Accepted
time: 48ms
memory: 10208kb

input:

1274

output:

104335421693580

result:

ok 1 number(s): "104335421693580"

Test #45:

score: 0
Accepted
time: 108ms
memory: 19880kb

input:

1921

output:

540003893401944

result:

ok 1 number(s): "540003893401944"

Test #46:

score: 0
Accepted
time: 302ms
memory: 41916kb

input:

3110

output:

3713046514992948

result:

ok 1 number(s): "3713046514992948"

Test #47:

score: 0
Accepted
time: 14ms
memory: 6460kb

input:

691

output:

9001799196273

result:

ok 1 number(s): "9001799196273"

Test #48:

score: 0
Accepted
time: 33ms
memory: 8164kb

input:

1066

output:

51106224390756

result:

ok 1 number(s): "51106224390756"

Test #49:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

268

output:

201528266361

result:

ok 1 number(s): "201528266361"

Test #50:

score: 0
Accepted
time: 211ms
memory: 32872kb

input:

2659

output:

1983591305458065

result:

ok 1 number(s): "1983591305458065"

Test #51:

score: 0
Accepted
time: 21ms
memory: 8408kb

input:

860

output:

21626448033225

result:

ok 1 number(s): "21626448033225"

Test #52:

score: 0
Accepted
time: 3ms
memory: 4104kb

input:

314

output:

380734623660

result:

ok 1 number(s): "380734623660"

Test #53:

score: 0
Accepted
time: 112ms
memory: 18304kb

input:

1921

output:

540003893401944

result:

ok 1 number(s): "540003893401944"

Test #54:

score: 0
Accepted
time: 319ms
memory: 42924kb

input:

3172

output:

4018224734920449

result:

ok 1 number(s): "4018224734920449"

Test #55:

score: 0
Accepted
time: 73ms
memory: 13576kb

input:

1560

output:

234716061994797

result:

ok 1 number(s): "234716061994797"

Test #56:

score: 0
Accepted
time: 22ms
memory: 6916kb

input:

888

output:

24587664242733

result:

ok 1 number(s): "24587664242733"

Test #57:

score: 0
Accepted
time: 0ms
memory: 3744kb

input:

75

output:

1181582409

result:

ok 1 number(s): "1181582409"

Test #58:

score: 0
Accepted
time: 433ms
memory: 57712kb

input:

3685

output:

7320487107861408

result:

ok 1 number(s): "7320487107861408"

Test #59:

score: 0
Accepted
time: 238ms
memory: 35456kb

input:

2762

output:

2309414180449836

result:

ok 1 number(s): "2309414180449836"

Test #60:

score: 0
Accepted
time: 118ms
memory: 20580kb

input:

1994

output:

626940735928284

result:

ok 1 number(s): "626940735928284"

Test #61:

score: 0
Accepted
time: 94ms
memory: 15964kb

input:

1764

output:

383873642612793

result:

ok 1 number(s): "383873642612793"

Test #62:

score: 0
Accepted
time: 2ms
memory: 3828kb

input:

247

output:

145191715389

result:

ok 1 number(s): "145191715389"