func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, k;   int a[100010];   struct node {     int x, id;   } p[100010];   int main() {     while (scanf( %d%d , &n, &k) != EOF) {       for (int i = 1; i <= n; i++) {         scanf( %d , &a[i]);       }       int ans = 99999999;       int pos = 1;       for (int i = 1; i <= n; i++) {         bool flag = false;         int cnt = 0;         for (int j = i; j >= 1; j--) {           if (a[i] - (i - j) * k == a[j]) continue;           cnt++;           if (a[i] - (i - j) * k <= 0) {             flag = true;             break;           }         }         if (flag) continue;         int cnt1 = 0;         for (int j = i; j <= n; j++) {           if (a[i] + (j - i) * k == a[j]) continue;           cnt1++;         }         if (cnt1 + cnt < ans) {           ans = cnt1 + cnt;           pos = i;         }       }       printf( %d n , ans);       for (int j = 1; j <= pos; j++) {         if (a[j] + (pos - j) * k == a[pos]) continue;         if (a[j] < a[pos] - (pos - j) * k) {           printf( + %d %d n , j, a[pos] - (pos - j) * k - a[j]);         } else {           printf( - %d %d n , j, a[j] - (a[pos] - (pos - j) * k));         }       }       for (int j = pos; j <= n; j++) {         if (a[pos] + (j - pos) * k == a[j]) continue;         if (a[j] < a[pos] + (j - pos) * k) {           printf( + %d %d n , j, a[pos] + (j - pos) * k - a[j]);         } else {           printf( - %d %d n , j, a[j] - (a[pos] + (j - pos) * k));         }       }     }     return 0;   }   