func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   using pii = pair<int, int>;   constexpr int N = 1e2 + 5;   int n, m, k, g[N][N], ans = -1, id;   unordered_set<int> dp[N][N];   char c;   bool check(int i, int j, int val) {     for (auto el : dp[i][j]) {       if (ans == el + val) {         ans -= val;         return true;       }     }     return false;   }   void Solve() {     cin >> n >> m >> k;     for (int i = 0; i < N; i++)       for (int j = 0; j < N; j++) {         dp[i][j].reserve(1024);         dp[i][j].max_load_factor(0.25);       }     for (int i = 0; i < N; i++) dp[0][i] = {0};     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) {         cin >> c;         g[i][j] = c -  0 ;       }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) {         for (auto el : dp[i - 1][j - 1]) dp[i][j].insert(el + g[i][j]);         for (auto el : dp[i - 1][j + 1]) dp[i][j].insert(el + g[i][j]);       }     for (int i = 1; i <= m; i++)       for (auto el : dp[n][i]) {         if (!(el % (k + 1))) {           if (ans < el) {             ans = el;             id = i;           }         }       }     cout << ans <<   n ;     if (ans == -1) return;     cout << id <<   n ;     for (int i = n; i > 1; i--) {       if (check(i - 1, id - 1, g[i][id])) {         id = id - 1;         cout <<  L ;       } else if (check(i - 1, id + 1, g[i][id])) {         id = id + 1;         cout <<  R ;       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     Solve();     return 0;   }   