Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int r, c, k;
    cin >> r >> c >> k;
    vector<vector<ll>> a(r, vector<ll>(c, 0));
    int y, x; ll v;
    for(int i=0;i<k;++i) {
        cin >> y >> x >> v;
        --y; --x;
        a[y][x] = v;
    }

    ll dp[r][c][4];
    fill(dp, dp[r][0], 0LL);
    for(int i=0;i<r;++i) {
        for(int j=0;j<c;++j) {
            for(int l=0;l<=3;++l) {
                if(j < c-1) dp[i][j+1][l] = max(dp[i][j+1][l], dp[i][j][l]);
                if(j < c-1 && l < 3 && a[i][j]) dp[i][j+1][l+1] = max(dp[i][j+1][l+1], dp[i][j][l] + a[i][j]);
                if(i < r-1) dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][l]);
                if(i < r-1 && l < 3  && a[i][j]) dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][l] + a[i][j]);
            }
        }
    }
    if(a[r-1][c-1]) for(int l=0;l<=2;++l) dp[r-1][c-1][l] += a[r-1][c-1];
    

    cout << *max_element(dp[r-1][c-1], dp[r][0]) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:9: error: no matching function for call to 'fill(ll [r][c][4], ll [4], long long int)'
   49 |     fill(dp, dp[r][0], 0LL);
      |     ~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note: candidate: 'template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1022 |     fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
      |     ^~~~
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note:   template argument deduction/substitution failed:
a.cc:49:9: note:   variable-sized array type 'll (*)[c][4]' {aka 'long long int (*)[c][4]'} is not a valid template argument
   49 |     fill(dp, dp[r][0], 0LL);
      |     ~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note:   candidate expects 4 arguments, 3 provided