func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long int n = 0, a = 0;     cin >> n >> a;     long long int ar[n];     long long int i = 0;     for (i = 0; i < n; i++) cin >> ar[i];     long long int pos = a - 1;     if (n == 1) {       if (ar[0] == 1)         cout <<  1  << endl;       else         cout <<  0  << endl;     } else if (n == 2) {       if ((ar[0] == 1) && (ar[1] == 1))         cout <<  2  << endl;       else if ((ar[0] == 1) || (ar[1] == 1))         cout <<  1  << endl;       else         cout <<  0  << endl;     } else {       long long int low = pos - 1;       long long int high = pos + 1;       long long int ans = 0;       if (ar[pos] == 1) ans++;       while ((low >= 0) || (high < n)) {         long long int l1 = ar[low];         long long int l2 = ar[high];         if ((low >= 0) && (high < n) && (l1 == 1) && (l2 == 1))           ans += 2;         else if ((low >= 0) && (high >= n) && (l1 == 1))           ans++;         else if ((low < 0) && (high < n) && (l2 == 1))           ans++;         else           ans = ans;         low--;         high++;       }       cout << ans << endl;     }   }   