func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, ls[310];   int dp[110][310][310];   pair<int, int> p[110];   int L[110], R[110], x[110];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d%d , &p[i].first, &p[i].second);       ls[i * 3 - 2] = p[i].first - p[i].second;       ls[i * 3 - 1] = p[i].first;       ls[i * 3] = p[i].first + p[i].second;     }     sort(p + 1, p + n + 1);     sort(ls + 1, ls + n * 3 + 1);     int ex = unique(ls + 1, ls + n * 3 + 1) - ls;     for (int i = 1; i <= n; i++) {       L[i] = lower_bound(ls + 1, ls + ex, p[i].first - p[i].second) - ls;       x[i] = lower_bound(ls + 1, ls + ex, p[i].first) - ls;       R[i] = lower_bound(ls + 1, ls + ex, p[i].first + p[i].second) - ls;     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j < ex; j++) {         for (int k = j; k < ex; k++) {           dp[i][j][max(k, R[i])] = max(               dp[i][j][max(k, R[i])], dp[i - 1][j][k] + max(0, ls[R[i]] - ls[k]));           if (L[i] <= j)             dp[i][0][max(k, x[i])] =                 max(dp[i][0][max(k, x[i])],                     dp[i - 1][j][k] + max(0, ls[x[i]] - ls[k]));         }       }       for (int k = 1; k < ex; k++) {         if (k >= x[i])           dp[i][0][max(k, R[i])] = max(               dp[i][0][max(k, R[i])], dp[i - 1][0][k] + max(0, ls[R[i]] - ls[k]));         else           dp[i][0][R[i]] =               max(dp[i][0][R[i]], dp[i - 1][0][k] + ls[R[i]] - ls[x[i]]);         for (int j = k; j < x[i]; j++)           dp[i][j][R[i]] =               max(dp[i][j][R[i]], dp[i - 1][0][k] + ls[R[i]] - ls[j]);         if (k >= L[i])           dp[i][0][max(k, x[i])] = max(               dp[i][0][max(k, x[i])], dp[i - 1][0][k] + max(0, ls[x[i]] - ls[k]));         else           dp[i][0][x[i]] =               max(dp[i][0][x[i]], dp[i - 1][0][k] + ls[x[i]] - ls[L[i]]);         for (int j = k; j < L[i]; j++)           dp[i][j][x[i]] =               max(dp[i][j][x[i]], dp[i - 1][0][k] + ls[x[i]] - ls[j]);       }     }     int ans = 0;     for (int i = 1; i < ex; i++) ans = max(ans, dp[n][0][i]);     printf( %d n , ans);     return 0;   }   