#include <cstdio>

int a[200005]={};

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
    }
    long long mc=0;
    int ll=0;
    for(int i=0; i<n; i++)
    {
        mc+=(a[i]+ll)/3;
        ll=(a[i]+ll)%3;
        if(ll>a[i])
            ll=a[i];
    }
    printf("%lld",mc);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: