func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:102400000,102400000 )   using namespace std;   int a[1005][1005];   int main() {     int N, K, D, i, j;   loop:     while (~scanf( %d%d%d , &N, &K, &D)) {       memset(a, 0, sizeof(a));       for (j = 0; j < N; ++j) {         a[D - 1][j] = j;       }       for (i = D - 1; i > 0; --i) {         for (j = 0; j < N; ++j) {           a[i - 1][j] += a[i][j] / K;           a[i][j] %= K;         }       }       for (i = 0; i < D; ++i) {         for (j = 0; j < N; ++j) {           if (a[i][j] >= K) {             puts( -1 );             goto loop;           }         }       }       for (i = 0; i < D; ++i) {         for (j = 0; j < N; ++j) {           printf( %d%s , a[i][j] + 1, j == N - 1 ?   n  :    );         }       }     }     return 0;   }   