Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
int N, S, T[50]; bool dp[51][834][1251];
int main() {
????????scanf("%d", &N);
????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
????????dp[0][0][0] = true;
????????for(int i = 1; i <= N; i++) {
????????????????for(int j = 0; j <= S / 3; j++) {
????????????????????????for(int k = 0; k <= S / 2; k++) {
????????????????????????????????dp[i][j][k] = dp[i - 1][j][k];
????????????????????????????????if(j - T[i - 1] >= 0) dp[i][j][k] |= dp[i - 1][j - T[i - 1]][k];
????????????????????????????????if(k - T[i - 1] >= 0) dp[i][j][k] |= dp[i - 1][j][k - T[i - 1]];
????????????????????????}
????????????????}
????????}
????????int ret = 999999999;
????????for(int i = 0; i <= S / 3; i++) {
????????????????for(int j = 0; j <= S / 2; j++) {
????????????????????????if(dp[N][i][j]) {
????????????????????????????????ret = min(ret, max({i, j, S - i - j}));
????????????????????????}
????????????????}
????????}
????????printf("%d\n", ret);
????????return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:1: error: expected primary-expression before '?' token
    6 | ????????scanf("%d", &N);
      | ^
a.cc:6:2: error: expected primary-expression before '?' token
    6 | ????????scanf("%d", &N);
      |  ^
a.cc:6:3: error: expected primary-expression before '?' token
    6 | ????????scanf("%d", &N);
      |   ^
a.cc:6:4: error: expected primary-expression before '?' token
    6 | ????????scanf("%d", &N);
      |    ^
a.cc:6:5: error: expected primary-expression before '?' token
    6 | ????????scanf("%d", &N);
      |     ^
a.cc:6:6: error: expected primary-expression before '?' token
    6 | ????????scanf("%d", &N);
      |      ^
a.cc:6:7: error: expected primary-expression before '?' token
    6 | ????????scanf("%d", &N);
      |       ^
a.cc:6:8: error: expected primary-expression before '?' token
    6 | ????????scanf("%d", &N);
      |        ^
a.cc:6:24: error: expected ':' before ';' token
    6 | ????????scanf("%d", &N);
      |                        ^
      |                        :
a.cc:6:24: error: expected primary-expression before ';' token
a.cc:6:24: error: expected ':' before ';' token
    6 | ????????scanf("%d", &N);
      |                        ^
      |                        :
a.cc:6:24: error: expected primary-expression before ';' token
a.cc:6:24: error: expected ':' before ';' token
    6 | ????????scanf("%d", &N);
      |                        ^
      |                        :
a.cc:6:24: error: expected primary-expression before ';' token
a.cc:6:24: error: expected ':' before ';' token
    6 | ????????scanf("%d", &N);
      |                        ^
      |                        :
a.cc:6:24: error: expected primary-expression before ';' token
a.cc:6:24: error: expected ':' before ';' token
    6 | ????????scanf("%d", &N);
      |                        ^
      |                        :
a.cc:6:24: error: expected primary-expression before ';' token
a.cc:6:24: error: expected ':' before ';' token
    6 | ????????scanf("%d", &N);
      |                        ^
      |                        :
a.cc:6:24: error: expected primary-expression before ';' token
a.cc:6:24: error: expected ':' before ';' token
    6 | ????????scanf("%d", &N);
      |                        ^
      |                        :
a.cc:6:24: error: expected primary-expression before ';' token
a.cc:6:24: error: expected ':' before ';' token
    6 | ????????scanf("%d", &N);
      |                        ^
      |                        :
a.cc:6:24: error: expected primary-expression before ';' token
a.cc:7:1: error: expected primary-expression before '?' token
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      | ^
a.cc:7:2: error: expected primary-expression before '?' token
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |  ^
a.cc:7:3: error: expected primary-expression before '?' token
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |   ^
a.cc:7:4: error: expected primary-expression before '?' token
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |    ^
a.cc:7:5: error: expected primary-expression before '?' token
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |     ^
a.cc:7:6: error: expected primary-expression before '?' token
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |      ^
a.cc:7:7: error: expected primary-expression before '?' token
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |       ^
a.cc:7:8: error: expected primary-expression before '?' token
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |        ^
a.cc:7:9: error: expected primary-expression before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
a.cc:7:9: error: expected ':' before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
      |         :
a.cc:7:9: error: expected primary-expression before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
a.cc:7:9: error: expected ':' before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
      |         :
a.cc:7:9: error: expected primary-expression before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
a.cc:7:9: error: expected ':' before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
      |         :
a.cc:7:9: error: expected primary-expression before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
a.cc:7:9: error: expected ':' before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
      |         :
a.cc:7:9: error: expected primary-expression before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
a.cc:7:9: error: expected ':' before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
      |         :
a.cc:7:9: error: expected primary-expression before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
a.cc:7:9: error: expected ':' before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
      |         :
a.cc:7:9: error: expected primary-expression before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
a.cc:7:9: error: expected ':' before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
      |         :
a.cc:7:9: error: expected primary-expression before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
a.cc:7:9: error: expected ':' before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
      |         :
a.cc:7:9: error: expected primary-expression before 'for'
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |         ^~~
a.cc:7:24: error: 'i' was not declared in this scope
    7 | ????????for(int i = 0; i < N; i++) scanf("%d", &T[i]), S += T[i];
      |                        ^
a.cc:8:1: error: expected primary-expression before '?' token
    8 | ????????dp[0][0][0] = true;
      | ^
a.cc:8:2: error: expected primary-expression before '?' token
    8 | ????????dp[0][0][0] = true;
      |  ^
a.cc:8:3: error: expected primary-expression before '?' token
    8 | ????????dp[0][0][0] = true;
      |   ^
a.cc:8:4: error: expected primary-expression before '?' token
    8 | ????????dp[0][0][0] = true;
      |    ^
a.cc:8:5: error: expected primary-expression before '?' token
    8 | ????????dp[0][0][0] = true;
      |     ^
a.cc:8:6: error: expected primary-expression before '?' token
    8 | ????????dp[0][0][0] = true;
      |      ^
a.cc:8:7: error: expected primary-expression before '?' token
    8 | ????????dp[0][0][0] = true;
      |       ^
a.cc:8:8: error: expected primary-expression before '?' token
    8 | ????????dp[0][0][0] = true;
      |        ^
a.cc:8:27: error: expected ':' before ';' token
    8 | ????????dp[0][0][0] = true;
      |                           ^
      |                           :
a.cc:8:27: error: expected primary-expression before ';' token
a.cc:8:27: error: expected ':' before ';' token
    8 | ????????dp[0][0][0] = true;
      |                           ^
      |                           :
a.cc:8:27: error: expected primary-expression before ';' token
a.cc:8:27: error: expected ':' before ';' token
    8 | ????????dp[0][0][0] = true;
      |                           ^
      |                           :
a.cc:8:27: error: expected primary-expression before ';' token
a.cc:8:27: error: expected ':' before ';' token
    8 | ????????dp[0][0][0] = true;
      |                           ^
      |                           :
a.cc:8:27: error: expected primary-expression before ';' token
a.cc:8:27: error: expected ':' before ';' token
    8 | ????????dp[0][0][0] = true;
      |                           ^
      |                           :
a.cc:8:27: error: expected primary-expression before ';' token
a.cc:8:27: error: expected ':' before ';' token
    8 | ????????dp[0][0][0] = true;
      |                           ^
      |                           :
a.cc:8:27: error: expected primary-expression before ';' token
a.cc:8:27: error: expected ':' before ';' token
    8 | ????????dp[0][0][0] = true;
      |                           ^
      |                           :
a.cc:8:27: error: expected primary-expression before ';' token
a.cc:8:27: error: expected ':' before ';' token
    8 | ????????dp[0][0][0] = true;
      |                           ^
      |                           :
a.cc:8:27: error: expected primary-expression before ';' token
a.cc:9:1: error: expected primary-expression before '?' token
    9 | ????????for(int i = 1; i <= N; i++) {
      | ^
a.cc:9:2: error: expected primary-expression before '?' token
    9 | ????????for(int i = 1; i <= N; i++) {
      |  ^
a.cc:9:3: error: expected primary-expression before '?' token
    9 | ????????for(int i = 1; i <= N; i++) {
      |   ^
a.cc:9:4: error: expected primary-expression before '?' token
    9 | ????????for(int i = 1; i <= N; i++) {
      |    ^
a.cc:9:5: error: expected primary-expression before '?' token
    9 | ????????for(int i = 1; i <= N; i++) {
      |     ^
a.cc:9:6: error: expected primary-expression before '?' token
    9 | ????????for(int i = 1; i <= N; i++) {
      |      ^
a.cc:9:7: error: expected primary-expression before '?' token
    9 | ????????for(int i = 1; i <= N; i++) {
      |       ^
a.cc:9:8: error: expected primary-expression before '?' token
    9 | ????????for(int i = 1; i <= N; i++) {
      |        ^
a.cc:9:9: error: expected primary-expression before 'for'
    9 | ????????for(int