func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e3 + 10;   const int inf = 0x3f3f3f3f;   int a[maxn];   int main() {     int n, k;     scanf( %d%d , &n, &k);     for (int i = 1; i <= k; ++i) scanf( %d , &a[i]);     int x = 2 * n, y = n;     for (int i = 1; i <= k; ++i) {       if (a[i] >= 4 && y > 0) {         int m = a[i] / 4;         a[i] -= min(m, y) * 4;         y -= min(m, y);       }     }     for (int i = 1; i <= k; ++i) {       if (x > 0) {         int m = a[i] / 2;         a[i] -= min(m, x) * 2;         x -= min(x, m);       }     }     int tmp = y;     for (int i = 1; i <= k; ++i) {       if (y > 0) {         int m = a[i] / 2;         a[i] -= min(m, y) * 2;         y -= min(m, y);       }     }     tmp = tmp - y + x;     for (int i = 1, j = k; i < j;) {       if (y > 0) {         int m = min(min(a[i], a[j]), y);         a[i] -= m, a[j] -= m, y -= m;       }       if (a[i] == 0) ++i;       if (a[j] == 0) --j;       if (y == 0) break;     }     tmp += y;     for (int i = 1; i <= k; ++i) {       if (tmp > 0) {         int m = min(tmp, a[i]);         a[i] -= m;         tmp -= m;       }     }     int f = 1;     for (int i = 1; i <= k; ++i) {       if (a[i] > 0) f = 0;     }     if (f)       printf( YES n );     else       printf( NO n );     return 0;   }   