func_code_string: #include <bits/stdc++.h>   using namespace std;   void sc() {}   template <typename T, typename... Args>   void sc(T& a, Args&... args) {     cin >> a, sc(args...);   }   template <typename T>   void pr(T a) {     cout << a;   }   template <typename T, typename... Args>   void pr(T a, Args... args) {     cout << a <<    , pr(args...);   }   template <typename T>   void prl(T a) {     cout << a <<   n ;   }   template <typename T, typename... Args>   void prl(T a, Args... args) {     cout << a <<    , prl(args...);   }   template <typename T>   int sz(const T& a) {     return (int)a.size();   }   int dp[81][200003];   struct comp {     bool operator()(const pair<int, int>& lhs, const pair<int, int>& rhs) const {       return lhs.first + lhs.second <= rhs.first + rhs.second;     }   };   int main() {     cin.tie(NULL);     ios_base::sync_with_stdio(false);     int n, m;     sc(n, m);     pair<int, int> aten[n + 1];     aten[0] = {0, 0};     for (__typeof(2 * (m + 1)) i = (1) - ((1) > (2 * (m + 1)));          i != (2 * (m + 1)) - ((1) > (2 * (m + 1)));          i += 1 - 2 * ((1) > (2 * (m + 1))))       dp[0][i] = m + 1;     for (__typeof(n + 1) i = (1) - ((1) > (n + 1));          i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1))) {       sc(aten[i].first, aten[i].second);     }     sort(aten + 1, aten + n + 1, comp());     for (__typeof(n + 1) i = (1) - ((1) > (n + 1));          i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1))) {       dp[i][2 * (m + 1)] = m + 1;       for (__typeof(1) j = (2 * (m + 1)) - ((2 * (m + 1)) > (1));            j != (1) - ((2 * (m + 1)) > (1)); j += 1 - 2 * ((2 * (m + 1)) > (1))) {         int addneeded = 0;         if (j >= aten[i].first) {           addneeded = max(0, j - aten[i].first - aten[i].second);         } else           addneeded = max(0, aten[i].first - aten[i].second - j);         dp[i][j] = min(             dp[i][j + 1],             min(dp[i - 1][j],                 addneeded + (aten[i].first - aten[i].second - addneeded - 1 >= 0                                  ? dp[i - 1][aten[i].first - aten[i].second -                                              addneeded - 1]                                  : 0)));       }     }     prl(dp[n][m]);     return 0;   }   