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

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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 (b<a) { a=b; return 1; } return 0; }

int N,Q,S,T,X,D;
int isOK[9000000000];
set<int> s;

int main(){
    cin>>N>>Q;
    rep(i,N){
        cin>>S>>T>>X;
        if(isOK[max(0,S-X)]==0)isOK[max(0,S-X)]=X;
        else isOK[max(0,S-X)]=min(isOK[max(0,S-X)],X);
        if(isOK[max(0,T-X-1)]==0)isOK[max(0,T-1-X)]=X;
        else isOK[max(0,T-X-1)]=min(isOK[max(0,T-1-X)],X);
        s.insert(max(0,S-X));
        s.insert(max(0,T-X-1));
    }
    rep(i,Q){
        cin>>D;
        if(isOK[D]!=0)out(isOK[D]);
        else{
            auto left = s.lower_bound(D);
            auto right = s.upper_bound(D);
            left--;
            if(isOK[*left]==isOK[*right])out(isOK[*left]);
            else out(-1);
        }
    }
    
}


Compiler output:
/tmp/cc1ks8eZ.o: in function `main':
a.cc:(.text+0x31b): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/cc1ks8eZ.o
a.cc:(.text+0x35b): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/cc1ks8eZ.o
a.cc:(.text+0x40c): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/cc1ks8eZ.o
a.cc:(.text+0x429): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/cc1ks8eZ.o
/tmp/cc1ks8eZ.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x529): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/cc1ks8eZ.o
a.cc:(.text+0x542): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/cc1ks8eZ.o
collect2: error: ld returned 1 exit status
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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 (b<a) { a=b; return 1; } return 0; }

int N,Q,S,T,X,D;
int isOK[1000000010];
set<int> s;

int main(){
    cin>>N>>Q;
    rep(i,N){
        cin>>S>>T>>X;
        if(isOK[max(0,S-X)]==0)isOK[max(0,S-X)]=X;
        else isOK[max(0,S-X)]=min(isOK[max(0,S-X)],X);
        if(isOK[max(0,T-X-1)]==0)isOK[max(0,T-1-X)]=X;
        else isOK[max(0,T-X-1)]=min(isOK[max(0,T-1-X)],X);
        s.insert(max(0,S-X));
        s.insert(max(0,T-X-1));
    }
    rep(i,Q){
        cin>>D;
        if(isOK[D]!=0)out(isOK[D]);
        else{
            auto left = s.lower_bound(D);
            auto right = s.upper_bound(D);
            left--;
            if(isOK[*left]==isOK[*right])out(isOK[*left]);
            else out(-1);
        }
    }
    
}


Compiler output:
/tmp/ccOmH36d.o: in function `main':
a.cc:(.text+0x31b): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccOmH36d.o
a.cc:(.text+0x35b): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccOmH36d.o
a.cc:(.text+0x40c): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccOmH36d.o
a.cc:(.text+0x429): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccOmH36d.o
/tmp/ccOmH36d.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x529): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccOmH36d.o
a.cc:(.text+0x542): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccOmH36d.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
//#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

const int INF = INT_MAX;
struct LazySegmentTree {
private:
	int n;
	vector<int> node, lazy;
	vector<bool> lazyFlag;

public:
	LazySegmentTree(vector<int> v) {
		int sz = (int)v.size();
		n = 1; while (n < sz) n *= 2;
		node.resize(2 * n - 1);
		lazy.resize(2 * n - 1, INF);
		lazyFlag.resize(2 * n - 1, false);

		for (int i = 0; i < sz; i++) node[i + n - 1] = v[i];
		for (int i = n - 2; i >= 0; i--) node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
	}

	void lazyEvaluate(int k, int l, int r) {
		if (lazyFlag[k]) {
			if (node[k] > lazy[k])node[k] = lazy[k];
			if (r - l > 1) {
				lazy[k * 2 + 1] = lazy[k * 2 + 2] = lazy[k];
				lazyFlag[k * 2 + 1] = lazyFlag[k * 2 + 2] = true;
			}
			lazyFlag[k] = false;
		}
	}

	void update(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		lazyEvaluate(k, l, r);
		if (b <= l || r <= a) return;
		if (a <= l && r <= b) {
			if(lazy[k] > x) lazy[k] = x;
			lazyFlag[k] = true;
			lazyEvaluate(k, l, r);
		}
		else {
			update(a, b, x, 2 * k + 1, l, (l + r) / 2);
			update(a, b, x, 2 * k + 2, (l + r) / 2, r);
			node[k] = min(node[2 * k + 1], node[2 * k + 2]);
		}
	}

	int find(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		lazyEvaluate(k, l, r);
		if (b <= l || r <= a) return INF;
		if (a <= l && r <= b) return node[k];
		int vl = find(a, b, 2 * k + 1, l, (l + r) / 2);
		int vr = find(a, b, 2 * k + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
};

ll n, q, que[210000], now, dist[210000];
vector<P> s;
map<ll, ll> z;
int main() {
	cin >> n >> q; 
	LazySegmentTree seg(vector<int>(710000, INF));
	REP(i, n) {
		ll a, b, c;
		cin >> a >> b >> c;
		a -= c;
		b -= c + 1;
		s.push_back(P(a, b));
		z[a] = -1;
		z[b] = -1;
		dist[i] = c;
	}
	REP(i, q) {
		cin >> que[i];
		z[que[i]] = -1;
	}
	for (auto& i : z) {
		i.second = now;
		now++;
	}
	REP(i, n) {
		seg.update(z[s[i].first], z[s[i].second] + 1, dist[i]);
	}
	REP(i, q) {
		ll ans = seg.find(z[que[i]], z[que[i]] + 1);
		if (ans == INF)cout << -1 << endl;
		else cout << ans << endl;
	}
}

Compiler output:
a.cc:28:17: error: 'INT_MAX' was not declared in this scope
   28 | const int INF = INT_MAX;
      |                 ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include <iomanip>
  +++ |+#include <climits>
   13 |
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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 (b<a) { a=b; return 1; } return 0; }

int N,Q,S,T,X,D;
int isOK[1000000010];
set<int> s;

int main(){
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
    cin>>N>>Q;
    rep(i,N){
        cin>>S>>T>>X;
        if(isOK[max(0,S-X)]==0)isOK[max(0,S-X)]=X;
        else isOK[max(0,S-X)]=min(isOK[max(0,S-X)],X);
        if(isOK[max(0,T-X-1)]==0)isOK[max(0,T-1-X)]=X;
        else isOK[max(0,T-X-1)]=min(isOK[max(0,T-1-X)],X);
        s.insert(max(0,S-X));
        s.insert(max(0,T-X-1));
    }
    rep(i,Q){
        cin>>D;
        if(isOK[D]!=0)out(isOK[D]);
        else{
            auto left = s.lower_bound(D);
            auto right = s.upper_bound(D);
            left--;
            if(isOK[*left]==isOK[*right])out(isOK[*left]);
            else out(-1);
        }
    }
    
}


Compiler output:
/tmp/ccxUFbxx.o: in function `main':
a.cc:(.text+0x35d): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccxUFbxx.o
a.cc:(.text+0x39d): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccxUFbxx.o
a.cc:(.text+0x44e): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccxUFbxx.o
a.cc:(.text+0x46e): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccxUFbxx.o
/tmp/ccxUFbxx.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x5ab): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccxUFbxx.o
a.cc:(.text+0x5c4): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccxUFbxx.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>

using namespace std;

#define ALL(V) (V).begin(),(V).end()

struct st_t {
    int s, t, x;
};

int main() {
    double sq2 = sqrt(2.0);
    int n, q;
    cin >> n >> q;
    vector<st_t> st(n);
    for (int i=0;i<n;i++) {
        cin >> st[i].s >> st[i].t >> st[i].x;
    }
    vector<int> d(q);
    vector<int> da(q, INT_MAX);
    vector<double> de(q);
    for (int i=0;i<q;i++){
        cin >> d[i];
        de[q-1-i] = - d[i] / sq2;
    }
    complex<double> ang = polar(1.0, -M_PI/4.0);
    for (int i=0;i<n;i++) {
        complex<double> sp(st[i].s, st[i].x);
        complex<double> tp(st[i].t, st[i].x);
        sp *= ang;
        tp *= ang;

        vector<double>::iterator it;
        it = lower_bound(ALL(de),tp.imag());
        for (;it != de.end(); it++) {
            if ( sp.imag() < *it ) break;
            int rindex = it - de.begin();
            int index = q - 1 - rindex;
            da[index] = min(da[index], st[i].x);
        }
    }
    for (int i=0;i<q;i++) {
        if (da[i] == INT_MAX) {
        cout << -1 << endl;
        } else {
            cout << da[i] << endl;
        }
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:23: error: 'INT_MAX' was not declared in this scope
   32 |     vector<int> da(q, INT_MAX);
      |                       ^~~~~~~
a.cc:14:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   13 | #include <complex>
  +++ |+#include <climits>
   14 |
Language: C++

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pi = pair<int, int>;
template <typename T>
using Pq = priority_queue<T>;
template <typename T>
using pQ = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
vector<T> make_vec(size_t a, T n) { return vector<T>(a, n); }
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
vector<T> divisor(T &n) {
    vector<T> res;
    for (T i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i * i != n) {
                res.push_back(n / i);
            }
        }
    }
    return res;
}

int main() {
    INIT;
    cin >> N;
    vi a(N);
    vi dp(N, -INF);
    dp[N - 1] = 0;
    cin >> a;
    RREP(i, N) {
        if (i == 0)
            continue;
        int tmp = N - 1 - i;
        auto v = divisor(tmp);
        REP(j, v.size()) {
            if (i % v[j] == 0 && tmp <= i)
                continue;
            dp[i] = dp[i + v[j]] + a[i] + a[tmp];
        }
    }
    cout << *max_element(ALL(dp)) << endl;
}

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

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int INF=1e18;
const int MOD=1e9+7;

signed main(){
    int n;cin>>n;
    int s[n];
    REP(i,n)cin>>s[i];
    map<pair<int,int>,int>f;
    map<int,bool>used;
    //f{k,a-b=c}の形にする
    //f{1,1....n-2}を求めよう
    //
    REPS(c,n-2){
        if(n-1-c==c)continue;
        used.clear();
        f[{1,c}]=s[n-1-c]+s[c];
        used[n-1-c]=used[c]=true;
        for(int k=2;k*c<n-1;k++){
            if(n-1-k*c==k*c)break;
            if(used[n-1-k*c] or used[k*c])break;
            f[{k,c}]=f[{k-1,c}]+s[n-1-k*c]+s[k*c];
            used[n-1-k*c]=used[k*c]=true;
        }
    }
    int ans==-INF;
    for(auto v:f)chmax(ans,v.second);
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:12: error: expected initializer before '==' token
   53 |     int ans==-INF;
      |            ^~
a.cc:54:24: error: 'ans' was not declared in this scope; did you mean 'abs'?
   54 |     for(auto v:f)chmax(ans,v.second);
      |                        ^~~
      |                        abs
a.cc:55:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   55 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: C++

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

int main() {
  ll n;
  cin>>n;
  vector<ll> s(n);
  rep(i,n){
    cin>>s[i];
  }
  ll ans=0;
  //直接飛ぶとき０
  for(ll c=1;c<=n-3;c++){
    ll k=1;
    bool ok=true;
    ll anst=0;
    vector<ll> used(n);
    while(n-1-c*k>=c){

    //  if (used[c*k])break;
    //  if (used[n-1-c*k])break;
      if (c*k==n-1-c*k)break;
      anst+=s[c*k]+s[n-1-c*k];
      used[c*k]=1;used[n-1-c*k]=1;
    //  cout<<anst<<endl;
      ans=max(ans,anst);
      k++;
    }
  }
  cout<<ans;
}

}


Compiler output:
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
Language: C++

#include<bits\stdc++.h>
using namespace std;
#define ll long long
int N;
ll s[100010];
ll ans;

int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> s[i];
    }

    for(int C = 1; C < N; C++){
        ll score = 0;
        set<int> coor;
        for(int k = 1; k * C < N; k++){
            if(N - 1 - k * C < C) break;
            int y1 = N - 1 - k * C; 
            int y2 = k * C;
            if(coor.find(y1) != coor.end() || coor.find(y2) != coor.end() || y1 == y2) break;

            coor.insert(y1);
            coor.insert(y2);
            score += s[y1] + s[y2];
            ans = max(ans, score);
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc:1:9: 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;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

int N;
int S[111111];

signed main(){
	cin>>N;
	rep(i,N)cin>>S[i];

	int ans=0;
	for(int D=1;D<N;D++){
		if((N-1)%D==0){
			int s=0;
			for(int j=1;j*D<N-1-j*D;j++){
				s+=S[j*D]+S[N-1-j*D];
				chmax(ans,s);
			}
		}
		else{
			int s=0;
			for(int j=1;j*D<N&&N-1-j*D>;j++){

				s+=S[j*D]+S[N-1-j*D];
				chmax(ans,s);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:52: error: expected primary-expression before ';' token
   56 |                         for(int j=1;j*D<N&&N-1-j*D>;j++){
      |                                                    ^
Language: C++

#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(ll i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define db(x) cout<<#x<<"="<<x<<endl
#define deb(x) each(x.begin(),x.end(),(int& y){cout << y <<" ";})
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define j1 j1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

//const int MAXN=100010;
//ll dp[MAXN][MAXN];

void Main(){

  ll N;cin>>N;

  vector<ll> dp[100010];

  ll s[N];
  rep(i,N){
    cin>>s[i];
  }

  rep(c,N){ // c, k
    dp[c].emplace_back(0);
  }

  ll ans=0;

  int nidome[N]={};

  reps(c,1,N){
    for(ll k=1;k*c<N-1;k++){
      dp[c].emplace_back(dp[c][k-1]+s[N-1-k*c]+s[k*c]);
      if(maxi(nidome[N-1-k*c],c)==0 or maxi(nidome[k*c],c)==0){
        continue;
      }
      maxi(ans,dp[c][k]);
    }
  }

  cout<< ans<<"\n";
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Compiler output:
a.cc: In function 'void Main()':
a.cc:45:14: error: no matching function for call to 'maxi(int&, ll&)'
   45 |       if(maxi(nidome[N-1-k*c],c)==0 or maxi(nidome[k*c],c)==0){
      |          ~~~~^~~~~~~~~~~~~~~~~~~
a.cc:9:23: note: candidate: 'template<class T> bool maxi(T&, const T&)'
    9 | template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
      |                       ^~~~
a.cc:9:23: note:   template argument deduction/substitution failed:
a.cc:45:14: note:   deduced conflicting types for parameter 'const T' ('int' and 'll' {aka 'long long int'})
   45 |       if(maxi(nidome[N-1-k*c],c)==0 or maxi(nidome[k*c],c)==0){
      |          ~~~~^~~~~~~~~~~~~~~~~~~
a.cc:45:44: error: no matching function for call to 'maxi(int&, ll&)'
   45 |       if(maxi(nidome[N-1-k*c],c)==0 or maxi(nidome[k*c],c)==0){
      |                                        ~~~~^~~~~~~~~~~~~~~
a.cc:9:23: note: candidate: 'template<class T> bool maxi(T&, const T&)'
    9 | template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
      |                       ^~~~
a.cc:9:23: note:   template argument deduction/substitution failed:
a.cc:45:44: note:   deduced conflicting types for parameter 'const T' ('int' and 'll' {aka 'long long int'})
   45 |       if(maxi(nidome[N-1-k*c],c)==0 or maxi(nidome[k*c],c)==0){
      |                                        ~~~~^~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#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()
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    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;
}

int main(){
  
  int n;
  cin>>n;
  long long s[n];
  REP(i,n){
    cin>>s[i];
  }
  
  long long ans = 0;
  //cはa-bとする
  for(int c = 1; c<=n-2; c++)
    long long score = 0;
    bool visited[n] = {};
    int x = 0;
    while(x*c < n){
      int a = n - 1 - x*c;
      int b = a - c;
      if(b <= 0)break;
      if(visited[x*c])break;
      if(visited[n-1-x*c])break;
      visited[x*c] = true;
      visited[n-1-x*c] = true;
      score += s[x*c];
      score += s[n-1-x*c];
      ans = max(ans, score);
      x++;
    }
  }
  
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:13: error: 'c' was not declared in this scope
   61 |     while(x*c < n){
      |             ^
a.cc:69:7: error: 'score' was not declared in this scope
   69 |       score += s[x*c];
      |       ^~~~~
a.cc: At global scope:
a.cc:76:3: error: 'cout' does not name a type
   76 |   cout<<ans<<endl;
      |   ^~~~
a.cc:77:3: error: expected unqualified-id before 'return'
   77 |   return 0;
      |   ^~~~~~
a.cc:78:1: error: expected declaration before '}' token
   78 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#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()
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    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;
}

int main(){
  
  int n;
  cin>>n;
  long long s[n];
  REP(i,n){
    cin>>s[i];
  }
  
  long long ans = 0;
  //cはa-bとする
  REPP(c,n-1){
    long long score = 0;
    bool visited[n] = {};
    while(x*c < n){
      int a = n - 1 - x*c;
      int b = a - c;
      if(b <= 0)break;
      if(visited[x*c])break;
      if(visited[n-1-x*c])break;
      visited[x*c] = true;
      visited[n-1-x*c] = true;
      score += s[x*c];
      score += s[n-1-x*c];
      ans = max(ans, score);
      x++;
    }
  }
  
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:11: error: 'x' was not declared in this scope
   60 |     while(x*c < n){
      |           ^
Language: C++

#include <bits/stdc++.h>
#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()
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    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;
}

int main(){
  
  int n;
  cin>>n;
  long long s[n];
  REP(i,n){
    cin>>s[i];
  }
  
  long long ans = 0;
  //cはa-bとする
  REPP(c,n-1){
    long long score = 0
    bool visited[n] = {};
    while(x*c < n){
      int a = n - 1 - x*c;
      int b = a - c;
      if(b <= 0)break;
      if(visited[x*c])break;
      if(visited[n-1-x*c])break;
      visited[x*c] = true;
      visited[n-1-x*c] = true;
      score += s[x*c];
      score += s[n-1-x*c];
      ans = max(ans, score);
      x++;
    }
  }
  
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:5: error: expected ',' or ';' before 'bool'
   59 |     bool visited[n] = {};
      |     ^~~~
a.cc:60:11: error: 'x' was not declared in this scope
   60 |     while(x*c < n){
      |           ^
a.cc:64:10: error: 'visited' was not declared in this scope
   64 |       if(visited[x*c])break;
      |          ^~~~~~~
a.cc:65:10: error: 'visited' was not declared in this scope
   65 |       if(visited[n-1-x*c])break;
      |          ^~~~~~~
a.cc:66:7: error: 'visited' was not declared in this scope
   66 |       visited[x*c] = true;
      |       ^~~~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int N;
long s[101010];
bool used[101010];

int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) cin >> s[i];

	if (N > 10000) {
		cout << -1 << endl;
		return 0;
	}
	
	long ans = 0;
	for (int B = 1; B < N; ++B) {
		for (int A = B + 1; A < N; ++A) {
			memset(used, 0, N);

			long tmp = 0, pos = 0;
			while (true) {
				pos += A;
				if (pos >= N || used[pos]) break;
				else tmp += s[pos], used[pos] = true;

				if (pos == N - 1) { ans = max(ans, tmp); break; }

				pos -= B;
				if (pos < 0 || used[pos]) break;
				else tmp += s[pos], used[pos] = true;
			}
		}
	}

	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: 'memset' was not declared in this scope
   22 |                         memset(used, 0, N);
      |                         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 |
Language: C++

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

int main() {
    int N; cin >> N;
    vector<ll> a(N);
    for(int i = 0; i < N; ++i) cin >> a[i];
    ll ans = 0;
    for(int i = 1; i < N; ++i) {
        int l = 0,r = N-1;
        ll suml = 0, sumr = 0;
        map<int,int> mp;
        mp[0] = mp[N-1] = 1;
        while(l < N-1 - i && i < r && mp[l]==1 && mp[r]==1) {
            suml += a[l];
            sumr += a[r];
            chmax(ans,suml+sumr);
            l += i;
            r -= i;
            mp[l]++;
            mp[r]++;
        }
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: 'chmax' was not declared in this scope
   18 |             chmax(ans,suml+sumr);
      |             ^~~~~
Language: C++

int N;
ll S[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) cin>>S[i];
	ll ret=0;
	for(int D=1;D<=N-1;D++) {
		
		ll sum=0;
		int L=0,R=N-1;
		if((N-1)%D==0) {
			while(L<R) {
				sum+=S[L]+S[R];
				ret=max(ret,sum);
				L+=D;
				R-=D;
			}
		}
		else {
			while(L+D<N-1) {
				sum+=S[L]+S[R];
				ret=max(ret,sum);
				L+=D;
				R-=D;
			}
			
		}
		
	}
	
	cout<<ret<<endl;
}

Compiler output:
a.cc:2:1: error: 'll' does not name a type
    2 | ll S[101010];
      | ^~
a.cc: In function 'void solve()':
a.cc:5:28: error: 'string' was not declared in this scope
    5 |         int i,j,k,l,r,x,y; string s;
      |                            ^~~~~~
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin>>N;
      |         ^~~
a.cc:8:9: error: 'FOR' was not declared in this scope
    8 |         FOR(i,N) cin>>S[i];
      |         ^~~
a.cc:9:9: error: 'll' was not declared in this scope; did you mean 'l'?
    9 |         ll ret=0;
      |         ^~
      |         l
a.cc:12:19: error: expected ';' before 'sum'
   12 |                 ll sum=0;
      |                   ^~~~
      |                   ;
a.cc:16:33: error: 'sum' was not declared in this scope
   16 |                                 sum+=S[L]+S[R];
      |                                 ^~~
a.cc:16:38: error: 'S' was not declared in this scope
   16 |                                 sum+=S[L]+S[R];
      |                                      ^
a.cc:17:33: error: 'ret' was not declared in this scope
   17 |                                 ret=max(ret,sum);
      |                                 ^~~
a.cc:17:37: error: 'max' was not declared in this scope
   17 |                                 ret=max(ret,sum);
      |                                     ^~~
a.cc:24:33: error: 'sum' was not declared in this scope
   24 |                                 sum+=S[L]+S[R];
      |                                 ^~~
a.cc:24:38: error: 'S' was not declared in this scope
   24 |                                 sum+=S[L]+S[R];
      |                                      ^
a.cc:25:33: error: 'ret' was not declared in this scope
   25 |                                 ret=max(ret,sum);
      |                                 ^~~
a.cc:25:37: error: 'max' was not declared in this scope
   25 |                                 ret=max(ret,sum);
      |                                     ^~~
a.cc:34:9: error: 'cout' was not declared in this scope
   34 |         cout<<ret<<endl;
      |         ^~~~
a.cc:34:15: error: 'ret' was not declared in this scope
   34 |         cout<<ret<<endl;
      |               ^~~
a.cc:34:20: error: 'endl' was not declared in this scope
   34 |         cout<<ret<<endl;
      |                    ^~~~
Language: C++

A	Apple Pie	2 sec	1024 MB	Submit
B	Guidebook	2 sec	1024 MB	Submit
C	Switches	2 sec	1024 MB	Submit
D	equeue	2 sec	1024 MB	Submit
E	Roadwork	2 sec	1024 MB	Submit
F	Frog Jump	2 sec	1024 MB	Submit




Compiler output:
a.cc:1:1: error: 'A' does not name a type
    1 | A       Apple Pie       2 sec   1024 MB Submit
      | ^
Language: C++

// template version 1.11
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings {{{
#define infile "../test/sample-1.in"
#define int long long
const int INF=1e18;
const int MOD=1e9+7;
// }}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n;cin>>n;
  vector<int> s(n);
  rep(i, n) {
    cin>>s[i];
  }

  int res = 0;
  rep(k, 1, n-1){
    int i = 0;
    int j = n-1;
    int ans = 0;
    set<int> S;
    while(i<n and j>=0){
      if (S.find(i) == S.end()){ S.insert(i); }
      else break;
      if (S.find(j) == S.end()){ S.insert(j); }
      else break;

      assert(i!=j);
      assert(0<=i&&i<=n-1 && 0<=j&&j<=n-1);
      ans += s[i]+s[j];
      chmax(res, ans);
      assertt(res>=ans);
      assert(res>=0);
      i += k;
      j -= k;
    }
  }
  cout << res << endl;
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Compiler output:
a.cc: In function 'long long int solve()':
a.cc:74:7: error: 'assertt' was not declared in this scope; did you mean 'assert'?
   74 |       assertt(res>=ans);
      |       ^~~~~~~
      |       assert
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

void Yes(){
  cout<<"Yes"<<endl;
  exit(0);
}
 
void No(){
  cout<<"No"<<endl;
  exit(0);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  ll s[100100];
  rep(i, N) cin >> s[i];
  ll ans = 0;
  ll dp[100100][100100];
  rep(i, N) {
	  dp[i][0] = s[0] + s[N - 1];
  }
  ll ans = s[0] + s[N - 1];
  rep1(C, N - 2) {
    rep1(k, (N - 1) / C) {
		 if(k * C == N - 1 - (k - 1) * C || k * C == N - 1 - k * C ) break;
		 dp[C][k] = dp[C][k - 1] + s[k * C] + s[N - 1 - k * C];
		 ans = max(ans, dp[C][k]);
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:6: error: redeclaration of 'll ans'
   62 |   ll ans = s[0] + s[N - 1];
      |      ^~~
a.cc:57:6: note: 'll ans' previously declared here
   57 |   ll ans = 0;
      |      ^~~
Language: C++

n = gets.chomp.to_i
s = gets.chomp.split.map(&:to_i)

max = 0
(1..(n/2 - 1)).each do |i|
  sum = 0
  left, right = i, n-1-i
  while i < right do
    sum += s[left] + s[right]
    max = sum if max < sum
    left += i
    right -= i
  end
end
puts(max)

Compiler output:
a.cc:5:2: error: too many decimal points in number
    5 | (1..(n/2 - 1)).each do |i|
      |  ^~~
a.cc:1:1: error: 'n' does not name a type
    1 | n = gets.chomp.to_i
      | ^
Language: C++

include<bits/stdc++.h>
using namespace std;
int n;
long long s[100005], ans;
int main(){
    scanf("%d", &n);
    for(int i = 0; i < n; i++) scanf("%lld", s+i);
    n--;
    for(int i = 1; i < n; i++){
        long long tmp = 0;
        for(int j = 1; i*(n%i ? j+1 : j*2) < n; j++){
            tmp += s[i*j] + s[n-i*j];
            ans = max(ans, tmp);
        }
    }
    printf("%lld\n", ans);
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'scanf' was not declared in this scope
    6 |     scanf("%d", &n);
      |     ^~~~~
a.cc:13:19: error: 'max' was not declared in this scope
   13 |             ans = max(ans, tmp);
      |                   ^~~
a.cc:16:5: error: 'printf' was not declared in this scope
   16 |     printf("%lld\n", ans);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include<bits/stdc++.h>
Language: C++

#include<iostream>
#include<cmath>
using namespace std;

typedef long long ll;

int N;
int S[100001];

int main() {
    cin>>N;
    for(int i=0;i<N;i++) cin>>S[i];

    ll res = 0;
    for(int i=1;i<N;i++) {
        int l=i, r=N-1-i;
        if(l>=r) break;
        ll val=0;
        if((N-1)%d) {
            while(d<r) {
                val+=S[l]+S[r];
                res=max(res,val);
                l+=i,r-=i;
            }
        } else {
            while(l<r) {
                val+=S[l]+S[r];
                res=max(res,val);
                l+=i,r-=i;
            }
        }
    }
    cout<<res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: 'd' was not declared in this scope
   19 |         if((N-1)%d) {
      |                  ^
Language: C++

#include "bits/stdc++.h"

#define REP(i, a, b) for (int i = (a); i <= (b); ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define FORV(a, A) for (auto &a : A)

using namespace std;

using ll = long long;

void Main()
{
   int N;
   cin >> N;
   ll S[N];
   FORV(s, S)
   {
      cin >> s;
   }

   ll ans = 0;
   ll score;
   REP(C, 1, N - 1)
   {
      score = 0;
      if ((N - 1) % C != 0)
      {
         for (int k = 1; C * k < N; k++)
         {
            score += S[k * C];
            score += S[N - 1 - k * C];
            ans = max(ans, score);
         }
      }
      else
      {
         for (int k = 1; C * k < (N - 1) / 2; k++)
         {
            score += S[k * C];
            score += S[N - 1 - k * C];
            ans = max(ans, score);
         }
      }
   }
   cout << ans << endl;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
#define FOR(i,a,b) for(register int i=a;i<=b;i++)

using namespace std;

inline int read(){
    char c=getchar();int x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}

int main(){
	
	//freopen("date.txt","r",stdin);
	//freopen("mine.txt","w",stdout);
	
	int n=read();
	int num[n+2];
	memset(num,0,sizeof(num));
	FOR(i,1,n){
		int a=read();
		num[i]+=a;
		num[n-(i-1)]+=a;
	}
	
//	int n=100000;
//	int num[100000];
//	memset(num,0,sizeof(num));
//	FOR(i,1,n){
//		num[i]=i;
//	}
	
	//FOR(i,1,n) cout<<num[i]<<" "; cout<<endl;
	
	long long Ans=0;
	
	FOR(k,1,n-1){
		if((n-1)%k==0) continue;
		long long nAns=0;
		for(int now=1;now<=n;now+=k){
			nAns+=num[now];
			Ans=max(Ans,nAns);
		}
	}
	
	FOR(k,1,n-1){
		if((n-1)%k!=0) continue;
		long long nAns=0;
		for(int now=1;now<(n+1)/2;now+=k){
			nAns+=num[now];
			Ans=max(Ans,nAns);
		}
		long long nAns=0;
		for(int now=1;now<=n;now+=k){
			nAns+=num[now];
			Ans=max(Ans,nAns);
		}
	}
	
	cout<<Ans;
		
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |         FOR(i,1,n){
      |             ^
a.cc:2:37: note: in definition of macro 'FOR'
    2 | #define FOR(i,a,b) for(register int i=a;i<=b;i++)
      |                                     ^
a.cc:38:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   38 |         FOR(k,1,n-1){
      |             ^
a.cc:2:37: note: in definition of macro 'FOR'
    2 | #define FOR(i,a,b) for(register int i=a;i<=b;i++)
      |                                     ^
a.cc:47:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   47 |         FOR(k,1,n-1){
      |             ^
a.cc:2:37: note: in definition of macro 'FOR'
    2 | #define FOR(i,a,b) for(register int i=a;i<=b;i++)
      |                                     ^
a.cc:54:27: error: redeclaration of 'long long int nAns'
   54 |                 long long nAns=0;
      |                           ^~~~
a.cc:49:27: note: 'long long int nAns' previously declared here
   49 |                 long long nAns=0;
      |                           ^~~~
Language: C++

//
//  abc128_f.cpp
//

#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

int main () {
  int n;
  cin>>n;
  vector<int> seq(n);
  for (int i = 0; i < n; ++i) {
    cin>>seq[i];
  }
  
  long long ret = 0;
  for (int j = 1; j < n; ++j) {
    int s = 0;
    for (int k = 1; j+k < n-1; k += j) {
      if (k>=(n-1-k) && (n-1) % j == 0) break;
      s += seq[k]+seq[n-1-k];
      ret = max(ret,s);
    }
  }
  
  cout << ret << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:16: error: no matching function for call to 'max(long long int&, int&)'
   27 |       ret = max(ret,s);
      |             ~~~^~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:27:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 |       ret = max(ret,s);
      |             ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:27:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 |       ret = max(ret,s);
      |             ~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n, a, b, j;
	long long int su, ma=-99999999999;
	vector<int> v;

	cin>> n;
	v.resize(n);
	for(int i=0;i<n;i++) cin>> v[i];
//max(a/2, min(n/2, a-1))
	for(a=3;a<n;a++){
		for(b=1;b<a;b++){
			if((n-1-a)%(a-b)!=0 || (a*2<=n && a<=b*2) continue;
			//cout<< n << " " << a << " " << b << endl;
			su=0;
			j=0;
			while(1){
				j=j+a;
				if(j==n-1) break;
				su+=v[j];
				j=j-b;
				su+=v[j];
			}
			ma=max(ma, su);
		}
	}

	cout<< ma << endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:66: error: expected ';' before 'continue'
   20 |                         if((n-1-a)%(a-b)!=0 || (a*2<=n && a<=b*2) continue;
      |                                                                  ^~~~~~~~~
      |                                                                  ;
a.cc:22:29: error: expected ')' before ';' token
   22 |                         su=0;
      |                             ^
      |                             )
a.cc:20:27: note: to match this '('
   20 |                         if((n-1-a)%(a-b)!=0 || (a*2<=n && a<=b*2) continue;
      |                           ^
Language: C++

#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>
#include <set>
#define llint long long

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint a[100005];

int main(void)
{
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	
	llint ans = 0;
	for(int i = 1; i =< n-1; i++){
		llint sum = 0;
		if(i >= n-1-i) continue;
		for(int j = i; j <= n-1; j+=i){
			if((n-1-j)%i == 0 && j >= (n-1-j)) break;
			sum += a[j] + a[n-1-j];
			ans = max(ans, sum);
			//cout << i << " " << j << " " << ans << endl;
		}
	}
	cout << ans << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:27: error: expected primary-expression before '<' token
   21 |         for(int i = 1; i =< n-1; i++){
      |                           ^