criyle/codenet-compile-errors huggingface dataset:
Language: C

// #include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define trace(x) cerr << #x << ": " << x << " " << endl;
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power(((((a)%mod)*((a)%mod))%mod),b/2)%mod;
    else return (((a)%mod)*(power(((((a)%mod)*((a)%mod))%mod),b/2)%mod))%mod;
}
inline ll inverse(ll a,ll md) {
  a %= md;
  if (a < 0) a += md;
  ll b = md, u = 0, v = 1;
  while (a) {
    ll t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}
  
  
 //using namespace __gnu_pbds;
 //#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set
// mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); for randomized solution
const int ce=1e9+7;
ll fast_mod(ll input)
{
    return input < ce ? input : input%ce;
}
#define pi 3.14159
int32_t main()
{
    IOS
 
	int n,k;
	cin>>n>>k;
	int a[n+2];
	for(int i=1;i<=n+1;i++)
		a[i]=i-1;
	int sum[n+2];
	sum[0]=0;
	for(int i=1;i<=n+1;i++)
	{
		sum[i]=sum[i-1]+a[i];
	}
	int ans=0;
	for(int i=k;i<=n+1;i++)
	{
		ans+=sum[n+1]-sum[n+1-i]-sum[i]+1;
		ans%=mod;
	}
	cout<<ans<<endl;
}       

Compiler output:
main.c:3:10: fatal error: iostream: No such file or directory
    3 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

lint gyaku(lint a, lint mod){
  lint s = 1, tmp = a, t = mod - 2;
  while(t > 0){
    if(t % 2 == 1){
      s *= tmp;
      s %= mod;
    }
    t /= 2;
    tmp *= tmp;
    tmp %= mod;
  }
  return s;
}

int main() {
  lint n, k, s = 0;
  cin >> n >> k;
  ++n;
  v1li v(n+1); v[0] = 1;
  rep(i, n){
    v[i+1] = v[i]*(i+1);
    v[i+1] %= mod1;
  }
  for(int i = k, k <= n; ++i){
    lint t = v[n];
    t *= gyaku(v[k], mod1);
    t %= mod1;
    t *= gyaku(v[n-k], mod1);
    t %= mod1;
    s += t;
    s %= mod1;
  }
  cout << s << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:19: error: expected ';' before '<=' token
   53 |   for(int i = k, k <= n; ++i){
      |                   ^~~
      |                   ;
a.cc:53:20: error: expected primary-expression before '<=' token
   53 |   for(int i = k, k <= n; ++i){
      |                    ^~
Language: C

#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <memory>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
////@formatter:off
#define double long double
typedef long long ll;
typedef unsigned long long ull;
template<typename T>void __read(T &a) { cin >> a; }
template<typename T, typename ... Args> void __read(T &a, Args &... args) { cin >> a;__read(args...);}
#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i];
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T> void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
auto __fast_io__ = (ios_base::sync_with_stdio(false), cin.tie(nullptr)); // NOLINT(cert-err58-cpp,cppcoreguidelines-interfaces-global-init)
////@formatter:on
//endregion


int32_t main() {
//    make(int, n);
//    cout << fixed << setprecision(10) <<  2 * n * M_PI;

    make(int, n, k);
    int ans = 0;
    VI a(n + 1);
    iota(ALL(a), 0);
    int lsm = 0, l = 0;
    int rsm = 0, r = 0;
    for(int i = k; i <= n + 1; ++i){
        while(l < i){
            lsm += a[l++];
        }
        while(r < i){
            rsm += a[n - r++];
        }
//        cerr << lsm << ' ' << rsm << endl;
        ans = (ans + rsm - lsm + 1) % M7;
    }
    cout << ans;

    return 0;
}

Compiler output:
main.c:3:10: fatal error: iostream: No such file or directory
    3 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  long long n,k;
  cin>>n>>k;
  long long ans=0;
  for(int i=k;i<=n+1,i++){
    long long x=(2*n-i+1)*i;
    x/=2;
    x++;
    x%=1000000007;
    ans+=x;
    ans%=1000000007;
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:25: error: expected ';' before ')' token
    8 |   for(int i=k;i<=n+1,i++){
      |                         ^
      |                         ;
Language: C

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';
#define mod 1000000007

using namespace std;

int main(void){
    ll N, K, count=0;
    cin>>N>>K;
    reps(i, K, N+2){
        count+=(i*((N+1-i)%mod)+1)%mod;
        count%=mod;
    }
    cout<<count<<endl;
    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

/*input
141421 35623
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define ld long double
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2){
			ans*=a;
			ans%=(mod);
		}
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(ll* a,ll n,ll val){
	for(ll i=0;i<n;i++)
		a[i]=val;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);	
	ll t=1,i,j;
	ll n,k;
	cin>>n>>k;
	ll ans=0;
	rep(k,k,n+2)ans+=k*n-(k-1)*(k)+1,ans%=M;
	cout<<ans<<endl;
	return 0;
}




Compiler output:
main.c:5:10: fatal error: bits/stdc++.h: No such file or directory
    5 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll ans;
ll M=1000000007;
ll s[200005];
int main(void){
	ll n,k; cin>>n>>k;
	for(int i=1;i<200005;i++){
		s[i]=s[i-1]+i;
	}
	for(int i=k;i<=n+1;i++){
		ans=(ans+(s[n]-s[n-i])-s[i-1]+1)%M;
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;
	
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 2e5;
const ll MOD = 1e9+7;

int N, K;
ll ans;

int main()
{
	int i, j;
	scanf("%d%d", &N, &K);

	ll a=0, b=0;
	for(i=0; i<=N; i++)
	{
		a+=i, b+=N-i;
		if(K-1<=i) ans=((ans+b-a+1)%MOD+MOD)%MOD;
	}
	printf("%lld\n", ans);
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  ll n, k;
  cin >> n >> k;

  ll ans = 0;
  ll left = 0, right = 0;
  rep(i, n + 1) {
    left = (left + i) % mod;
    right = (right + n - i) % mod;
    if (i >= k - 1) ans = (ans + right - left + 1 + mod) % mod;
  }
  cout << ans << '\n';




  
  return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 1000000007LL
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (ll i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (ll i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (ll i=(a); i >= b; i--)

#define MN 200005
int n, k;
ll sm(int a, int b){
    return 1LL*(a+b)*(b-a+1)/2;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> k;
    ll tot = 0;
    FOR(i, k, n+1){
        ll mn = sm(0, i-1);
        ll mx = sm(n-i+1, n);
        tot = (tot+mx-mn+1)%MOD;
    }
    cout << tot << "\n";

    return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)

const ll mod = 1e9 + 7;

int main() {
    ll n, k;
    cin >> n >> k;
    ll ans = 1ll;
    for (ll i = k; i <= n; i++) {
        ll lb = i * (i - 1) / 2;
        ll rb = i * n - lb;
        if (lb > rb) break;
        ans += rb - lb + 1ll;
        ans %= mod;
    }
    cout << ans << endl;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;
long long n,k,ans,md=1e9+7;
int main()
{
	cin>>n>>k;
	for(long long i=k;i<=n+1;i++)
	{
		long long l=0,r=i-1,nw1,nw2;
		nw1=(l+r)*(r-l+1ll)/2ll;
		r=n;
		l=r-i+1ll;
		nw2=(l+r)*(r-l+1ll)/2ll;
		ans+=nw2-nw1+1;
		ans%=md;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define vvll vector <vll>
#define vsi vector <si>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
    freopen("a.in","r",stdin);
    #endif
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    for (ll i=k;i<=n+1;i++)
    {
        ll x=i*(i-1)/2;
        ll y=n*(n+1)/2-(n-i)*(n-i+1)/2;
        ans+=y-x+1;
        ans%=mod1;
      //  cout<<ans<<'\n';
    }
    cout<<ans;




}

Compiler output:
main.c:2:10: fatal error: bits/stdc++.h: No such file or directory
    2 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }
template<class T>
ostream &operator<<(ostream &os,const vector<T> &v){
	for(int i = 0;i < v.size();i++) os << (i ? "," : "[") << v[i];
	os << "]";
	return os;
}

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }

const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

template<long long mod = 1000000007>
struct modint{
	long long a;

	modint() : a(0){}
	modint(long long t){
		a = t % mod;
		if(a < 0) a += mod;
	}

	operator long long() const{ return a; }

	bool operator==(const modint &x) const{ return a == x.a; }
	bool operator!=(const modint &x) const{ return a != x.a; }

	modint operator-() const{ return modint(a ? (mod - a) : 0); }
	modint operator~() const{ return pow(mod - 2); }

	modint operator+(const modint &x) const{ return modint(*this) += x; }
	modint operator-(const modint &x) const{ return modint(*this) -= x; }
	modint operator*(const modint &x) const{ return modint(*this) *= x; }
	modint operator/(const modint &x) const{ return modint(*this) /= x; }

	modint &operator+=(const modint &x){
		a += x.a;
		if(a >= mod) a -= mod;
		return *this;
	}
	modint &operator-=(const modint &x){
		a -= x.a;
		if(a < 0) a += mod;
		return *this;
	}
	modint &operator*=(const modint &x){
		a = a * x.a % mod;
		return *this;
	}
	modint &operator/=(const modint &x){
		a = a * (~x).a % mod; 
		return *this;
	}

	friend ostream &operator<<(ostream &os,const modint &x){
		return os << x.a;
	}
	friend istream &operator>>(istream &is,modint &x){
		long long t;
		is >> t;
		x = modint(t);
		return is;
	}

	modint pow(long long x) const{
		modint ret = 1,tmp = a;
		for(;x;tmp *= tmp,x >>= 1){
			if(x & 1) ret *= tmp;
		}
		return ret;
	}
};

signed main(){
	int n,k;
	cin >> n >> k;
	modint<> ans = 0;
	for(int i = k;i <= n + 1;i++){
		ans += modint<>(n * 2 - i + 1) * modint<>(i) / modint<>(2);
		ans -= modint<>(i - 1) * modint<>(i) / modint<>(2);
		ans += 1;
	}
	cout << ans << endl;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////

int n,k,ans;
signed main(){
  cin>>n>>k;
  repd(i,k,n+2){
    int m = (i-1)*i%MOD*modinv(2)%MOD;
    int x = (2*n-i+1)*i%MOD*modinv(2)%MOD;
    add(ans,x-m+1);
  }
  cout << ans << endl;
}


Compiler output:
main.c:2:10: fatal error: bits/stdc++.h: No such file or directory
    2 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}

//combination(Nが小さい時はこれを使う)
const int MAX = 300000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
int COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

//繰り返し二乗法（Nが大きい時の場合のcombination)
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//UnionFind
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int dight_sum(int n) {
	int sum = 0;
	rep(i, 20)sum += (n % (int)pow(10, i + 1)) / (pow(10, i));
	return sum;
}
signed main() {
	int n, k;
	cin >> n >> k;
	int ans = 0;
	for (int i = k; i <= n; i++) {
		int p = i * (i - 1) / 2;
		int q = (2 * n - i + 1) * i / 2;
		ans += q - p + 1;
		ans %= mod;
	}
	cout << ans + 1 << endl;
	ggr
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    ll n,k;
    cin>>n>>k;
    ll ans = 0;
    ll mod = 1e9+7;
    for(ll i=k;i<=n+1;i++){
        ll ma = n*(n+1)/2LL - (n-i)*(n-i+1)/2LL;
        ma %= mod;
        ll mi = (i-1)*i/2LL;
        mi %= mod;
        ans += mod + ma - mi+1;
        ans %= mod;
       // cerr << i << " " << ma << " " << mi << endl;
    }
    cout << ans << endl;
    
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

const int N = 15;
const int M = 500;
const int MOD = 1e9 + 7;
const int alpha = 26;

int n, k;
ll ans = 0;

signed main()
{
    #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // ONLINE_JUDGE
    cin >> n >> k;
    for (int ch = k; ch <= n + 1; ch++)
    {
        ll mn = ch * (ch - 1) / 2;
        ll mx = (n + n - ch + 1) * ch / 2;
        ans = (ans + mx - mn + 1) % MOD;
    }
    cout << ans;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(in) in.begin(),in.end()
using ll = long long;
using namespace std;
 
void chmax(ll &a, ll b) { if (a < b) a = b; return; }
using pll = pair<ll,ll>;
 
int main() {
    int n; cin >> n;
    vector<pll> a(n); rep(i,n) cin >> a[i].first, a[i].second = i;
    sort(all(a),greater<pll>());
 
    vector<vector<ll>> dp(n+1,vector<ll>(n+1,0));
    rep(i,n) rep(j,n-i){
        chmax(dp[i+1][j], dp[i][j] + a[i+j].first * (a[i+j].second - i));
        chmax(dp[i][j+1], dp[i][j] + a[i+j].first * ((n-1-j) - a[i+j].second));
    }
    ll ans = 0;
    rep(i,n+1) chmax(ans, dp[i][n-i]);
    cout << ans << endl;
}
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(in) in.begin(),in.end()
using ll = long long;
using namespace std;

void chmax(ll &a, ll b) { if (a < b) a = b; return; }
using pll = pair<ll,ll>;

int main() {
    int n; cin >> n;
    vector<pll> a(n); rep(i,n) cin >> a[i].first, a[i].second = i;
    sort(all(a),greater<pll>());

    vector<vector<ll>> dp(n+1,vector<ll>(n+1,0));
    rep(i,n) rep(j,n-i){
        chmax(dp[i+1][j], dp[i][j] + a[i+j].first * abs(a[i+j].second - i));
        chmax(dp[i][j+1], dp[i][j] + a[i+j].first * abs((n-1-j) - a[i+j].second));
    }
    ll ans = 0;
    rep(i,n+1) chmax(ans, dp[i][n-i]);
    cout << ans << endl;
}


Compiler output:
a.cc:30:6: error: redefinition of 'void chmax(ll&, ll)'
   30 | void chmax(ll &a, ll b) { if (a < b) a = b; return; }
      |      ^~~~~
a.cc:7:6: note: 'void chmax(ll&, ll)' previously defined here
    7 | void chmax(ll &a, ll b) { if (a < b) a = b; return; }
      |      ^~~~~
a.cc:33:5: error: redefinition of 'int main()'
   33 | int main() {
      |     ^~~~
a.cc:10:5: note: 'int main()' previously defined here
   10 | int main() {
      |     ^~~~
Language: C++

#pragma GCC target("avx512")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<atcoder/mincostflow>

using namespace std;
using ll = long long;
inline int ri() { int n; cin >> n; return n;}
const ll INF = 1e14;

int main()
{
	int n; cin >> n;
	vector<ll> a(n);
	for(int i = 0; i < n; i++)cin >> a[i];
	atcoder::mcf_graph<int,ll> mf(2 * n + 2);
	int S = 2 * n, T = 2 * n + 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			mf.add_edge(i, j + n, 1, INF - a[i] * abs(i - j));
		}
		mf.add_edge(S, i, 1, 0);
		mf.add_edge(i + n, T, 1, 0);
	}

	auto flow = mf.flow(S, T, n);
	cout << INF * n - flow.second << '\n';

}

Compiler output:
cc1plus: error: attribute 'target' argument 'avx512' is unknown
a.cc:5:9: fatal error: atcoder/mincostflow: No such file or directory
    5 | #include<atcoder/mincostflow>
      |         ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n;
  cin>>n;
  long long a[n];
  REP(i, n) cin>>a[i];
  
  typedef pair<long long, int> P;
  vector<P> vec;
  REP(i, n) vec.push_back(P(a[i], i));
  sort(ALL(vec));
  
  vector<vector<long long>> dp(n + 1, vector<long long>(n + 1, -INF));
  dp[0][0] = 0;
  for(int s = 0; s < n; s++){
    for(int x = 0; x <= s; x++){
      int y = s - x;
      int i = vec[x + y].second;
      int p_i = x;
      dp[x + 1][y] = max(dp[x + 1][y], dp[x][y] + a[i] * (long long)(i - p_i));
      p_i = n - (y + 1);
      dp[x][y + 1] = max(dp[x][y + 1], dp[x][y] + a[i] * (long long)(p_i - i));
    }
  }
  long long ans = 0;
  REP(x, n + 1) REP(y, n + 1) if(i + j == n) ans = max(ans, dp[x][y]);
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:94:34: error: 'i' was not declared in this scope
   94 |   REP(x, n + 1) REP(y, n + 1) if(i + j == n) ans = max(ans, dp[x][y]);
      |                                  ^
a.cc:94:38: error: 'j' was not declared in this scope
   94 |   REP(x, n + 1) REP(y, n + 1) if(i + j == n) ans = max(ans, dp[x][y]);
      |                                      ^
Language: C

#include <stdio.h>
#include <stdlib.h>

typedef struct {
	int key, id;
} data;

void merge_sort(data x[], int n)
{
	static data y[2001] = {};
	if (n <= 1) return;
	merge_sort(&(x[0]), n/2);
	merge_sort(&(x[n/2]), (n+1)/2);
	
	int i, p, q;
	for (i = 0, p = 0, q = n/2; i < n; i++) {
		if (p >= n/2) y[i] = x[q++];
		else if (q >= n) y[i] = x[p++];
		else y[i] = (x[p].key < x[q].key)? x[p++]: x[q++];
	}
	for (i = 0; i < n; i++) x[i] = y[i];
}

void add_BIT(long long BIT[], int n, int i, int k)
{
	while (i <= n) {
		BIT[i] += k;
		i += (i & -i);
	}
}

long long sum_BIT(long long BIT[], int r)
{
	long long sum = 0;
	while (r > 0) {
		sum += BIT[r];
		r -= (r & -r);
	}
	return sum;
}

int N, A[2001], flag[2001] = {};
long long BIT[2][2001] = {};
data d[2001];

long long recursion(int k, int l, int r)
{
	if (l == r) return (long long)A[d[k].id] * abs(d[k].id - l);
	
	long long ans, tmp[2] = {(long long)A[d[k].id] * abs(d[k].id - l), (long long)A[d[k].id] * abs(d[k].id - r)};
	flag[d[k].id] = 1;
	add_BIT(BIT[0], N, d[k].id, -(d[k].key));
	add_BIT(BIT[1], N, N - d[k].id + 1, -(d[k].key));
	if (tmp[0] => tmp[1]) {
		ans = recursion(k - 1, l + 1, r) + tmp[0];
		if (tmp[0] - sum_BIT(BIT[1], N - d[k].id) <= tmp[1] - sum_BIT(BIT[0], d[k].id - 1)) {
			tmp[1] += recursion(k - 1, l, r - 1);
			if (tmp[1] > ans) ans = tmp[1];
		}
	} else {
		ans = recursion(k - 1, l, r - 1) + tmp[1];
		if (tmp[0] - sum_BIT(BIT[1], N - d[k].id) => tmp[1] - sum_BIT(BIT[0], d[k].id - 1)) {
			tmp[0] += recursion(k - 1, l + 1, r);
			if (tmp[0] > ans) ans = tmp[0];
		}
	}
	flag[d[k].id] = 0;
	add_BIT(BIT[0], N, d[k].id, d[k].key);
	add_BIT(BIT[1], N, N - d[k].id + 1, d[k].key);
	return ans;
}

int main()
{
	int i;
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(A[i]));
	for (i = 1; i <= N; i++) {
		add_BIT(BIT[0], N, i, A[i]);
		add_BIT(BIT[1], N, N - i + 1, A[i]);
	}
	for (i = 0; i < N; i++) {
		d[i].key = A[i+1];
		d[i].id = i + 1;
	}
	merge_sort(d, N);
	
	printf("%lld\n", recursion(N - 1, 1, N));
	fflush(stdout);
	return 0;
}

Compiler output:
main.c: In function 'recursion':
main.c:54:21: error: expected expression before '>' token
   54 |         if (tmp[0] => tmp[1]) {
      |                     ^
main.c:62:60: error: expected expression before '>' token
   62 |                 if (tmp[0] - sum_BIT(BIT[1], N - d[k].id) => tmp[1] - sum_BIT(BIT[0], d[k].id - 1)) {
      |                                                            ^
Language: C++

#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define pb push_back
#define csl ios_base::sync_with_stdio(false); cin.tie(NULL)
#define reps(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) for(int i=0;i<int(b);i++)
#define first ff
#define second ss
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
typedef vector<int> vi;
typedef pair<ll,ll> pll;
#define M 998244353
#define N 1000000007
 ll dp[2005][2005] = {};
int main()
{
    csl;
    ll n;
    cin >> n;
    pll a[n+1];
    reps(i,1,n+1)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    
    sort(a+1,a+n+1,greater<pll>());
    reps(i,1,n+1)
    {
        reps(j,0,i)
        {
            ll L = j;
            ll R = i-1-j;
            dp[L+1][R] = max(dp[L+1][R],dp[L][R] + abs(L+1-a[i].second)*a[i].first);
            
              R = j;
              L = i-1-j;
              dp[L][R+1] = max(dp[L][R+1],dp[L][R] + abs(n - R - a[i].S)*a[i].F);
        }
    }
    
    ll cnt = 0;
    rep(i,n+1)
    {
        cnt = max(cnt,dp[i][n-i]);
    }
    
    cout << cnt << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: 'pll' {aka 'struct std::pair<long long int, long long int>'} has no member named 'ff'
    8 | #define first ff
      |               ^~
a.cc:26:21: note: in expansion of macro 'first'
   26 |         cin >> a[i].first;
      |                     ^~~~~
a.cc:9:16: error: 'pll' {aka 'struct std::pair<long long int, long long int>'} has no member named 'ss'
    9 | #define second ss
      |                ^~
a.cc:27:14: note: in expansion of macro 'second'
   27 |         a[i].second = i;
      |              ^~~~~~
a.cc:9:16: error: 'pll' {aka 'struct std::pair<long long int, long long int>'} has no member named 'ss'
    9 | #define second ss
      |                ^~
a.cc:37:65: note: in expansion of macro 'second'
   37 |             dp[L+1][R] = max(dp[L+1][R],dp[L][R] + abs(L+1-a[i].second)*a[i].first);
      |                                                                 ^~~~~~
a.cc:8:15: error: 'pll' {aka 'struct std::pair<long long int, long long int>'} has no member named 'ff'
    8 | #define first ff
      |               ^~
a.cc:37:78: note: in expansion of macro 'first'
   37 |             dp[L+1][R] = max(dp[L+1][R],dp[L][R] + abs(L+1-a[i].second)*a[i].first);
      |                                                                              ^~~~~
a.cc:41:71: error: 'pll' {aka 'struct std::pair<long long int, long long int>'} has no member named 'S'
   41 |               dp[L][R+1] = max(dp[L][R+1],dp[L][R] + abs(n - R - a[i].S)*a[i].F);
      |                                                                       ^
a.cc:41:79: error: 'pll' {aka 'struct std::pair<long long int, long long int>'} has no member named 'F'
   41 |               dp[L][R+1] = max(dp[L][R+1],dp[L][R] + abs(n - R - a[i].S)*a[i].F);
      |                                                                               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"
#define fi first
#define se second

template<typename T>
void selfmax(T &a, T b){
    if(b>a) a=b;
}

int n;

int main(){
    //
    //freopen("input.txt", "r", stdin);
    //
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin>>n;
    vector<pair<int,int>> a(n);
    for (int i=0; i<n; ++i){
        cin>>a[i].first;
        a[i].second=i;
    }
    vector<vector<ll>> dp(n+1, vector<ll>(n+1, -1));
    dp[0][0]=0;
    sort(a.begin(), a.end(), greater<>());
    for (int i=0; i<n; ++i){
        int val = a[i].fi;
        for (int j=0; j<=i; ++j){
            ll leftDist = abs(a[i].se-j); 
            ll rightDist = abs(n-1-a[i].se-(i-j));
            ll leftScore = 1LL*val*leftDist;
            ll rightScore = 1LL*val*RightDist;
            selfmax(dp[i+1][j], dp[i][j] + rightScore);
            selfmax(dp[i+1][j+1], dp[i][j] + leftScore);
        }
    }
    ll ans = 0;
    for (int i=0; i<=n; ++i){
        selfmax(ans, dp[n][i]);
    }
    cout<<ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:37: error: 'RightDist' was not declared in this scope; did you mean 'rightDist'?
   39 |             ll rightScore = 1LL*val*RightDist;
      |                                     ^~~~~~~~~
      |                                     rightDist
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

long long main() {

    size_t N;
    cin >> N;
    vector<pair<long long, long long>> a(N + 1);
    vector<vector<long long>> dp(N + 1, vector<long long>(N + 1, 0));
    for (size_t i = 1; i <= N; ++i) {
        cin >> a[i].first;
        a[i].second = (long long)i;
    }
    sort(a.begin() + 1, a.end(), greater<pair<long long, long long>>());
    for (size_t i = 1; i <= N; ++i) {
        for (size_t j = 0; j < i; ++j) {
            auto l = j;
            auto r = i - 1 - j;
            dp[l + 1][r] = max(dp[l + 1][r], dp[l][r] + a[i].first * abs((long long)l + 1 - a[i].second));
            dp[r][l + 1] = max(dp[r][l + 1], dp[r][l] + a[i].first * abs((long long)N - (long long)l - a[i].second));
        }
    }
    long long res = 0;
    for (size_t i = 1; i <= N; ++i) {
        res = max(res, dp[i][N - i]);
    }
    cout << res;
    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
const int N = 200005;
vector<pair<int, int> > v;
int memo[2000][2000];
ll solve(int *arr, int i, int l, int r) {
if (l == r) {
return v[i].first * (v[i].second - l);
}
if (memo[i][l] != -1) {
return memo[i][l];
}
int temp = n-1-(index-l);
ll ans1 = solve(arr, i + 1, l + 1, temp) + (v[i].first * abs(v[i].second - l));
ll ans2 = solve(arr, i + 1, l, temp - 1) + (v[i].first * abs(v[i].second - temp));
return memo[i][l] = max(ans1, ans2);
 
}
 
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
 
int n;
cin >> n;
int arr[2005];
for (int i = 0; i < n; i++)
cin >> arr[i];
for (int i = 0; i < n; i++) {
v.push_back({arr[i], i});
}
memset(memo, -1, sizeof memo);
sort(v.begin(), v.end());
reverse(v.begin(), v.end());
// for (int i = 0; i < n; i++) {
// cout << v[i].first << " " << v[i].second << endl;
// }
cout << solve(arr, 0, 0, n - 1);
return 0;
 
}

Compiler output:
a.cc: In function 'long long int solve(int*, int, int, int)':
a.cc:15:12: error: 'n' was not declared in this scope
   15 | int temp = n-1-(index-l);
      |            ^
a.cc:15:22: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   15 | int temp = n-1-(index-l);
      |                 ~~~~~^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
vector<pair<int64_t,int64_t>>A(N);
  for(int64_t i=0;i<N;i++){
  int64_t a; cin>>a;
    pair<int64_t,int64_t>p(a,i);
    A.at(i)=p;
  
  }sort(A.begin(),A.end());
  int64_t dp[N][N];
  for(int64_t j=0;j<N;j++)
    dp[0][j]=A[0].first*abs(j-A[0].second);
  for(int64_t i=1;i<N;i++){
  for(int64_t j=0;j<N-i;j++){
  dp[i][j]=
    max(dp[i-1][j]+A[i].first*abs(A[i].second-i-j),A[i].first*abs(A[i].second-j)+dp[i-1][j+1])
  
  }
  
  }cout<<dp[N-1][0]<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:95: error: expected ';' before '}' token
   19 |     max(dp[i-1][j]+A[i].first*abs(A[i].second-i-j),A[i].first*abs(A[i].second-j)+dp[i-1][j+1])
      |                                                                                               ^
      |                                                                                               ;
   20 | 
   21 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
vector<pair<int64_t,int64_t>>A(N);
  for(int64_t i=0;i<N;i++){
  int64_t a; cin>>a;
    pair<int64_t,int64_t>p(a,i);
    A.at(i)=p;
  
  }sort(A.begin(),A.end());
  int64_t dp[N][N];
  for(int64_t j=0;j<N;j++)
    dp[0][j]=A[0].first*abs(j-A[0].second);
  for(int 64_t i=1;i<N;i++){
  for(int64_t j=0;j<N-i;j++){
  dp[i][j]=
    max(dp[i-1][j]+A[i].first*abs(A[i].second-i-j),A[i].first*abs(A[i].second-j)+dp[i-1][j+1])
  
  }
  
  }cout<<dp[N-1][0]<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:11: error: expected unqualified-id before numeric constant
   16 |   for(int 64_t i=1;i<N;i++){
      |           ^~~~
a.cc:16:10: error: expected ';' before numeric constant
   16 |   for(int 64_t i=1;i<N;i++){
      |          ^~~~~
      |          ;
a.cc:16:11: error: unable to find numeric literal operator 'operator""_t'
   16 |   for(int 64_t i=1;i<N;i++){
      |           ^~~~
a.cc:16:15: error: expected ';' before 'i'
   16 |   for(int 64_t i=1;i<N;i++){
      |               ^~
      |               ;
a.cc:16:16: error: 'i' was not declared in this scope
   16 |   for(int 64_t i=1;i<N;i++){
      |                ^
a.cc:16:19: error: expected ')' before ';' token
   16 |   for(int 64_t i=1;i<N;i++){
      |      ~            ^
      |                   )
a.cc:16:20: error: 'i' was not declared in this scope
   16 |   for(int 64_t i=1;i<N;i++){
      |                    ^
Language: C++

#include<iostream>
using namespace std;
long long n;
long long dp[2005][2005];
long long second;
long long first;
struct node{
	int rt;
	int num;
}a[5005];
bool cmp(node a,node b){
	return a.num>b.num;
}
int work(int now,int l,int r){
	if(l>r) return a[now].num;
	if(dp[l][r]!=-1) return dp[l][r];
	first=work(now+1,l+1,r)+a[now].num*abs(a[now].rt-l);
	second=work(now+1,l,r-1)+a[now].num*abs(a[now].rt-r);
	dp[l][r]=max(dp[l][r],max(first,second));	
	return dp[l][r];
}
int read(){
	int sum=0;
	int flag=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch){
		if(ch=='-') flag=-1;
		ch=getchar();
	}
	while('0'<=ch&&ch<='9'){
		sum*=10;
		sum+=(ch-'0');
		ch=getchar();
	}
	return sum*flag;
}
int main(){
	n=read();
	memset(dp,-1,sizeof(dp));
	for(int i=1;i<=n;i++){
		a[i].num=read();
		a[i].rt=i;
	}
	sort(a+1,a+n+1,cmp);
	cout<<work(1,1,n)/2*2<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:9: error: 'memset' was not declared in this scope
   39 |         memset(dp,-1,sizeof(dp));
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc:44:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   44 |         sort(a+1,a+n+1,cmp);
      |         ^~~~
      |         short
Language: C++

#include <iostream>
#include <deque>

#include <algorithm>

using namespace std;

int main(){
  int N;
  long A[2001];
  
  cin >> N;
  for(int i=1;i<=N;i++){
  	cin >> A[i];  
  }
  
  int person[2001] = {0};
  int pos[2001] = {0};
  
  deque<pair<long,pair<int,int>>> score;
  
  for(int i=1; i<=N; i++){
  	for(int pos=1; pos<=N; pos++){
		score.push_back(make_pair(A[i]*abs(i-pos),make_pair(i,pos)));
    }
  }
  sort(score.begin(),score.end());
  
  long sum = 0;
  int count = 0;
  for(auto itr = score.end()-1; count<20; itr-- ){
    if(person[*itr.second.first]==0&&pos[*itr.second.second]==0){
      person[*itr.second.first]=1;
      pos[*itr.second.second]=1;
      sum+=*itr.first;
      count++;
    }
  }
  cout << sum << endl;
  return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:20: error: 'struct std::_Deque_iterator<std::pair<long int, std::pair<int, int> >, std::pair<long int, std::pair<int, int> >&, std::pair<long int, std::pair<int, int> >*>' has no member named 'second'
   32 |     if(person[*itr.second.first]==0&&pos[*itr.second.second]==0){
      |                    ^~~~~~
a.cc:32:47: error: 'struct std::_Deque_iterator<std::pair<long int, std::pair<int, int> >, std::pair<long int, std::pair<int, int> >&, std::pair<long int, std::pair<int, int> >*>' has no member named 'second'
   32 |     if(person[*itr.second.first]==0&&pos[*itr.second.second]==0){
      |                                               ^~~~~~
a.cc:33:19: error: 'struct std::_Deque_iterator<std::pair<long int, std::pair<int, int> >, std::pair<long int, std::pair<int, int> >&, std::pair<long int, std::pair<int, int> >*>' has no member named 'second'
   33 |       person[*itr.second.first]=1;
      |                   ^~~~~~
a.cc:34:16: error: 'struct std::_Deque_iterator<std::pair<long int, std::pair<int, int> >, std::pair<long int, std::pair<int, int> >&, std::pair<long int, std::pair<int, int> >*>' has no member named 'second'
   34 |       pos[*itr.second.second]=1;
      |                ^~~~~~
a.cc:35:17: error: 'struct std::_Deque_iterator<std::pair<long int, std::pair<int, int> >, std::pair<long int, std::pair<int, int> >&, std::pair<long int, std::pair<int, int> >*>' has no member named 'first'; did you mean '_M_first'?
   35 |       sum+=*itr.first;
      |                 ^~~~~
      |                 _M_first
Language: C++

#include <iostream>
#include <deque>

#include <algorithm>

using namespace std;

int main(){
  int N;
  long A[2001];
  
  cin >> N;
  for(int i=1;i<=N;i++){
  	cin >> A[i];  
  }
  
  int person[2001] = {0};
  int pos[2001] = {0};
  
  deque<pair<long,pair<int,int>>> score;
  
  for(int i=1; i<=N; i++){
  	for(int pos=1; pos<=N; pos++){
		score.push_back(make_pair(A[i]*abs(i-pos),make_pair(i,pos)));
    }
  }
  sort(score.begin(),score.end());
  
  long sum = 0;
  
  for(auto itr = score.end()-1,count = 0; count<20; itr-- ){
    if(person[*itr.second.first]==0&&pos[*itr.second.second]==0){
      person[*itr.second.first]=1;
      pos[*itr.second.second]=1;
      sum+=*itr.first;
      count++;
    }
  }
  cout << sum << endl;
  return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:7: error: inconsistent deduction for 'auto': 'std::_Deque_iterator<std::pair<long int, std::pair<int, int> >, std::pair<long int, std::pair<int, int> >&, std::pair<long int, std::pair<int, int> >*>' and then 'int'
   31 |   for(auto itr = score.end()-1,count = 0; count<20; itr-- ){
      |       ^~~~
a.cc:32:20: error: 'struct std::_Deque_iterator<std::pair<long int, std::pair<int, int> >, std::pair<long int, std::pair<int, int> >&, std::pair<long int, std::pair<int, int> >*>' has no member named 'second'
   32 |     if(person[*itr.second.first]==0&&pos[*itr.second.second]==0){
      |                    ^~~~~~
a.cc:32:47: error: 'struct std::_Deque_iterator<std::pair<long int, std::pair<int, int> >, std::pair<long int, std::pair<int, int> >&, std::pair<long int, std::pair<int, int> >*>' has no member named 'second'
   32 |     if(person[*itr.second.first]==0&&pos[*itr.second.second]==0){
      |                                               ^~~~~~
a.cc:33:19: error: 'struct std::_Deque_iterator<std::pair<long int, std::pair<int, int> >, std::pair<long int, std::pair<int, int> >&, std::pair<long int, std::pair<int, int> >*>' has no member named 'second'
   33 |       person[*itr.second.first]=1;
      |                   ^~~~~~
a.cc:34:16: error: 'struct std::_Deque_iterator<std::pair<long int, std::pair<int, int> >, std::pair<long int, std::pair<int, int> >&, std::pair<long int, std::pair<int, int> >*>' has no member named 'second'
   34 |       pos[*itr.second.second]=1;
      |                ^~~~~~
a.cc:35:17: error: 'struct std::_Deque_iterator<std::pair<long int, std::pair<int, int> >, std::pair<long int, std::pair<int, int> >&, std::pair<long int, std::pair<int, int> >*>' has no member named 'first'; did you mean '_M_first'?
   35 |       sum+=*itr.first;
      |                 ^~~~~
      |                 _M_first