func_code_string: #include <bits/stdc++.h>   const int Inf = (int)(1e9);   const int K = 1000 + 1;   const int N = 60 + 1;   int w[N][N][N];   int n, m, r;   int ans[K][N][N];   void prepare() {     for (int i = 0; i < K; ++i)       for (int j = 0; j < N; ++j)         for (int k = 0; k < N; ++k) ans[i][j][k] = Inf;     for (int i = 0; i < m; ++i) {       for (int k = 0; k < n; ++k)         for (int ii = 0; ii < n; ++ii)           for (int jj = 0; jj < n; ++jj)             w[i][ii][jj] = std::min(w[i][ii][jj], w[i][ii][k] + w[i][k][jj]);       for (int ii = 0; ii < n; ++ii)         for (int jj = 0; jj < n; ++jj)           ans[0][ii][jj] = std::min(ans[0][ii][jj], w[i][ii][jj]);     }     for (int i = 1; i < K; ++i) {       for (int ii = 0; ii < n; ++ii)         for (int jj = 0; jj < n; ++jj) ans[i][ii][jj] = ans[i - 1][ii][jj];       for (int k = 0; k < n; ++k)         for (int ii = 0; ii < n; ++ii)           for (int jj = 0; jj < n; ++jj)             ans[i][ii][jj] =                 std::min(ans[i][ii][jj], ans[i - 1][ii][k] + ans[0][k][jj]);     }   }   int main() {     scanf( %d%d%d , &n, &m, &r);     for (int i = 0; i < m; ++i)       for (int j = 0; j < n; ++j)         for (int k = 0; k < n; ++k) scanf( %d , &w[i][j][k]);     prepare();     int si, ti, ki;     while (r-- > 0) {       scanf( %d%d%d , &si, &ti, &ki);       --si;       --ti;       printf( %d n , ans[ki][si][ti]);     }     return 0;   }   