Language: C++

#include <bits/stdc++.h>

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp std::make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	std::ifstream t("/proc/self/status");
	cerr << string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>()) << endl;
}

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getchar());
	for(; !isdigit(ch); ch = getchar()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

typedef long long LL;
typedef pair<int, int> pii;

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

// Template-Libs

namespace MATH
{
	int inv[MAXN + 5];

	inline void init()
	{
		inv[0] = 1;
		for(int i = 1; i <= n; ++i) inv[i] = (LL) MOD / i * -inv[MOD % i] % MOD;
	}
}

using MATH::inv;

// END

int n;

int a[MAXN + 5];

inline void input()
{
	n = read<int>();
	for(int i = 1; i <= n; ++i) a[i] = read<int>();
}

inline void solve()
{
	int sum = 0;
	for(int i = 1; i <= n; ++i) (sum += inv[i]) %= MOD;
	for(int i = 1; i <= n; ++i) (ans += (LL) (sum - inv[i]) % MOD * a[i] % MOD) %= MOD;
	for(int i = 1; i <= n; ++i) ans = (LL) ans * i % MOD;
	printf("%d\n", (ans + MOD) % MOD);
}

int main()
{
	MATH::init();
	input();
	solve();

	return 0;
}



Compiler output:
a.cc: In function 'void proc_status()':
a.cc:13:9: error: 'cerr' was not declared in this scope; did you mean 'std::cerr'?
   13 |         cerr << string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>()) << endl;
      |         ^~~~
      |         std::cerr
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:64:18: note: 'std::cerr' declared here
   64 |   extern ostream cerr;          ///< Linked to standard error (unbuffered)
      |                  ^~~~
a.cc:13:17: error: 'string' was not declared in this scope
   13 |         cerr << string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>()) << endl;
      |                 ^~~~~~
a.cc:13:17: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:13:96: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   13 |         cerr << string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>()) << endl;
      |                                                                                                ^~~~
      |                                                                                                std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc: In function 'T read()':
a.cc:20:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         register T sum(0), fg(1);
      |                    ^~~
a.cc:20:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         register T sum(0), fg(1);
      |                            ^~
a.cc:21:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |         register char ch(getchar());
      |                       ^~
a.cc: At global scope:
a.cc:28:9: error: 'pair' does not name a type
   28 | typedef pair<int, int> pii;
      |         ^~~~
a.cc: In function 'void MATH::init()':
a.cc:42:37: error: 'n' was not declared in this scope
   42 |                 for(int i = 1; i <= n; ++i) inv[i] = (LL) MOD / i * -inv[MOD % i] % MOD;
      |                                     ^
a.cc: In function 'void solve()':
a.cc:64:38: error: 'ans' was not declared in this scope; did you mean 'abs'?
   64 |         for(int i = 1; i <= n; ++i) (ans += (LL) (sum - inv[i]) % MOD * a[i] % MOD) %= MOD;
      |                                      ^~~
      |                                      abs
a.cc:65:37: error: 'ans' was not declared in this scope; did you mean 'abs'?
   65 |         for(int i = 1; i <= n; ++i) ans = (LL) ans * i % MOD;
      |                                     ^~~
      |                                     abs
a.cc:66:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   66 |         printf("%d\n", (ans + MOD) % MOD);
      |                         ^~~
      |                         abs
a.cc: In instantiation of 'T read() [with T = int]':
a.cc:56:15:   required from here
   56 |         n = read<int>();
      |             ~~~~~~~~~^~
a.cc:20:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         register T sum(0), fg(1);
      |                    ^~~
a.cc:20:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         register T sum(0), fg(1);
      |                            ^~
a.cc:21:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |         register char ch(getchar());
      |                       ^~