func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int maxSubArraySum(long long int a[], long long int size) {     long long int max_so_far = INT_MIN, max_ending_here = 0;     for (long long int i = 0; i < size; i++) {       max_ending_here = max_ending_here + a[i];       if (max_so_far < max_ending_here) max_so_far = max_ending_here;       if (max_ending_here < 0) max_ending_here = 0;     }     return max_so_far;   }   int32_t main() {     long long int t;     t = 1;     while (t--) {       long long int n;       cin >> n;       long long int sum = 0;       long long int a[n];       string s;       vector<long long int> v;       long long int k;       cin >> k;       long long int b[n];       for (long long int i = 0; i < n; i++) {         cin >> a[i];         b[i] = a[i];       }       sort(b, b + n);       long long int p = 0;       for (long long int i = 0; i < n; i++) {         if (a[i] != b[i]) {           p = 1;           break;         }       }       if (p == 0) {         cout << maxSubArraySum(a, n);       } else {         long long int ansfinal = -1e9;         for (long long int i = 0; i < n; i++) {           for (long long int j = i; j < n; j++) {             long long int u = k;             long long int ans = 0;             priority_queue<long long int> pq;             priority_queue<long long int, vector<long long int>,                            greater<long long int>>                 pqmin;             for (long long int k = 0; k < n; k++) {               if (k >= i && k <= j) {                 ans += a[k];                 pqmin.push(a[k]);               } else {                 pq.push(a[k]);               }             }             while (u && pq.size() && pqmin.size()) {               if (pqmin.top() >= pq.top()) {                 break;               } else {                 ans -= pqmin.top();                 pqmin.pop();                 ans += pq.top();                 pq.pop();               }               u--;             }             ansfinal = max(ans, ansfinal);           }         }         cout << ansfinal;       }     }   }   