func_code_string: #include <bits/stdc++.h>   using namespace std;   map<int, int> MP1, MP2;   map<int, int>::iterator it;   const int N = 300100;   const long long INF = 3000 * 1000 * 1000LL;   vector<int> v;   int a[N];   long long ps[N];   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int n, l, r;     long long ans = -INF;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       if (!MP1.count(a[i])) MP1[a[i]] = i;       MP2[a[i]] = i;       ps[i] += ps[i - 1];       if (a[i] > 0) ps[i] += a[i];     }     for (it = MP1.begin(); it != MP1.end(); it++) {       if (MP2[it->first] != it->second) {         long long t = ps[MP2[it->first]] - ps[it->second] + it->first;         if (it->first < 0) t += it->first;         if (t > ans) {           ans = t;           l = it->second;           r = MP2[it->first];         }       }     }     for (int i = 1; i <= n; i++)       if ((i != l && i != r && a[i] < 0) || (i < l || i > r)) v.push_back(i);     cout << ans <<     << v.size() << endl;     for (int u : v) cout << u <<    ;     cout << endl;     return 0;   }   