Language: C++

#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

ll N,Z,W,a[2010],b[101],c[101],d[101],f[101],g[101];
ll firstprime[100]={2,3,5,7},midprime[100]={11,13,17,19,23,29,31,37,41,43,47},lateprime[100]={53,59,61,67,71,73,79,83,89,97},sum;//26こ

int main(void){
	cin>>N;
	reg(i,1,N)cin>>a[i];

	rep(i,10)if(a[lateprime[i]]<0)a[lateprime[i]]=0;//予め壊す
	irep(i,11){
		sum=0;
		reg(j,1,N/midprime[i])sum+=a[j*midprime[i]];
		if(sum<0){
			reg(j,1,N/midprime[i])a[j*midprime[i]]=0;
		}
	}
	//ここからわからん
	//16通りやるか？
	reg(i,1,N){
		b0000[i]=a[i];
		b0001[i]=a[i];
		b0010[i]=a[i];
		b0011[i]=a[i];
		b0100[i]=a[i];
		b0101[i]=a[i];
		b0110[i]=a[i];
		b0111[i]=a[i];
		b1000[i]=a[i];
		b1001[i]=a[i];
		b1010[i]=a[i];
		b1011[i]=a[i];
		b1100[i]=a[i];
		b1101[i]=a[i];
		b1110[i]=a[i];
		b1111[i]=a[i];
	}
	reg(j,1,N/firstprime[0]){
		b0000[j*firstprime[0]]=0;
		b0001[j*firstprime[0]]=0;
		b0010[j*firstprime[0]]=0;
		b0011[j*firstprime[0]]=0;
		b0100[j*firstprime[0]]=0;
		b0101[j*firstprime[0]]=0;
		b0110[j*firstprime[0]]=0;
		b0111[j*firstprime[0]]=0;
	}
	reg(j,1,N/firstprime[1]){
		b0000[j*firstprime[1]]=0;
		b0001[j*firstprime[1]]=0;
		b0010[j*firstprime[1]]=0;
		b0011[j*firstprime[1]]=0;
		b1000[j*firstprime[1]]=0;
		b1001[j*firstprime[1]]=0;
		b1010[j*firstprime[1]]=0;
		b1011[j*firstprime[1]]=0;
	}
	reg(j,1,N/firstprime[2]){
		b0000[j*firstprime[2]]=0;
		b0001[j*firstprime[2]]=0;
		b0100[j*firstprime[2]]=0;
		b0101[j*firstprime[2]]=0;
		b1000[j*firstprime[2]]=0;
		b1001[j*firstprime[2]]=0;
		b1100[j*firstprime[2]]=0;
		b1101[j*firstprime[2]]=0;
	}
	reg(j,1,N/firstprime[3]){
		b0000[j*firstprime[3]]=0;
		b0010[j*firstprime[3]]=0;
		b0100[j*firstprime[3]]=0;
		b0110[j*firstprime[3]]=0;
		b1000[j*firstprime[3]]=0;
		b1010[j*firstprime[3]]=0;
		b1100[j*firstprime[3]]=0;
		b1110[j*firstprime[3]]=0;
	}
	reg(i,1,N){
		sum[0]+=b0000[i];
		sum[1]+=b0001[i];
		sum[2]+=b0010[i];
		sum[3]+=b0011[i];
		sum[4]+=b0100[i];
		sum[5]+=b0101[i];
		sum[6]+=b0110[i];
		sum[7]+=b0111[i];
		sum[8]+=b1000[i];
		sum[9]+=b1001[i];
		sum[10]+=b1010[i];
		sum[11]+=b1011[i];
		sum[12]+=b1100[i];
		sum[13]+=b1101[i];
		sum[14]+=b1110[i];
		sum[15]+=b1111[i];
	}
	ll max=0;
	rep(i,16)if(max<sum[i])max=sum[i];
	cout<<max<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:17: error: 'b0000' was not declared in this scope
   39 |                 b0000[i]=a[i];
      |                 ^~~~~
a.cc:40:17: error: 'b0001' was not declared in this scope
   40 |                 b0001[i]=a[i];
      |                 ^~~~~
a.cc:41:17: error: 'b0010' was not declared in this scope
   41 |                 b0010[i]=a[i];
      |                 ^~~~~
a.cc:42:17: error: 'b0011' was not declared in this scope
   42 |                 b0011[i]=a[i];
      |                 ^~~~~
a.cc:43:17: error: 'b0100' was not declared in this scope
   43 |                 b0100[i]=a[i];
      |                 ^~~~~
a.cc:44:17: error: 'b0101' was not declared in this scope
   44 |                 b0101[i]=a[i];
      |                 ^~~~~
a.cc:45:17: error: 'b0110' was not declared in this scope
   45 |                 b0110[i]=a[i];
      |                 ^~~~~
a.cc:46:17: error: 'b0111' was not declared in this scope
   46 |                 b0111[i]=a[i];
      |                 ^~~~~
a.cc:47:17: error: 'b1000' was not declared in this scope
   47 |                 b1000[i]=a[i];
      |                 ^~~~~
a.cc:48:17: error: 'b1001' was not declared in this scope
   48 |                 b1001[i]=a[i];
      |                 ^~~~~
a.cc:49:17: error: 'b1010' was not declared in this scope
   49 |                 b1010[i]=a[i];
      |                 ^~~~~
a.cc:50:17: error: 'b1011' was not declared in this scope
   50 |                 b1011[i]=a[i];
      |                 ^~~~~
a.cc:51:17: error: 'b1100' was not declared in this scope
   51 |                 b1100[i]=a[i];
      |                 ^~~~~
a.cc:52:17: error: 'b1101' was not declared in this scope
   52 |                 b1101[i]=a[i];
      |                 ^~~~~
a.cc:53:17: error: 'b1110' was not declared in this scope
   53 |                 b1110[i]=a[i];
      |                 ^~~~~
a.cc:54:17: error: 'b1111' was not declared in this scope
   54 |                 b1111[i]=a[i];
      |                 ^~~~~
a.cc:57:17: error: 'b0000' was not declared in this scope
   57 |                 b0000[j*firstprime[0]]=0;
      |                 ^~~~~
a.cc:58:17: error: 'b0001' was not declared in this scope
   58 |                 b0001[j*firstprime[0]]=0;
      |                 ^~~~~
a.cc:59:17: error: 'b0010' was not declared in this scope
   59 |                 b0010[j*firstprime[0]]=0;
      |                 ^~~~~
a.cc:60:17: error: 'b0011' was not declared in this scope
   60 |                 b0011[j*firstprime[0]]=0;
      |                 ^~~~~
a.cc:61:17: error: 'b0100' was not declared in this scope
   61 |                 b0100[j*firstprime[0]]=0;
      |                 ^~~~~
a.cc:62:17: error: 'b0101' was not declared in this scope
   62 |                 b0101[j*firstprime[0]]=0;
      |                 ^~~~~
a.cc:63:17: error: 'b0110' was not declared in this scope
   63 |                 b0110[j*firstprime[0]]=0;
      |                 ^~~~~
a.cc:64:17: error: 'b0111' was not declared in this scope
   64 |                 b0111[j*firstprime[0]]=0;
      |                 ^~~~~
a.cc:67:17: error: 'b0000' was not declared in this scope
   67 |                 b0000[j*firstprime[1]]=0;
      |                 ^~~~~
a.cc:68:17: error: 'b0001' was not declared in this scope
   68 |                 b0001[j*firstprime[1]]=0;
      |                 ^~~~~
a.cc:69:17: error: 'b0010' was not declared in this scope
   69 |                 b0010[j*firstprime[1]]=0;
      |                 ^~~~~
a.cc:70:17: error: 'b0011' was not declared in this scope
   70 |                 b0011[j*firstprime[1]]=0;
      |                 ^~~~~
a.cc:71:17: error: 'b1000' was not declared in this scope
   71 |                 b1000[j*firstprime[1]]=0;
      |                 ^~~~~
a.cc:72:17: error: 'b1001' was not declared in this scope
   72 |                 b1001[j*firstprime[1]]=0;
      |                 ^~~~~
a.cc:73:17: error: 'b1010' was not declared in this scope
   73 |                 b1010[j*firstprime[1]]=0;
      |                 ^~~~~
a.cc:74:17: error: 'b1011' was not declared in this scope
   74 |                 b1011[j*firstprime[1]]=0;
      |                 ^~~~~
a.cc:77:17: error: 'b0000' was not declared in this scope
   77 |                 b0000[j*firstprime[2]]=0;
      |                 ^~~~~
a.cc:78:17: error: 'b0001' was not declared in this scope
   78 |                 b0001[j*firstprime[2]]=0;
      |                 ^~~~~
a.cc:79:17: error: 'b0100' was not declared in this scope
   79 |                 b0100[j*firstprime[2]]=0;
      |                 ^~~~~
a.cc:80:17: error: 'b0101' was not declared in this scope
   80 |                 b0101[j*firstprime[2]]=0;
      |                 ^~~~~
a.cc:81:17: error: 'b1000' was not declared in this scope
   81 |                 b1000[j*firstprime[2]]=0;
      |                 ^~~~~
a.cc:82:17: error: 'b1001' was not declared in this scope
   82 |                 b1001[j*firstprime[2]]=0;
      |                 ^~~~~
a.cc:83:17: error: 'b1100' was not declared in this scope
   83 |                 b1100[j*firstprime[2]]=0;
      |                 ^~~~~
a.cc:84:17: error: 'b1101' was not declared in this scope
   84 |                 b1101[j*firstprime[2]]=0;
      |                 ^~~~~
a.cc:87:17: error: 'b0000' was not declared in this scope
   87 |                 b0000[j*firstprime[3]]=0;
      |                 ^~~~~
a.cc:88:17: error: 'b0010' was not declared in this scope
   88 |                 b0010[j*firstprime[3]]=0;
      |                 ^~~~~
a.cc:89:17: error: 'b0100' was not declared in this scope
   89 |                 b0100[j*firstprime[3]]=0;
      |                 ^~~~~
a.cc:90:17: error: 'b0110' was not declared in this scope
   90 |                 b0110[j*firstprime[3]]=0;
      |                 ^~~~~
a.cc:91:17: error: 'b1000' was not declared in this scope
   91 |                 b1000[j*firstprime[3]]=0;
      |                 ^~~~~
a.cc:92:17: error: 'b1010' was not declared in this scope
   92 |                 b1010[j*firstprime[3]]=0;
      |                 ^~~~~
a.cc:93:17: error: 'b1100' was not declared in this scope
   93 |                 b1100[j*firstprime[3]]=0;
      |                 ^~~~~
a.cc:94:17: error: 'b1110' was not declared in this scope
   94 |                 b1110[j*firstprime[3]]=0;
      |                 ^~~~~
a.cc:97:20: error: invalid types 'll {aka long long int}[int]' for array subscript
   97 |                 sum[0]+=b0000[i];
      |                    ^
a.cc:97:25: error: 'b0000' was not declared in this scope
   97 |                 sum[0]+=b0000[i];
      |                         ^~~~~
a.cc:98:20: error: invalid types 'll {aka long long int}[int]' for array subscript
   98 |                 sum[1]+=b0001[i];
      |                    ^
a.cc:98:25: error: 'b0001' was not declared in this scope
   98 |                 sum[1]+=b0001[i];
      |                         ^~~~~
a.cc:99:20: error: invalid types 'll {aka long long int}[int]' for array subscript
   99 |                 sum[2]+=b0010[i];
      |                    ^
a.cc:99:25: error: 'b0010' was not declared in this scope
   99 |                 sum[2]+=b0010[i];
      |                         ^~~~~
a.cc:100:20: error: invalid types 'll {aka long long int}[int]' for array subscript
  100 |                 sum[3]+=b0011[i];
      |                    ^
a.cc:100:25: error: 'b0011' was not declared in this scope
  100 |                 sum[3]+=b0011[i];
      |                         ^~~~~
a.cc:101:20: error: invalid types 'll {aka long long int}[int]' for array subscript
  101 |                 sum[4]+=b0100[i];
      |                    ^
a.cc:101:25: error: 'b0100' was not declared in this scope
  101 |                 sum[4]+=b0100[i];
      |                         ^~~~~
a.cc:102:20: error: invalid types 'll {aka long long int}[int]' for array subscript
  102 |                 sum[5]+=b0101[i];
      |                    ^
a.cc:102:25: error: 'b0101' was not declared in this scope
  102 |                 sum[5]+=b0101[i];
      |                         ^~~~~
a.cc:103:20: error: invalid types 'll {aka long long int}[int]' for array subscript
  103 |                 sum[6]+=b0110[i];
      |                    ^
a.cc:103:25: error: 'b0110' was not declared in this scope
  103 |                 sum[6]+=b0110[i];
      |                         ^~~~~
a.cc:104:20: error: invalid types 'll {aka long long int}[int]' for array subscript
  104 |                 sum[7]+=b0111[i];
      |                    ^
a.cc:104:25: error: 'b0111' was not declared in this scope
  104 |                 sum[7]+=b0111[i];
      |                         ^~~~~
a.cc:105:20: error: invalid types 'll {aka long long int}[int]' for array subscript
  105 |                 sum[8]+=b1000[i];
      |                    ^
a.cc:105:25: error: 'b1000' was not declared in this scope
  105 |                 sum[8]+=b1000[i];
      |                         ^~~~~
a.cc:106:20: error: invalid types 'll {aka long long int}[int]' for array subscript
  106 |                 sum[9]+=b1001[i];
      |                    ^
a.cc:106:25: error: 'b1001' was not declared in this scope
  106 |                 sum[9]+=b1001[i];
      |                         ^~~~~
a.cc:107:20: error: invalid types 'll {aka long long int}[int]' for array subscript
  107 |                 sum[10]+=b1010[i];
      |                    ^
a.cc:107:26: error: 'b1010' was not declared in this scope
  107 |                 sum[10]+=b1010[i];
      |                          ^~~~~
a.cc:108:20: error: invalid types 'll {aka long long int}[int]' for array subscript
  108 |                 sum[11]+=b1011[i];
      |                    ^
a.cc:108:26: error: 'b1011' was not declared in this scope
  108 |                 sum[11]+=b1011[i];
      |                          ^~~~~
a.cc:109:20: error: invalid types 'll {aka long long int}[int]' for array subscript
  109 |                 sum[12]+=b1100[i];
      |                    ^
a.cc:109:26: error: 'b1100' was not declared in this scope
  109 |