Language: C++

#pragma gcc optimize("O3, unroll-loops")

#include<cstdio>
typedef int64_t lld;
inline void input(int &_x) {
    _x = 0;
    int _tmp = 1; char _tc = getchar();
    while((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
    if(_tc == '-') _tc = getchar(), _tmp = -1;
    while(_tc >= '0' && _tc <= '9') _x = _x*10+(_tc-48), _tc = getchar();
    _x *= _tmp;
}
inline void output(int _x) {
    char _buff[20]; int _f = 0;
    if(_x == 0)putchar('0');
    while(_x > 0)
    {
        _buff[_f++] = _x%10+'0';
        _x /= 10;
    }
    for(_f-=1; _f >= 0; _f--)
        putchar(_buff[_f]);
    putchar('\n');
}
// code starts here
const int mod = 1000000007, N = 100000;
constexpr int invmod(int x, int y = mod, int s0 = 1, int s1 = 0){
    return y?invmod(y,x%y,s1,(s0-(lld)s1*(x/y)%mod+mod)%mod): s0;
}
struct Vals{
    int fact[N]={1,1}, inv[N]={0,1};
    constexpr Vals(){
        for(int i=2; i<N; ++i)
	       inv[i] = (mod - (lld)(mod/i) * inv[mod%i] % mod) % mod,
           fact[i] = (lld)fact[i-1]*i%mod;
    }
} vals;

inline void M(int& x){ if(x>mod)x-=mod; }
int dp[100000]={}, sdp[100000]={};
signed main(){
    int n, x;
    input(n);
    for(int i = 0, inv = 1; i < n; ++i){
        for(int j = 0; j <= i; ++j)
            dp[j] = ((lld)(sdp[j] + sdp[i-j])*vals.inv[i+1]+1)%mod;
        for(int j = 0; j <= i; ++j)
            M(sdp[j]+=dp[j]);
    }
    lld ans = 0;
    for(int i = 0; i < n; i++){
        input(x);
        ans = (ans + (lld)dp[i]*x)%mod;
    }
    output((lld)ans*vals.fact[n]%mod);
}


Compiler output:
a.cc:4:9: error: 'int64_t' does not name a type
    4 | typedef int64_t lld;
      |         ^~~~~~~
a.cc:4:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    3 | #include<cstdio>
  +++ |+#include <cstdint>
    4 | typedef int64_t lld;
a.cc: In function 'constexpr int invmod(int, int, int, int)':
a.cc:28:35: error: 'lld' was not declared in this scope
   28 |     return y?invmod(y,x%y,s1,(s0-(lld)s1*(x/y)%mod+mod)%mod): s0;
      |                                   ^~~
a.cc:28:39: error: expected ')' before 's1'
   28 |     return y?invmod(y,x%y,s1,(s0-(lld)s1*(x/y)%mod+mod)%mod): s0;
      |                              ~        ^~
      |                                       )
a.cc:28:65: error: expected ':' before ';' token
   28 |     return y?invmod(y,x%y,s1,(s0-(lld)s1*(x/y)%mod+mod)%mod): s0;
      |                                                                 ^
      |                                                                 :
a.cc:28:65: error: expected primary-expression before ';' token
a.cc: In constructor 'constexpr Vals::Vals()':
a.cc:34:33: error: 'lld' was not declared in this scope
   34 |                inv[i] = (mod - (lld)(mod/i) * inv[mod%i] % mod) % mod,
      |                                 ^~~
a.cc: In function 'int main()':
a.cc:46:23: error: 'lld' was not declared in this scope
   46 |             dp[j] = ((lld)(sdp[j] + sdp[i-j])*vals.inv[i+1]+1)%mod;
      |                       ^~~
a.cc:50:5: error: 'lld' was not declared in this scope
   50 |     lld ans = 0;
      |     ^~~
a.cc:53:9: error: 'ans' was not declared in this scope
   53 |         ans = (ans + (lld)dp[i]*x)%mod;
      |         ^~~
a.cc:53:27: error: expected ')' before 'dp'
   53 |         ans = (ans + (lld)dp[i]*x)%mod;
      |               ~           ^~
      |                           )
a.cc:55:17: error: expected ')' before 'ans'
   55 |     output((lld)ans*vals.fact[n]%mod);
      |           ~     ^~~
      |                 )