/in/foo.cc: In function 'int main()':
/in/foo.cc:31:25: warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
ans = max(f[n][i][j], ans);
~~~~~~~~~^
/in/foo.cc:4:19: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:30:21: note: within this loop
for(int j = 1; j <= 3; j ++)
~~^~~~
/in/foo.cc:20:14: warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
w[i][j] = read();
~~~~~~~~^~~~~~~~
/in/foo.cc:19:21: note: within this loop
for(int j = 1; j <= 3; j ++)
~~^~~~
/in/foo.cc:22:102: warning: array subscript is above array bounds [-Warray-bounds]
f[i][1][2] = max(f[i][1][2], f[i - 1][2][1] + w[i][1]), f[i][3][2] = max(f[i][3][2], f[i - 1][2][3] + w[i][3]);
~~~~~~~~~~~~~^
/in/foo.cc:4:31: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:22:112: warning: array subscript is above array bounds [-Warray-bounds]
f[i][1][2] = max(f[i][1][2], f[i - 1][2][1] + w[i][1]), f[i][3][2] = max(f[i][3][2], f[i - 1][2][3] + w[i][3]);
~~~~~~^
/in/foo.cc:4:31: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:22:83: warning: array subscript is above array bounds [-Warray-bounds]
f[i][1][2] = max(f[i][1][2], f[i - 1][2][1] + w[i][1]), f[i][3][2] = max(f[i][3][2], f[i - 1][2][3] + w[i][3]);
~~~~~~^
/in/foo.cc:4:27: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:22:66: warning: array subscript is above array bounds [-Warray-bounds]
f[i][1][2] = max(f[i][1][2], f[i - 1][2][1] + w[i][1]), f[i][3][2] = max(f[i][3][2], f[i - 1][2][3] + w[i][3]);
~~~~~~^
/in/foo.cc:23:46: warning: array subscript is above array bounds [-Warray-bounds]
f[i][3][1] = max(f[i][3][1], f[i - 1][1][3] + w[i][3]), f[i][3][1] = max(f[i][3][1], f[i - 1][1][2] + w[i][3]);
~~~~~~~~~~~~~^
/in/foo.cc:4:31: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:23:27: warning: array subscript is above array bounds [-Warray-bounds]
f[i][3][1] = max(f[i][3][1], f[i - 1][1][3] + w[i][3]), f[i][3][1] = max(f[i][3][1], f[i - 1][1][2] + w[i][3]);
~~~~~~^
/in/foo.cc:4:27: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:23:10: warning: array subscript is above array bounds [-Warray-bounds]
f[i][3][1] = max(f[i][3][1], f[i - 1][1][3] + w[i][3]), f[i][3][1] = max(f[i][3][1], f[i - 1][1][2] + w[i][3]);
~~~~~~^
/in/foo.cc:23:66: warning: array subscript is above array bounds [-Warray-bounds]
f[i][3][1] = max(f[i][3][1], f[i - 1][1][3] + w[i][3]), f[i][3][1] = max(f[i][3][1], f[i - 1][1][2] + w[i][3]);
~~~~~~^
/in/foo.cc:24:46: warning: array subscript is above array bounds [-Warray-bounds]
f[i][2][1] = max(f[i][2][1], f[i - 1][1][3] + w[i][2]), f[i][2][1] = max(f[i][2][1], f[i - 1][1][2] + w[i][2]);
~~~~~~~~~~~~~^
/in/foo.cc:4:31: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:25:43: warning: array subscript is above array bounds [-Warray-bounds]
f[i][1][3] = max(f[i][1][3], f[i - 1][3][1] + w[i][1]), f[i][1][3] = max(f[i][1][3], f[i - 1][3][2] + w[i][1]);
~~~~~~~~~~^
/in/foo.cc:4:31: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:25:30: warning: array subscript is above array bounds [-Warray-bounds]
f[i][1][3] = max(f[i][1][3], f[i - 1][3][1] + w[i][1]), f[i][1][3] = max(f[i][1][3], f[i - 1][3][2] + w[i][1]);
~~~~~~~~~^
/in/foo.cc:4:27: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:25:13: warning: array subscript is above array bounds [-Warray-bounds]
f[i][1][3] = max(f[i][1][3], f[i - 1][3][1] + w[i][1]), f[i][1][3] = max(f[i][1][3], f[i - 1][3][2] + w[i][1]);
~~~~~~~~~^
/in/foo.cc:25:99: warning: array subscript is above array bounds [-Warray-bounds]
f[i][1][3] = max(f[i][1][3], f[i - 1][3][1] + w[i][1]), f[i][1][3] = max(f[i][1][3], f[i - 1][3][2] + w[i][1]);
~~~~~~~~~~^
/in/foo.cc:4:31: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:25:69: warning: array subscript is above array bounds [-Warray-bounds]
f[i][1][3] = max(f[i][1][3], f[i - 1][3][1] + w[i][1]), f[i][1][3] = max(f[i][1][3], f[i - 1][3][2] + w[i][1]);
~~~~~~~~~^
/in/foo.cc:26:43: warning: array subscript is above array bounds [-Warray-bounds]
f[i][2][3] = max(f[i][2][3], f[i - 1][3][1] + w[i][2]), f[i][2][3] = max(f[i][2][3], f[i - 1][3][2] + w[i][2]);
~~~~~~~~~~^
/in/foo.cc:4:31: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:26:30: warning: array subscript is above array bounds [-Warray-bounds]
f[i][2][3] = max(f[i][2][3], f[i - 1][3][1] + w[i][2]), f[i][2][3] = max(f[i][2][3], f[i - 1][3][2] + w[i][2]);
~~~~~~~~~^
/in/foo.cc:4:27: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:26:13: warning: array subscript is above array bounds [-Warray-bounds]
f[i][2][3] = max(f[i][2][3], f[i - 1][3][1] + w[i][2]), f[i][2][3] = max(f[i][2][3], f[i - 1][3][2] + w[i][2]);
~~~~~~~~~^
/in/foo.cc:26:99: warning: array subscript is above array bounds [-Warray-bounds]
f[i][2][3] = max(f[i][2][3], f[i - 1][3][1] + w[i][2]), f[i][2][3] = max(f[i][2][3], f[i - 1][3][2] + w[i][2]);
~~~~~~~~~~^
/in/foo.cc:4:31: note: in definition of macro 'max'
#define max(a, b) a > b ? a : b
^
/in/foo.cc:26:69: warning: array subscript is above array bounds [-Warray-bounds]
f[i][2][3] = max(f[i][2][3], f[i - 1][3][1] + w[i][2]), f[i][2][3] = max(f[i][2][3], f[i - 1][3][2] + w[i][2]);
~~~~~~~~~^