Language: C++

#include <bits/stdc++.h>

using namespace std;

int n,i,j;
int tablica[100003];
int dp[100003];

int main() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n; 
    for(i=0;i<n;i++){
        for(j=0;j<3;j++){
            cin >> dp[i][j];
        }
    }
    for(i=1;i<n;i++){
        dp[i][0]+=max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]+=max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]+=max(dp[i-1][0],dp[i-1][1]);
    }
    cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: invalid types 'int[int]' for array subscript
   16 |             cin >> dp[i][j];
      |                         ^
a.cc:20:14: error: invalid types 'int[int]' for array subscript
   20 |         dp[i][0]+=max(dp[i-1][1],dp[i-1][2]);
      |              ^
a.cc:20:30: error: invalid types 'int[int]' for array subscript
   20 |         dp[i][0]+=max(dp[i-1][1],dp[i-1][2]);
      |                              ^
a.cc:20:41: error: invalid types 'int[int]' for array subscript
   20 |         dp[i][0]+=max(dp[i-1][1],dp[i-1][2]);
      |                                         ^
a.cc:21:14: error: invalid types 'int[int]' for array subscript
   21 |         dp[i][1]+=max(dp[i-1][0],dp[i-1][2]);
      |              ^
a.cc:21:30: error: invalid types 'int[int]' for array subscript
   21 |         dp[i][1]+=max(dp[i-1][0],dp[i-1][2]);
      |                              ^
a.cc:21:41: error: invalid types 'int[int]' for array subscript
   21 |         dp[i][1]+=max(dp[i-1][0],dp[i-1][2]);
      |                                         ^
a.cc:22:14: error: invalid types 'int[int]' for array subscript
   22 |         dp[i][2]+=max(dp[i-1][0],dp[i-1][1]);
      |              ^
a.cc:22:30: error: invalid types 'int[int]' for array subscript
   22 |         dp[i][2]+=max(dp[i-1][0],dp[i-1][1]);
      |                              ^
a.cc:22:41: error: invalid types 'int[int]' for array subscript
   22 |         dp[i][2]+=max(dp[i-1][0],dp[i-1][1]);
      |                                         ^
a.cc:24:25: error: invalid types 'int[int]' for array subscript
   24 |     cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});
      |                         ^
a.cc:24:37: error: invalid types 'int[int]' for array subscript
   24 |     cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});
      |                                     ^
a.cc:24:49: error: invalid types 'int[int]' for array subscript
   24 |     cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});
      |                                                 ^
a.cc:24:16: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   24 |     cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided