func_code_string: #include <bits/stdc++.h>   int main(void) {     int n;     int k;     int M;     scanf( %d%d%d , &n, &k, &M);     int number[45][45] = {0};     for (int i = 0; i < k; i++) {       int temp;       scanf( %d , &temp);       for (int j = 0; j < n; j++) {         number[j][i] = temp;       }     }     for (int i = 0; i < n; i++) {       std::sort(number[i], number[i] + k);     }     int ptrAddR = 0;     int ptrAddL = 0;     int ptrDelR = 0;     int ptrDelL = -1;     int lockR = 0;     int time = M;     int score = 0;     for (int i = 0; i < k; i++) {       for (int j = 0; j < n; j++) {         if (time >= number[j][i]) {           time -= number[j][i];           ptrDelL = j;           ptrDelR = i;         } else {           goto FAST_JUMP;         }       }     }   FAST_JUMP:     if (ptrDelL == n) {       score = (ptrDelR - 1 + 1) * n;     } else {       score = (ptrDelR - 1 + 1) * n + ptrDelL + 1;     }     if (ptrDelR == k - 1) {       lockR = ptrDelL + 1;       ptrAddL = lockR;       ptrAddR = k - 1;       score += lockR;     } else {       ptrAddR = ptrDelR + 1;       ptrAddL = 0;     }     if (ptrDelL <= lockR) {       ptrDelL = n - 1;       ptrDelR--;     }     int warning = 0;     int tptrAddR = ptrAddR;     int tptrAddL = ptrAddL;     int tptrDelR = ptrDelR;     int tptrDelL = ptrDelL;     int tlockR = lockR;     int flag = 0;     while (!(lockR >= n - 1 || ptrDelR < 0 || warning >= 2)) {       if (tptrDelL <= tlockR) {         tptrDelL = n - 1;         tptrDelR--;       }       time += number[tptrDelL][tptrDelR];       tptrDelL--;       if (tptrDelL <= tlockR) {         tptrDelL = n - 1;         tptrDelR--;       }       flag = -1;       if (tptrAddR > k - 1) {         tptrAddR = tptrDelR + 1;         tptrAddL++;         tlockR++;       }       if (tptrAddR > k - 1 || tptrAddL > n - 1) {         break;       }       if (time >= number[tptrAddL][tptrAddR]) {         time -= number[tptrAddL][tptrAddR];         flag = 0;         tptrAddR++;         if (tptrAddR > k - 1) {           tptrAddR = tptrDelR + 1;           tptrAddL++;           tlockR++;           flag = 1;         }       } else {       }       warning -= flag;       if (warning <= 0) {         score -= warning;         warning = 0;         ptrAddL = tptrAddL;         ptrAddR = tptrAddR;         ptrDelL = tptrDelL;         ptrDelR = tptrDelR;         lockR = tlockR;       }     }     printf( %d , score);     return 0;   }   