func_code_string: #include <bits/stdc++.h>   using namespace std;   using lint = long long;   using ulint = unsigned long long;   const int N = 1500 + 1;   int a[N];   int bit[N];   int back[N];   int lsb(int x) { return x & -x; }   int query(int r) {     int res = 0;     for (; r > 0; r -= lsb(r)) {       res = max(res, bit[r]);     }     return res;   }   void update(int r, int k, int id) {     for (; r < N; r += lsb(r)) {       if (k > bit[r]) {         bit[r] = k;         back[r] = id;       }     }   }   int main(void) {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       a[i] += a[i - 1];     }     map<int, vector<pair<int, int>>> sums;     for (int l = 1; l <= n; l++) {       for (int r = l; r <= n; r++) {         sums[a[r] - a[l - 1]].emplace_back(l, r);       }     }     int best = -1, best_sum = -1;     for (auto &sum : sums) {       fill(begin(bit), end(bit), 0);       auto &vec = sum.second;       for (int i = 0; i < vec.size(); i++) {         auto [l, r] = vec[i];         update(r, query(l - 1) + 1, i);       }       if (query(n) > best) {         best = query(n);         best_sum = sum.first;       }     }     cout << best <<   n ;     fill(begin(bit), end(bit), 0);     fill(begin(back), end(back), -1);     auto &vec = sums[best_sum];     for (int i = 0; i < vec.size(); i++) {       auto [l, r] = vec[i];       int k = query(l - 1) + 1;       update(r, k, i);       if (k == best) {         l = n + 1;         for (int j = r; j >= 0; j--) {           if (best > 0 && bit[j] == best && vec[back[j]].second < l) {             cout << vec[back[j]].first <<     << vec[back[j]].second <<   n ;             best--;             l = vec[back[j]].first;           }         }         break;       }     }   }   