#include<stdio.h>
#include<iostream>
#include<algorithm>
#define forr(i,a,b) for(int i=(a);i<(b);++i)
#define forn(i,n) forr(i,0,n)
#define dforn(i,n) for(int i=n-1;i>=0;--i)
#define forall(it,v) for(auto it=v.begin();it!=v.end();++it)
#define fst first
#define snd second
#define sz(c) ((int)c.size())
#define MAXP 1000000
#define BASE 1000000
#define LMAX 10000
using namespace std;
typedef long long ll;
struct bint {
int l;
ll n[LMAX];
bint(ll x = 0) {
l = 1;
forn(i, LMAX) {
if (x) l = i + 1;
n[i] = x % BASE;
x /= BASE;
}
}
void out() {
cout << n[l - 1];
dforn(i, l - 1) printf("%6.6llu", n[i]);
}
void invar() {
fill(n + l, n + LMAX, 0);
while (l > 1 && !n[l - 1]) l--;
}
};
bint operator*(const bint & a, ll b) {
bint c;
ll q = 0;
forn(i, a.l) q += a.n[i] * b, c.n[i] = q % BASE, q /= BASE;
c.l = a.l;
while (q) c.n[c.l++] = q % BASE, q /= BASE;
c.invar();
return c;
}
int main() {
int n = 10000;
bint res(1);
for (int i = 1; i <= n; ++i) {
res = res * i;
}
res.out();
}
Ahi esta Campeón, en programación competitiva este tipo de cosas son pan de cada día