Language: C++

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

int main() {
    int N, a = -1, b = -1, c = -1, d = -1;
    cin >> N;
    vector<vector<int>> S(N, vector<int>(3));
    vector<vector<int>> ans(N, vector<int>(2));

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> S.at(i).at(j);
        }
    }
    for (int i = 0; i < N; i++) {
        if (i == 0) {
            for (int j = 0; j < 3; j++) {
                if (a < S.at(i).at(j)) {
                    a = S.at(i).at(j);
                    b = j;
                }
            }
            ans.at(i).at(0) = a;
            ans.at(i).at(1) = b;
        }
        else {
            for (int j = 0; j < 3; j++) {
                if (ans.at(i - 1).at(1) == j) {
                    continue;
                }
                if (c < S.at(i).at(j)) {
                    c = S.at(i).at(j);
                    d = j;
                }
            }
            if  (i == 1) {
                ans.at(i).at(0) = c + ans.at(i - 1).at(0);
                ans.at(i).at(1) = d;
                continue;
            }
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < 3; k++) {
                    if (j == k || (ans.at(i - 2).at(1) == j)) {
                        continue;
                    }
                    else {
                        if (a < S.at(i - 1).at(j) + S.at(i).at(k)) {
                            a = S.at(i - 1).at(j) + S.at(i).at(k);
                            b = k;
                        }
                    }
                }
            }
            if (c + ans.at(i - 1).at(0) > a + ans.at(i - 2).at(0)) {
                ans.at(i).at(0) = c + ans.at(i - 1).at(0);
                ans.at(i).at(1) = d;
            }
            else {
                ans.at(i).at(0) = a + ans.at(i - 2).at(0);
                ans.at(i).at(1) = b;
            }
        }
    }
    cout << ans.at(N - 1).at(0) << endl;
}


Compiler output:
a.cc:1:2: error: extended character   is not valid in an identifier
    1 | #include <bits/stdc++.h>
      |  ^
a.cc:1:2: error: invalid preprocessing directive #include\U000000a0
    1 | #include <bits/stdc++.h>
      |  ^~~~~~~~
a.cc:2:1: error: extended character   is not valid in an identifier
    2 | using namespace std;
      | ^
a.cc:2:1: error: extended character   is not valid in an identifier
a.cc:4:1: error: extended character   is not valid in an identifier
    4 | int main() {
      | ^
a.cc:4:11: error: extended character   is not valid in an identifier
    4 | int main() {
      |           ^
a.cc:5:1: error: extended character   is not valid in an identifier
    5 |     int N, a = -1, b = -1, c = -1, d = -1;
      | ^
a.cc:5:1: error: extended character   is not valid in an identifier
a.cc:5:1: error: extended character   is not valid in an identifier
a.cc:5:1: error: extended character   is not valid in an identifier
a.cc:5:1: error: extended character   is not valid in an identifier
a.cc:5:11: error: extended character   is not valid in an identifier
    5 |     int N, a = -1, b = -1, c = -1, d = -1;
      |           ^
a.cc:5:11: error: extended character   is not valid in an identifier
a.cc:5:15: error: extended character   is not valid in an identifier
    5 |     int N, a = -1, b = -1, c = -1, d = -1;
      |               ^
a.cc:5:19: error: extended character   is not valid in an identifier
    5 |     int N, a = -1, b = -1, c = -1, d = -1;
      |                   ^
a.cc:5:19: error: extended character   is not valid in an identifier
a.cc:5:23: error: extended character   is not valid in an identifier
    5 |     int N, a = -1, b = -1, c = -1, d = -1;
      |                       ^
a.cc:5:27: error: extended character   is not valid in an identifier
    5 |     int N, a = -1, b = -1, c = -1, d = -1;
      |                           ^
a.cc:5:27: error: extended character   is not valid in an identifier
a.cc:5:31: error: extended character   is not valid in an identifier
    5 |     int N, a = -1, b = -1, c = -1, d = -1;
      |                               ^
a.cc:5:35: error: extended character   is not valid in an identifier
    5 |     int N, a = -1, b = -1, c = -1, d = -1;
      |                                   ^
a.cc:5:35: error: extended character   is not valid in an identifier
a.cc:5:39: error: extended character   is not valid in an identifier
    5 |     int N, a = -1, b = -1, c = -1, d = -1;
      |                                       ^
a.cc:6:1: error: extended character   is not valid in an identifier
    6 |     cin >> N;
      | ^
a.cc:6:1: error: extended character   is not valid in an identifier
a.cc:6:1: error: extended character   is not valid in an identifier
a.cc:6:1: error: extended character   is not valid in an identifier
a.cc:6:1: error: extended character   is not valid in an identifier
a.cc:6:11: error: extended character   is not valid in an identifier
    6 |     cin >> N;
      |           ^
a.cc:7:1: error: extended character   is not valid in an identifier
    7 |     vector<vector<int>> S(N, vector<int>(3));
      | ^
a.cc:7:1: error: extended character   is not valid in an identifier
a.cc:7:1: error: extended character   is not valid in an identifier
a.cc:7:1: error: extended character   is not valid in an identifier
a.cc:7:24: error: extended character   is not valid in an identifier
    7 |     vector<vector<int>> S(N, vector<int>(3));
      |                        ^
a.cc:7:29: error: extended character   is not valid in an identifier
    7 |     vector<vector<int>> S(N, vector<int>(3));
      |                             ^
a.cc:8:1: error: extended character   is not valid in an identifier
    8 |     vector<vector<int>> ans(N, vector<int>(2));
      | ^
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:8:24: error: extended character   is not valid in an identifier
    8 |     vector<vector<int>> ans(N, vector<int>(2));
      |                        ^
a.cc:8:31: error: extended character   is not valid in an identifier
    8 |     vector<vector<int>> ans(N, vector<int>(2));
      |                               ^
a.cc:10:1: error: extended character   is not valid in an identifier
   10 |     for (int i = 0; i < N; i++) {
      | ^
a.cc:10:1: error: extended character   is not valid in an identifier
a.cc:10:1: error: extended character   is not valid in an identifier
a.cc:10:1: error: extended character   is not valid in an identifier
a.cc:10:1: error: extended character   is not valid in an identifier
a.cc:10:10: error: extended character   is not valid in an identifier
   10 |     for (int i = 0; i < N; i++) {
      |          ^
a.cc:10:10: error: extended character   is not valid in an identifier
a.cc:10:17: error: extended character   is not valid in an identifier
   10 |     for (int i = 0; i < N; i++) {
      |                 ^
a.cc:10:20: error: extended character   is not valid in an identifier
   10 |     for (int i = 0; i < N; i++) {
      |                    ^
a.cc:10:20: error: extended character   is not valid in an identifier
a.cc:10:24: error: extended character   is not valid in an identifier
   10 |     for (int i = 0; i < N; i++) {
      |                        ^
a.cc:10:27: error: extended character   is not valid in an identifier
   10 |     for (int i = 0; i < N; i++) {
      |                           ^
a.cc:10:32: error: extended character   is not valid in an identifier
   10 |     for (int i = 0; i < N; i++) {
      |                                ^
a.cc:11:1: error: extended character   is not valid in an identifier
   11 |         for (int j = 0; j < 3; j++) {
      | ^
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:14: error: extended character   is not valid in an identifier
   11 |         for (int j = 0; j < 3; j++) {
      |              ^
a.cc:11:14: error: extended character   is not valid in an identifier
a.cc:11:21: error: extended character   is not valid in an identifier
   11 |         for (int j = 0; j < 3; j++) {
      |                     ^
a.cc:11:24: error: extended character   is not valid in an identifier
   11 |         for (int j = 0; j < 3; j++) {
      |                        ^
a.cc:11:24: error: extended character   is not valid in an identifier
a.cc:11:28: error: extended character   is not valid in an identifier
   11 |         for (int j = 0; j < 3; j++) {
      |                            ^
a.cc:11:31: error: extended character   is not valid in an identifier
   11 |         for (int j = 0; j < 3; j++) {
      |                               ^
a.cc:11:36: error: extended character   is not valid in an identifier
   11 |         for (int j = 0; j < 3; j++) {
      |                                    ^
a.cc:12:1: error: extended character   is not valid in an identifier
   12 |             cin >> S.at(i).at(j);
      | ^
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:19: error: extended character   is not valid in an identifier
   12 |             cin >> S.at(i).at(j);
      |                   ^
a.cc:13:1: error: extended character   is not valid in an identifier
   13 |         }
      | ^
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
   14 |     }
      | ^
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
   15 |     for (int i = 0; i < N; i++) {
      | ^
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15