func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int arr[100000], arr1[100000], arr2[100000];   int main() {     int n, flag = 0;     cin >> n;     multiset<long long int> m;     multiset<long long int>::iterator it;     for (int i = 0; i < n; i++) {       cin >> arr[i];       m.insert(arr[i]);       if (i == 0)         arr1[i] = arr[i];       else         arr1[i] = arr1[i - 1] + arr[i];     }     for (int i = n - 1; i >= 0; i--) {       if (i == n - 1)         arr2[n - 1 - i] = arr[i];       else         arr2[n - 1 - i] = arr2[n - 2 - i] + arr[i];     }     if (arr1[n - 1] % 2 != 0)       cout <<  NO ;     else {       long long int sum = arr1[n - 1] / 2;       it = m.find(arr[0]);       m.erase(it);       if (arr1[0] == sum || arr2[0] == sum) flag = 1;       if (!flag) {         for (int i = 1; i < n - 1; i++) {           if (m.find(sum - arr1[i - 1]) != m.end()) {             flag = 1;             break;           }           if (!flag) {             int low = i + 1, high = n - 1;             while (low < high) {               int mid = low + (high - low + 1) / 2;               if (arr1[mid] - arr1[i] + arr1[i - 1] > sum)                 high = mid - 1;               else                 low = mid;             }             if (arr1[low] - arr1[i] + arr1[i - 1] == sum) {               flag = 1;               break;             }           }           it = m.find(arr[i]);           m.erase(it);         }       }       m.clear();       if (!flag) {         for (int i = 0; i < n; i++) m.insert(arr[i]);         it = m.find(arr[n - 1]);         m.erase(it);         for (int i = 1; i < n - 1; i++) {           if (m.find(sum - arr2[i - 1]) != m.end()) {             flag = 1;             break;           }           int low = i + 1, high = n - 1;           while (low < high) {             int mid = low + (high - low + 1) / 2;             if (arr2[mid] - arr2[i] + arr2[i - 1] > sum)               high = mid - 1;             else               low = mid;           }           if (arr2[low] - arr2[i] + arr2[i - 1] == sum) {             flag = 1;             cout << i << endl;             break;           }           it = m.find(arr[n - 1 - i]);           m.erase(it);         }       }       if (flag)         cout <<  YES ;       else         cout <<  NO ;     }     return 0;   }   