Language: C

clude <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;
 
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)
 
template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
 
#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif
 
const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
pair<ll, ll> A[2000];
ll dp[2005][2005];
int main() {
    init();
    ll N;
    cin >> N;
    rep(i, N){
        cin >> A[i].first;
        A[i].second = i;
    }
    sort(A, A + N, greater<pair<ll,ll>>());
    rep(i, N){
        rep(l,i+1){
            int r = i - l;
            chmax(dp[l + 1][r], dp[l][r] + A[i].first * (A[i].second - l));
            chmax(dp[l][r + 1], dp[l][r] + A[i].first * (N - r - A[i].second - 1));
        }
    }
 
    ll ans = -INF;
    rep(i, N + 1) chmax(ans, dp[i][N - i]);
    cout << ans << endl;
    
    
}

Compiler output:
main.c:1:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | clude <bits/stdc++.h>
      |       ^
main.c:3:1: error: unknown type name 'using'
    3 | using ll = long long;
      | ^~~~~
main.c:3:12: error: expected expression before 'long'
    3 | using ll = long long;
      |            ^~~~
main.c:4:1: error: unknown type name 'using'
    4 | using ld = long double;
      | ^~~~~
main.c:4:12: error: expected expression before 'long'
    4 | using ld = long double;
      |            ^~~~
main.c:5:1: error: unknown type name 'using'
    5 | using vl = vector<ll>;
      | ^~~~~
main.c:5:12: error: 'vector' undeclared here (not in a function)
    5 | using vl = vector<ll>;
      |            ^~~~~~
main.c:5:22: error: expected expression before ';' token
    5 | using vl = vector<ll>;
      |                      ^
main.c:7:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    7 | template<class T> using vvc = vector<vector<T>>;
      |         ^
main.c:17:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   17 | template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
      |         ^
main.c:18:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   18 | template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
      |         ^
main.c: In function 'init':
main.c:19:14: error: 'cin' undeclared (first use in this function)
   19 | void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
      |              ^~~
main.c:19:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:25: error: 'ios' undeclared (first use in this function)
   19 | void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
      |                         ^~~
main.c:19:28: error: expected ';' before '::' token
   19 | void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
      |                            ^~
      |                            ;
main.c:19:53: error: 'cout' undeclared (first use in this function)
   19 | void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
      |                                                     ^~~~
main.c:19:61: error: 'fixed' undeclared (first use in this function)
   19 | void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
      |                                                             ^~~~~
main.c:19:70: error: implicit declaration of function 'setprecision' [-Wimplicit-function-declaration]
   19 | void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
      |                                                                      ^~~~~~~~~~~~
main.c: At top level:
main.c:27:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'INF'
   27 | const ll INF = 5e18;
      |          ^~~
main.c:28:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'EPS'
   28 | const ld EPS = 1e-11;
      |          ^~~
main.c:29:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PI'
   29 | const ld PI = acos(-1.0L);
      |          ^~
main.c:30:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'MOD'
   30 | const ll MOD = 1e9 + 7;
      |          ^~~
main.c:33:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   33 | pair<ll, ll> A[2000];
      |     ^
main.c:34:1: error: unknown type name 'll'; did you mean 'all'?
   34 | ll dp[2005][2005];
      | ^~
      | all
main.c: In function 'main':
main.c:37:7: error: expected ';' before 'N'
   37 |     ll N;
      |       ^~
      |       ;
main.c:38:5: error: 'cin' undeclared (first use in this function)
   38 |     cin >> N;
      |     ^~~
main.c:38:12: error: 'N' undeclared (first use in this function)
   38 |     cin >> N;
      |            ^
main.c:39:9: error: expected ';' before 'i'
   39 |     rep(i, N){
      |         ^
main.c:11:27: note: in definition of macro 'rep'
   11 | #define rep(i, n) for (ll i = 0; i < (n); i++)
      |                           ^
main.c:39:9: error: 'i' undeclared (first use in this function)
   39 |     rep(i, N){
      |         ^
main.c:11:34: note: in definition of macro 'rep'
   11 | #define rep(i, n) for (ll i = 0; i < (n); i++)
      |                                  ^
main.c:40:16: error: 'A' undeclared (first use in this function)
   40 |         cin >> A[i].first;
      |                ^
main.c:43:5: error: implicit declaration of function 'sort' [-Wimplicit-function-declaration]
   43 |     sort(A, A + N, greater<pair<ll,ll>>());
      |     ^~~~
main.c:43:20: error: 'greater' undeclared (first use in this function); did you mean 'reper'?
   43 |     sort(A, A + N, greater<pair<ll,ll>>());
      |                    ^~~~~~~
      |                    reper
main.c:43:28: error: 'pair' undeclared (first use in this function)
   43 |     sort(A, A + N, greater<pair<ll,ll>>());
      |                            ^~~~
main.c:43:41: error: expected expression before ')' token
   43 |     sort(A, A + N, greater<pair<ll,ll>>());
      |                                         ^
main.c:44:9: error: expected ';' before 'i'
   44 |     rep(i, N){
      |         ^
main.c:11:27: note: in definition of macro 'rep'
   11 | #define rep(i, n) for (ll i = 0; i < (n); i++)
      |                           ^
main.c:45:13: error: expected ';' before 'l'
   45 |         rep(l,i+1){
      |             ^
main.c:11:27: note: in definition of macro 'rep'
   11 | #define rep(i, n) for (ll i = 0; i < (n); i++)
      |                           ^
main.c:45:13: error: 'l' undeclared (first use in this function); did you mean 'vl'?
   45 |         rep(l,i+1){
      |             ^
main.c:11:34: note: in definition of macro 'rep'
   11 | #define rep(i, n) for (ll i = 0; i < (n); i++)
      |                                  ^
main.c:47:13: error: implicit declaration of function 'chmax' [-Wimplicit-function-declaration]
   47 |             chmax(dp[l + 1][r], dp[l][r] + A[i].first * (A[i].second - l));
      |             ^~~~~
main.c:52:7: error: expected ';' before 'ans'
   52 |     ll ans = -INF;
      |       ^~~~
      |       ;
main.c:53:9: error: expected ';' before 'i'
   53 |     rep(i, N + 1) chmax(ans, dp[i][N - i]);
      |         ^
main.c:11:27: note: in definition of macro 'rep'
   11 | #define rep(i, n) for (ll i = 0; i < (n); i++)
      |                           ^
main.c:53:25: error: 'ans' undeclared (first use in this function)
   53 |     rep(i, N + 1) chmax(ans, dp[i][N - i]);
      |                         ^~~
main.c:54:5: error: 'cout' undeclared (first use in this function)
   54 |     cout << ans << endl;
      |     ^~~~
main.c:54:20: error: 'endl' undeclared (first use in this function)
   54 |     cout << ans << endl;
      |                    ^~~~