func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 200009;   const int MOD = 1e9 + 7;   int main() {     ios_base::sync_with_stdio(false), cout.tie(0), cin.tie(0);     int n, k, v;     cin >> n >> k >> v;     vector<int> A(n + 1);     for (int i = 1; i <= n; ++i) cin >> A[i];     vector<pair<pair<int, int>, int>> ans;     if (v % k == 0) {       for (int i = 2; i <= n; ++i) {         if ((A[i] + k - 1) / k) ans.push_back({{(A[i] + k - 1) / k, i}, 1});         A[1] += A[i];       }       if (A[1] >= v) {         if (v) ans.push_back({{v / k, 1}, 2});         cout <<  YES n ;         for (int i = 0; i < ((int)(ans).size()); ++i) {           cout << ans[i].first.first <<     << ans[i].first.second <<                    << ans[i].second <<   n ;         }       } else {         cout <<  NO n ;       }       return 0;     }     vector<vector<int>> dp(n + 1, vector<int>(k + 1, 0));     dp[0][0] = 1;     for (int i = 1; i <= n; ++i) {       for (int j = 0; j < k; ++j) {         if (dp[i - 1][j] == 0) continue;         dp[i][j] = 1;         dp[i][(j + A[i]) % k] = 1;       }     }     if (!dp[n][v % k]) {       cout <<  NO n ;       return 0;     }     int cur = v % k;     vector<int> z, o;     for (int i = n; i; --i) {       if (dp[i - 1][((cur - A[i]) % k + k) % k]) {         o.push_back(i);         cur = ((cur - A[i]) % k + k) % k;       } else {         z.push_back(i);       }     }     for (int i = 1; i < ((int)(z).size()); ++i) {       if ((A[z[i]] + k - 1) / k)         ans.push_back({{(A[z[i]] + k - 1) / k, z[i]}, z[0]});       A[z[0]] += A[z[i]];     }     if (((int)(z).size()) && (A[z[0]]) / k)       ans.push_back({{(A[z[0]]) / k, z[0]}, o[0]}), A[o[0]] += (A[z[0]]) / k * k;     for (int i = 1; i < ((int)(o).size()); ++i) {       if ((A[o[i]] + k - 1) / k)         ans.push_back({{(A[o[i]] + k - 1) / k, o[i]}, o[0]});       A[o[0]] += A[o[i]];     }     if (A[o[0]] < v) {       cout <<  NO n ;       return 0;     }     int oth = o[0] + 1;     if (oth == n + 1) oth = 1;     if ((A[o[0]] - v)) ans.push_back({{(A[o[0]] - v) / k, o[0]}, oth});     cout <<  YES n ;     for (int i = 0; i < ((int)(ans).size()); ++i) {       cout << ans[i].first.first <<     << ans[i].first.second <<                << ans[i].second <<   n ;     }     return 0;   }   