func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = INT_MAX;   const long long INFL = LLONG_MAX;   const long double pi = acos(-1);   int N;   int A[300100];   long long S[300100];   int shouldCut[300100];   map<int, vector<int> > mymap;   vector<int> v;   int main() {     ios_base::sync_with_stdio(0);     cout.precision(15);     cout << fixed;     cout.tie(0);     cin.tie(0);     cin >> N;     for (int(i) = 1, j123 = N; (i) <= j123; (i)++) {       cin >> A[i];       S[i] = max(0, A[i]);       S[i] += S[i - 1];       mymap[A[i]].push_back(i);       v.push_back(A[i]);     }     sort(v.begin(), v.end());     v.erase(unique(v.begin(), v.end()), v.end());     int mx = -2e9;     long long bestTot = -2e10;     int bestFirst = -1;     int bestLast = -1;     for (int(i) = 0, j123 = int(v.size()); (i) < j123; (i)++) {       if (int(mymap[v[i]].size()) > 1) {         sort(mymap[v[i]].begin(), mymap[v[i]].end());         int curfirst = mymap[v[i]].front();         int curlast = mymap[v[i]].back();         long long score = S[curlast - 1] - S[curfirst];         score += A[curfirst];         score += A[curlast];         if (score > bestTot) {           bestTot = score;           bestFirst = curfirst;           bestLast = curlast;         }       }     }     for (int i = 1; i < bestFirst; i++) shouldCut[i] = 1;     for (int i = N; i > bestLast; i--) shouldCut[i] = 1;     for (int i = bestFirst + 1; i <= bestLast - 1; i++)       if (A[i] < 0) shouldCut[i] = 1;     long long toteth = 0;     vector<int> vec;     for (int(i) = 1, j123 = N; (i) <= j123; (i)++) {       if (shouldCut[i])         vec.push_back(i);       else         toteth += A[i];     }     cout << toteth <<     << int(vec.size()) <<   n ;     for (int(i) = 0, j123 = int(vec.size()); (i) < j123; (i)++)       cout << vec[i] << (i + 1 < int(vec.size()) ?     :   n );     return 0;   }   