Language: C++

#include<iostream>
using namespace std;
int min2 (int a, int b) {
  if (a < b) return a;
  else return b;
}
int min3 (int a, int b, int c) {
  int t = min2(a, b);
  int k = min2(t, c);
  return k;
}
int mind (int a, int b, int c) {
  int k = min2(a, b);
  if (k > c) return k;
  else return c;
}
int main () {
  int N;
  cin >> N;
  int a[100001];
  int b[100001];
  int c[100001];
  for (int i = 0; i < N; i ++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  int ans[100004];
  ans[0] = min3(a[0], b[0], c[0]);
  if (N == 1) {
    cout << ans[0] << endl;
    return 0;
  }
  int k;
  switch(ans[0]) {
    case a[0]: k = ans[0] + min2(b[1], c[1]); break;
    case b[0]: k = ans[0] + min2(c[1], a[1]); break;
    case c[0]: k = ans[0] + min2(a[1], b[1]); break;
  }
  int o = mind(a[0], b[0], c[0]);
  int j;
  switch(o) {
    case c[0]: j = o + min2(a[1], b[1]); break;
    case b[0]: j = o + min2(c[1], a[1]); break;
    case a[0]: j = o + min2(c[1], b[1]); break;
  }
  ans[1] = min2(k, j);
  if (N == 2) {
    cout << ans[1] << endl;
    return 0;
  }
  for (int i = 2; i < N; i ++) {
    int p = i - 1;
    int q;
    switch(ans[p]) {
      case a[p]: q = ans[p] + min2(b[i], c[i]); break;
      case b[p]: q = ans[p] + min2(c[i], a[i]); break;
      case c[p]: q = ans[p] + min2(a[i], b[i]); break;
    }
    int r = mind(a[p], b[p], c[p]);
    int s;
    switch(r) {
      case c[p]: s = o + min2(a[i], b[i]); break;
      case b[p]: s = o + min2(c[i], a[i]); break;
      case a[p]: s = o + min2(c[i], b[i]); break;
    }
    ans[i] = min2(q, s);
  }
  cout << ans[N - 1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:10: error: the value of 'a' is not usable in a constant expression
   34 |     case a[0]: k = ans[0] + min2(b[1], c[1]); break;
      |          ^
a.cc:20:7: note: 'a' was not declared 'constexpr'
   20 |   int a[100001];
      |       ^
a.cc:34:10: error: the value of 'a' is not usable in a constant expression
   34 |     case a[0]: k = ans[0] + min2(b[1], c[1]); break;
      |          ^
a.cc:20:7: note: 'a' was not declared 'constexpr'
   20 |   int a[100001];
      |       ^
a.cc:35:10: error: the value of 'b' is not usable in a constant expression
   35 |     case b[0]: k = ans[0] + min2(c[1], a[1]); break;
      |          ^
a.cc:21:7: note: 'b' was not declared 'constexpr'
   21 |   int b[100001];
      |       ^
a.cc:35:10: error: the value of 'b' is not usable in a constant expression
   35 |     case b[0]: k = ans[0] + min2(c[1], a[1]); break;
      |          ^
a.cc:21:7: note: 'b' was not declared 'constexpr'
   21 |   int b[100001];
      |       ^
a.cc:36:10: error: the value of 'c' is not usable in a constant expression
   36 |     case c[0]: k = ans[0] + min2(a[1], b[1]); break;
      |          ^
a.cc:22:7: note: 'c' was not declared 'constexpr'
   22 |   int c[100001];
      |       ^
a.cc:36:10: error: the value of 'c' is not usable in a constant expression
   36 |     case c[0]: k = ans[0] + min2(a[1], b[1]); break;
      |          ^
a.cc:22:7: note: 'c' was not declared 'constexpr'
   22 |   int c[100001];
      |       ^
a.cc:41:10: error: the value of 'c' is not usable in a constant expression
   41 |     case c[0]: j = o + min2(a[1], b[1]); break;
      |          ^
a.cc:22:7: note: 'c' was not declared 'constexpr'
   22 |   int c[100001];
      |       ^
a.cc:41:10: error: the value of 'c' is not usable in a constant expression
   41 |     case c[0]: j = o + min2(a[1], b[1]); break;
      |          ^
a.cc:22:7: note: 'c' was not declared 'constexpr'
   22 |   int c[100001];
      |       ^
a.cc:42:10: error: the value of 'b' is not usable in a constant expression
   42 |     case b[0]: j = o + min2(c[1], a[1]); break;
      |          ^
a.cc:21:7: note: 'b' was not declared 'constexpr'
   21 |   int b[100001];
      |       ^
a.cc:42:10: error: the value of 'b' is not usable in a constant expression
   42 |     case b[0]: j = o + min2(c[1], a[1]); break;
      |          ^
a.cc:21:7: note: 'b' was not declared 'constexpr'
   21 |   int b[100001];
      |       ^
a.cc:43:10: error: the value of 'a' is not usable in a constant expression
   43 |     case a[0]: j = o + min2(c[1], b[1]); break;
      |          ^
a.cc:20:7: note: 'a' was not declared 'constexpr'
   20 |   int a[100001];
      |       ^
a.cc:43:10: error: the value of 'a' is not usable in a constant expression
   43 |     case a[0]: j = o + min2(c[1], b[1]); break;
      |          ^
a.cc:20:7: note: 'a' was not declared 'constexpr'
   20 |   int a[100001];
      |       ^
a.cc:54:12: error: the value of 'a' is not usable in a constant expression
   54 |       case a[p]: q = ans[p] + min2(b[i], c[i]); break;
      |            ^
a.cc:20:7: note: 'a' was not declared 'constexpr'
   20 |   int a[100001];
      |       ^
a.cc:54:12: error: the value of 'a' is not usable in a constant expression
   54 |       case a[p]: q = ans[p] + min2(b[i], c[i]); break;
      |            ^
a.cc:20:7: note: 'a' was not declared 'constexpr'
   20 |   int a[100001];
      |       ^
a.cc:55:12: error: the value of 'b' is not usable in a constant expression
   55 |       case b[p]: q = ans[p] + min2(c[i], a[i]); break;
      |            ^
a.cc:21:7: note: 'b' was not declared 'constexpr'
   21 |   int b[100001];
      |       ^
a.cc:55:12: error: the value of 'b' is not usable in a constant expression
   55 |       case b[p]: q = ans[p] + min2(c[i], a[i]); break;
      |            ^
a.cc:21:7: note: 'b' was not declared 'constexpr'
   21 |   int b[100001];
      |       ^
a.cc:56:12: error: the value of 'c' is not usable in a constant expression
   56 |       case c[p]: q = ans[p] + min2(a[i], b[i]); break;
      |            ^
a.cc:22:7: note: 'c' was not declared 'constexpr'
   22 |   int c[100001];
      |       ^
a.cc:56:12: error: the value of 'c' is not usable in a constant expression
   56 |       case c[p]: q = ans[p] + min2(a[i], b[i]); break;
      |            ^
a.cc:22:7: note: 'c' was not declared 'constexpr'
   22 |   int c[100001];
      |       ^
a.cc:61:12: error: the value of 'c' is not usable in a constant expression
   61 |       case c[p]: s = o + min2(a[i], b[i]); break;
      |            ^
a.cc:22:7: note: 'c' was not declared 'constexpr'
   22 |   int c[100001];
      |       ^
a.cc:61:12: error: the value of 'c' is not usable in a constant expression
   61 |       case c[p]: s = o + min2(a[i], b[i]); break;
      |            ^
a.cc:22:7: note: 'c' was not declared 'constexpr'
   22 |   int c[100001];
      |       ^
a.cc:62:12: error: the value of 'b' is not usable in a constant expression
   62 |       case b[p]: s = o + min2(c[i], a[i]); break;
      |            ^
a.cc:21:7: note: 'b' was not declared 'constexpr'
   21 |   int b[100001];
      |       ^
a.cc:62:12: error: the value of 'b' is not usable in a constant expression
   62 |       case b[p]: s = o + min2(c[i], a[i]); break;
      |            ^
a.cc:21:7: note: 'b' was not declared 'constexpr'
   21 |   int b[100001];
      |       ^
a.cc:63:12: error: the value of 'a' is not usable in a constant expression
   63 |       case a[p]: s = o + min2(c[i], b[i]); break;
      |            ^
a.cc:20:7: note: 'a' was not declared 'constexpr'
   20 |   int a[100001];
      |       ^
a.cc:63:12: error: the value of 'a' is not usable in a constant expression
   63 |       case a[p]: s = o + min2(c[i], b[i]); break;
      |            ^
a.cc:20:7: note: 'a' was not declared 'constexpr'
   20 |   int a[100001];
      |       ^