func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   const int N = 300001;   int dp[82][82][82][82], n, k, m, u, v, c;   vector<pair<int, int> > g[83];   int calc(int idx, int l, int r, int rem) {     if (rem == 0) return 0;     if (l > r) return 1e9;     int &ret = dp[idx][l][r][rem];     if (ret != -1) return ret;     ret = 1e9;     for (int i = 0; i < g[idx].size(); ++i) {       int v = g[idx][i].first;       int cost = g[idx][i].second;       if (v < l) continue;       if (v > r) continue;       ret = min(ret, cost + calc(v, v + 1, r, rem - 1));       ret = min(ret, cost + calc(v, l, v - 1, rem - 1));     }     return ret;   }   int main() {     memset(dp, -1, sizeof dp);     scanf( %d%d , &n, &k);     scanf( %d , &m);     for (int i = 0; i < m; ++i) {       scanf( %d%d%d , &u, &v, &c);       if (u == v) continue;       g[u].push_back(make_pair(v, c));     }     int ret = 1e9;     for (int i = 1; i <= n; ++i) {       ret = min(ret, calc(i, i + 1, n, k - 1));       ret = min(ret, calc(i, 1, i - 1, k - 1));     }     if (ret == 1e9) ret = -1;     printf( %d n , ret);     return 0;   }   