criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define sz size
#define pb push_back
#define int long long

const int N = 1e5 + 123;

int n, a[N], sum, ans;
int main() {
	//freopen("input.txt", "r", stdin);
	cin >> n;
	for(int i = 1; i <= n; ++i) {
		cin >> a[i];
		sum += a[i];
		if(a[i] == 0) {
			ans += (sum / 2);
			sum = 0;
		}
	}
	ans += (sum / 2);
	cout << ans;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[100005],b[100005];
int main()
{
	int n,s=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		b[i]=a[i];
		s+=a[i]/2;
		a[i]=a[i]%2;
	}
	for(int i=1;i<n-1;i++)
	{
		if(a[i]==1)
		{
		    if(a[i+1]==1)
		    {
		    	s++;
		    	a[i]--;
		    	a[i+1]--;
			}
			if(a[i-1]==1)
			{
				s++;
				a[i]--;
				a[i-1]--;
			}	
		}
	}
	for(i=0;i<n;i++)
	{
		a[n]+=a[i];
	}
	if(a[i]<1)
	{
		cout<<s;
		return 0;
	}
	else
	{
		s=0;
		for(int i=1;i<n-1;i++)
	    {
			if(b[i]>=1)
		 	{
			    if(b[i+1]>=1)
			    {
		    	    s++;
		    	    b[i]--;
		    	    b[i+1]--;
				}
				if(b[i-1]>=1)
				{
					s++;
					b[i]--;
					b[i-1]--;
				}	
			}	
		}
		cout<<s;
		return 0;
	}	

Compiler output:
a.cc: In function 'int main()':
a.cc:33:13: error: 'i' was not declared in this scope
   33 |         for(i=0;i<n;i++)
      |             ^
a.cc:37:14: error: 'i' was not declared in this scope
   37 |         if(a[i]<1)
      |              ^
a.cc:65:16: error: expected '}' at end of input
   65 |         }
      |          ^      
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a[100005];
    bool vis[100005];
    while(scanf("%d",&n)!=EOF)
    {
        long long ans=0;
        memset(vis,false,sizeof(vis));
        for(int i=0; i<n; i++)
        {
            scanf("%d",&a[i]);
            if(a[i])vis[i]=true;
            ans+=a[i]/2;
            a[i]%=2;
        }
        for(int i=1; i<n; i++)
        {
            if(a[i]&&a[i-1])
            {
                a[i]=0;
                a[i-1]=0;
                ans++;
            }
            else if(a[i]==0&&a[i-1])
                if(vis[i]) a[i]++,a[i-1]--;
        }
        printf("%lld\n",ans);
    }
    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:11: error: 'scanf' was not declared in this scope
    7 |     while(scanf("%d",&n)!=EOF)
      |           ^~~~~
a.cc:7:27: error: 'EOF' was not declared in this scope
    7 |     while(scanf("%d",&n)!=EOF)
      |                           ^~~
a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include<bits/stdc++.h>
a.cc:10:9: error: 'memset' was not declared in this scope
   10 |         memset(vis,false,sizeof(vis));
      |         ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | include<bits/stdc++.h>
a.cc:29:9: error: 'printf' was not declared in this scope
   29 |         printf("%lld\n",ans);
      |         ^~~~~~
a.cc:29:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include<bits/stdc++.h>
using namespace std;

#define int long long
int n;
int a[100010];
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	int ans=a[0]/2,f=a[0]%2;
	for(int i=1;i<n;i++){
		if(f&&a[i]){
			a[i]--;
			ans++;
		}
		ans+=a[i]/2;
		f=a[i]%2;
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'i' was not declared in this scope
    9 |         rep(i,n)cin>>a[i];
      |             ^
a.cc:9:9: error: 'rep' was not declared in this scope
    9 |         rep(i,n)cin>>a[i];
      |         ^~~
Language: C++

\#include<bits/stdc++.h>
using namespace std;

int n,a[100001],ans;
int main()
{
	cin>>n;
    for(int i=0;i<n;i++)
    	cin>>a[i];
    for(int i=0;i<n;i++)
    {
        ans+=a[i]/2;
        a[i]%=2;
        if(i<n-1&&a[i]&&a[i+1])
            ans++,a[i]--,a[i+1]--;
	}
    cout<<ans;
    return 0;
}

Compiler output:
a.cc:1:1: error: stray '\' in program
    1 | \#include<bits/stdc++.h>
      | ^
a.cc:1:2: error: stray '#' in program
    1 | \#include<bits/stdc++.h>
      |  ^
a.cc:1:3: error: 'include' does not name a type
    1 | \#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin>>n;
      |         ^~~
a.cc:17:5: error: 'cout' was not declared in this scope
   17 |     cout<<ans;
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int A[i];
int main()
{
	int N;
	cin>>N;
	long long ans=0;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		ans+=A[i]/2;
		A[i]%=2;
		if(i>0)
			if(A[i]==A[i-1])
				ans+=A[i],
				A[i]=0;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:3:7: error: 'i' was not declared in this scope
    3 | int A[i];
      |       ^
a.cc: In function 'int main()':
a.cc:11:22: error: 'A' was not declared in this scope
   11 |                 cin>>A[i];
      |                      ^
Language: C++

#include<bits/stdc=+>h>
using namespace std;

#define N 100010
#define ll long long

int n,a[N];
ll ans;

int main(){
	ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++){
        ans+=a[i]/2;
        a[i]%=2;
        if(i<n&&a[i]&&a[i+1]){
            ans++;
            a[i]--;
            a[i+1]--;
        }
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc:1:23: warning: extra tokens at end of #include directive
    1 | #include<bits/stdc=+>h>
      |                       ^
a.cc:1:9: fatal error: bits/stdc=+>: No such file or directory
    1 | #include<bits/stdc=+>h>
      |         ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n;
    cin >> n;
  int a[100010];
  int ans =0;
  
  for(int i=0;i<n;i++){
    cin >> a[i] ;
    
  }
  
  for(int i=0;i<n;i++){
    
    ans += a[i]/2;
    
    if(a[i]%2 != 0 && a[i+1] != 0){
      
      ans++;
      a[i+1]--;
    }
    
      
  
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n;
    cin >> n;
  int a[100010];
  
  for(int i=0;i<n;i++){
    cin >> a[i] ;
    ans += a[i]/2;
  }
  
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |     ans += a[i]/2;
      |     ^~~
      |     abs
a.cc:16:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: Java

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] A = new long[n];
        for (int i = 0; i < n; ++i) {
            A[i] = sc.nextLong();
        }

        long res = 0L
        for (int i = 0; i < n; ++i) {
            res += A[i] / 2;
            A[i] %= 2L;

            if (A[i] > 0 && i + 1 < n && A[i + 1] > 0) {
                A[i + 1]--;
                A[i]--;
                res++;
            }
        }

        System.out.println(res);
    }
}


Compiler output:
Main.java:12: error: ';' expected
        long res = 0L
                     ^
1 error
Language: C++

#include <iostream>
using namespace std;
const int maxn = 100100100;
typedef long long int ll;
int n;
ll int a[maxn];
ll sum = 0;
int main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int i = 1; i <= n - 1; i = i + 2){
        if(a[i] >= a[i + 1]){
            sum += a[i + 1];
            a[i] -= a[i + 1];
            a[i + 1] = 0;
        }
        else {
            sum += a[i];
            a[i + 1] -= a[i];
            a[i] = 0;
        }
    }
    for(int i = 1; i <= n; i++){
        if (a[i] % 2 == 0){
            sum += a[i] / 2;
        }
        else {
            sum += (a[i] - 1) / 2;
        }
    }
    cout << sum << endl;
    return 0;
}


Compiler output:
a.cc:6:1: error: two or more data types in declaration of 'a'
    6 | ll int a[maxn];
      | ^~
a.cc: In function 'int main()':
a.cc:11:16: error: 'a' was not declared in this scope
   11 |         cin >> a[i];
      |                ^
a.cc:14:12: error: 'a' was not declared in this scope
   14 |         if(a[i] >= a[i + 1]){
      |            ^
a.cc:26:13: error: 'a' was not declared in this scope
   26 |         if (a[i] % 2 == 0){
      |             ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))

#define rep(i,n) for(auto i=0; i<(n); i++)

const int mod = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;
  vector<long> a(n);
  fillLong(a, n);
  sortv(a, n);

  int res = 0;

  rep(i, n-1) {
    if (abs(a[i]-a[i+1]) <= 1) {
      res++;
      i++;
    }
  }

  cout << res << endl;
}


Compiler output:
a.cc:59:13: error: macro "sortv" passed 2 arguments, but takes just 1
   59 |   sortv(a, n);
      |             ^
a.cc:38:9: note: macro "sortv" defined here
   38 | #define sortv(xs) sort(xs.begin(), xs.end())
      |         ^~~~~
a.cc: In function 'int main()':
a.cc:59:3: error: 'sortv' was not declared in this scope
   59 |   sortv(a, n);
      |   ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A(N+1);
  for(int i=0; i<N; i++){
    cin >> A.at(i);  
  }
  A.at(N)=0;
  int ans=0;
  for(int i=0; i<N; i++){
    ans+= (A.at(i)+A.at(i+1))/2;
    A.at(i+1)-= (A.at(i)+A.at(i+1))/2*2-A.at(i));
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:48: error: expected ';' before ')' token
   15 |     A.at(i+1)-= (A.at(i)+A.at(i+1))/2*2-A.at(i));
      |                                                ^
      |                                                ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll ,ll >
#define pii pair<int, int> 
#define mod 1000000007
ll power(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b%2!=0) res=(res*a);
        a=(a*a);
        b/=2;
        if(res>INT_MAX){
            return INT_MAX;
        }
    }
    return res;
}
ll ncr(ll n,ll k){
    if(k==0||k==n) return 1ll;
    if(k>n-k) k=n-k;
    ll pro=1;
    for(ll i=0;i<k;i++){
        pro=(pro*(n-i))%mod;
        pro/=(i+1);
    }
    return (pro%mod);
}
vector<int> prime;
void seive(){
    vector<bool > isprime(101,true);
    for(int i=2;i*i<=100;i++){
        if(isprime[i]){
            for(int j=i*i;j<=100;j+=i){
                isprime[j]=false;
            }
        }
    }
    for(int i=2;i<=100;i++){
        if(isprime[i]) prime.push_back(i);
    }
}
int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    vector<ll> arr(n);
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    for(int i=0;i<n;i++){
        ll x=0;
        while(i<n && arr[i]!=0){
            x+=arr[i]
            i++;
        }
        sum+=x/2;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:22: error: expected ';' before 'i'
   60 |             x+=arr[i]
      |                      ^
      |                      ;
   61 |             i++;
      |             ~
Language: C++

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    long long result = , sum = 0;
    for (int i = 0, a; i < n; i++) {
        cin >> a;
        if (a == 0) {
            result += sum / 2;
            sum = 0;
        } else {
            sum += a;
        }
    }
    result += sum / 2;
    cout << result;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:24: error: expected primary-expression before ',' token
    7 |     long long result = , sum = 0;
      |                        ^
a.cc:11:23: error: 'sum' was not declared in this scope
   11 |             result += sum / 2;
      |                       ^~~
a.cc:14:13: error: 'sum' was not declared in this scope
   14 |             sum += a;
      |             ^~~
a.cc:17:15: error: 'sum' was not declared in this scope
   17 |     result += sum / 2;
      |               ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,a[1000000005],ans=0,duishu;
void dui(int x)
{
	int left=n;
	int min=n;
	duishu=0;
	for(int j=x+1;j<n;j++)
	{
		if(a[x]-a[j]>=-1 && a[x]-a[j]<=1)
		{
			duishu++;
			left=left-2;
		}
		if(left<min)
		{
			ans=duishu;
		}
		duishu=0;
	}
}
int main()
{
	int max=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i=0;i<n;i++)
	{
		dui(i);
		if(ans>max)
		{
			max=ans;
		}
	}
	cout<<max;
	return 0;
}

Compiler output:
/tmp/ccoTCRJs.o: in function `dui(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `duishu' defined in .bss section in /tmp/ccoTCRJs.o
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `duishu' defined in .bss section in /tmp/ccoTCRJs.o
a.cc:(.text+0xa6): relocation truncated to fit: R_X86_64_PC32 against symbol `duishu' defined in .bss section in /tmp/ccoTCRJs.o
a.cc:(.text+0xb8): relocation truncated to fit: R_X86_64_PC32 against symbol `duishu' defined in .bss section in /tmp/ccoTCRJs.o
a.cc:(.text+0xbe): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccoTCRJs.o
a.cc:(.text+0xc4): relocation truncated to fit: R_X86_64_PC32 against symbol `duishu' defined in .bss section in /tmp/ccoTCRJs.o
/tmp/ccoTCRJs.o: in function `main':
a.cc:(.text+0x166): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccoTCRJs.o
a.cc:(.text+0x171): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccoTCRJs.o
collect2: error: ld returned 1 exit status
Language: C++

/* it was worth becoming a chemist */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int uni;
typedef unsigned long long unll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef pair<int, long long> pil;
typedef vector<int> vi;
typedef vector<long long> vll;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
#define NAME "puts"
#define F first
#define S second

const ll INF = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 7;
const db EPS = (db) 1e-9;
const db pi = acos(-1.0);
const int MAXN = 1e5 + 5;

int n;
ll a[MAXN];
ll dp[MAXN];


int main() {

    cin >> n;
    for (int i = 1; i <= n; i++) {
    	cin >> a[i];
    }
    dp[1] = (a[i] >> 1ll);
    for (int i = 2; i <= n; i++) {
   		dp[i] = max(dp[i - 1] + (a[i] >> 1ll), dp[i - 2] + min(a[i], a[i - 1]));
   	}
   	cout << dp[n];
    return 0;
}                  


Compiler output:
a.cc: In function 'int main()':
a.cc:44:16: error: 'i' was not declared in this scope; did you mean 'vi'?
   44 |     dp[1] = (a[i] >> 1ll);
      |                ^
      |                vi
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  bool odd=false;
  long sum=0;
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    if(odd){
      sum++;
      a--:
    }
    sum+=a/2;
    if(a%2==1)odd=true;
    else odd=false;
  }
  cout << sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: expected ';' before ':' token
   14 |       a--:
      |          ^
      |          ;
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
using namespace std;
int main(void){
    int n;cin>>n;vector<int>v(n);
    int ans=0;
    int x;rep(i,n){cin>>x;ans+=x/2;v[i]=x%2;}
    rep(i,n-1){
        if(v[i]==1 && v[i+1]==1){ans++;i++;}
    }
    cout<<ans<<endl;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
using namespace std;
int main(void){
    int n;vector<int>v(n);
    int ans=0;
    int x;rep(i,n){cin>>x;ans+=x/2;v[i]=x%2;}
    rep(i,n-1){
        if(v[i]==1 && v[i+1]==1){ans++;i++;}
    }
    cout<<ans<<endl;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 1e18
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<ll> a(n+1);
    REP(i,n){
        cin>>a[i];
    }
    a[n]=0;
    ll ans=0;
    REP(i,n){
        ans+=a[i]/2;
        a[i]%=2;
        if(A[i]>0&&A[i+1]>0){
            ++ans;
            --a[i];
            --a[i+1];
        }
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:12: error: 'A' was not declared in this scope
   42 |         if(A[i]>0&&A[i+1]>0){
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
define int long long
signed main(){
	int n;cin>>n;
	vector<int>a(n);
	for(auto&& w:a)cin>>w;
	int sm=0,cnt=0;
	for(int i=0;i<n;i++){
	sm+=a[i]/2;
	}
	for(int i=0;i<n;i++){
		if(a[i]%2==1)cnt++;
		else {sm+=cnt/2;cnt=0;}
	}
	if(cnt>0)sm+=cnt/2;
	cout<<sm<<endl;
}

Compiler output:
a.cc:3:1: error: 'define' does not name a type
    3 | define int long long
      | ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
 
int main(){
 int n;
  cin>>n;
  int val[n];
  rep(i, n){
cin>>val[i];}
  
  sort(val,val+n,grater<int>());
  
  ll cnt=0;
  rep(i, n){
    cnt+=val[i]/2;
    val[i]=val[i]%2;}
  
  for(int i=1;i<n;i++){
    if(val[i]==1&&val[i-1]==1){
      cnt++;
      val[i]=0;
      val[i-1]=0;
    }
  }
  
  cout<<cnt<<endl;
  
  
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:18: error: 'grater' was not declared in this scope
   15 |   sort(val,val+n,grater<int>());
      |                  ^~~~~~
a.cc:15:25: error: expected primary-expression before 'int'
   15 |   sort(val,val+n,grater<int>());
      |                         ^~~
Language: C++

#include <algorithm>
#include <chrono>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using llong = long long;
using ullong = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()
#define loop(i, times) for(llong i = 0; i < times; i++)
#define rloop(i, times) for(llong i = times -1; 0 <= i; i--)

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << endl <<msec << " msec" << endl;
}

#endif


class AGC003B
{
public:
	AGC003B()
	{
		cin >> n_;
		a_collection_.resize(n_);
		loop(i, n_)
			cin >> a_collection_[i];
		ans_ = 0;
	}
	void Run(void)
	{
		loop(i, n_-1)
		{
			if (a_collection_[i+1] > 0)
			{
				a_collection_[i + 1] -= a_collection_[i] % 2;
				ans_+= a_collection_[i] % 2;
			}
		}
		ans_ += a_collection_[i] / 2;

		cout << ans_;
	}
private:
	llong n_;
	llong ans_;
	vector<llong> a_collection_;
};

int main(void)
{
	AGC003B agc003b;
	agc003b.Run();

	return 0;
}


Compiler output:
a.cc: In member function 'void AGC003B::Run()':
a.cc:65:39: error: 'i' was not declared in this scope
   65 |                 ans_ += a_collection_[i] / 2;
      |                                       ^
Language: C++

#include <algorithm>
#include <chrono>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using llong = long long;
using ullong = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()
#define loop(i, times) for(llong i = 0; i < times; i++)
#define rloop(i, times) for(llong i = times -1; 0 <= i; i--)

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << endl <<msec << " msec" << endl;
}

#endif

#pragma once

#include "Macro.h"

class AGC003B
{
public:
	AGC003B()
	{
		cin >> n_;
		a_collection_.resize(n_);
		loop(i, n_)
			cin >> a_collection_[i];
	}
	void Run(void)
	{
		cout << max(FrontMethod(), ModMethod());
	}
private:
	llong FrontMethod(void)
	{
		llong ans = 0;

		loop(i, n_ - 1)
		{
			if (a_collection_[i] != 0 && a_collection_[i + 1] != 0)
			{
				ans += 1;
				a_collection_[i]--;
				a_collection_[i + 1]--;
			}
		}

		for (const auto& elm_a : a_collection_)
			ans += elm_a / 2;

		return ans;
	}
	llong ModMethod(void)
	{
		llong ans = 0;
		vector<llong> mod_collection;

		for (const auto& elm_a : a_collection_)
		{
			ans += elm_a / 2;
			mod_collection.push_back(elm_a % 2);
		}

		loop(i, n_ - 1)
		{
			if (mod_collection[i] + mod_collection[i + 1] == 2)
			{
				ans += 1;
				mod_collection[i] = 0;
				mod_collection[i + 1] = 0;
			}
		}

		return ans;
	}
	llong n_;
	vector<llong> a_collection_;
};

int main(void)
{
	AGC003B agc003b;
	agc003b.Run();

	return 0;
}


Compiler output:
a.cc:43:9: warning: #pragma once in main file
   43 | #pragma once
      |         ^~~~
a.cc:45:10: fatal error: Macro.h: No such file or directory
   45 | #include "Macro.h"
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
typedef long long ll;
int n;
ll a[100005];
ll dp[100005][2]; 
int main(){
	cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i];
	if(a[1]!=0)dp[1][1]=(a[1]-1ll)/2ll;
	else dp[1][1]=-1e9;
	dp[1][0]=a[1]/2ll;
	for (int i=2;i<=n;i++){
		if(a[i]==0ll) dp[i][1]=-1e9,dp[i][0]=dp[i-1][0];
		else{
			dp[i][1]=(a[i]-1ll)/2ll+dp[i-1][0];
			if (a[i]>=2ll) dp[i][1]=max(dp[i][1],dp[i-1][1]+1ll+(a[i]-2ll)/2ll);
			dp[i][0]=max(a[i]/2ll+dp[i-1][0],dp[i-1][1]+1ll+(a[i]-1ll)/2ll); 
		}
	}
	cout<<dp[n][0];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |         cin>>n;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:16:49: error: 'max' was not declared in this scope; did you mean 'std::max'?
   16 |                         if (a[i]>=2ll) dp[i][1]=max(dp[i][1],dp[i-1][1]+1ll+(a[i]-2ll)/2ll);
      |                                                 ^~~
      |                                                 std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:17:34: error: 'max' was not declared in this scope; did you mean 'std::max'?
   17 |                         dp[i][0]=max(a[i]/2ll+dp[i-1][0],dp[i-1][1]+1ll+(a[i]-1ll)/2ll);
      |                                  ^~~
      |                                  std::max
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:20:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   20 |         cout<<dp[n][0];
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int n,a[N],cnt,ans;
long long sum;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]),sum+=a[i],a[i]%=2;
	for(int i=1;i<=n;i++)
	{
		if(a[i]==1)
			cnt++;
		else
		{
			if(cnt%2==1)
				ans++;
			cnt=0;
		}
	}
	cout<<(sum-ans)/2;
	return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265


const int N = 1e5+5;
ll n,a[N];


void solve()
{
       cin>>n;
       ll ans=0, prv=0;
       while(n--)
       {
              ll x; cin>>x;
              if(x==0) continue;
              x += prv;
              ans += x/2;
              prv = a%2;
       }
       cout<<ans;    
}


int main()
{
    speed_up
    ll T=1;
    //cin>>T;
    while(T--)
        solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:35:22: error: invalid operands of types 'long long int [100005]' and 'int' to binary 'operator%'
   35 |               prv = a%2;
      |                     ~^~
      |                     | |
      |                     | int
      |                     long long int [100005]
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
ll N;
ll a[100010];
int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        ans += (a[i]/2);
        a[i] %= 2;
    }
    ll ans = 0;
    for(int i = 0; i < N; i++){
        if(a[i] == 1 && i < N-1 && a[i+1] > 0){
            ans++;
            a[i+1]--;
        }
    }
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |         ans += (a[i]/2);
      |         ^~~
      |         abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
ll N;
ll a[100010];
int main(){
    cin >> N;
    ll ans = 0;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        ans += (a[i]/2);
        a[i] %= 2;
    }
    ll ans = 0;
    for(int i = 0; i < N; i++){
        if(a[i] == 1 && i < N-1 && a[i+1] > 0){
            ans++;
            a[i+1]--;
        }
    }
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:27:8: error: redeclaration of 'll ans'
   27 |     ll ans = 0;
      |        ^~~
a.cc:21:8: note: 'll ans' previously declared here
   21 |     ll ans = 0;
      |        ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[100005];

int main()
{
    int N;
    cin >> N;
    REP(i, N)
    {
        cin >> A[i];
    }
    REP(i, N - 1)
    {
        if (A[i] % 2 == 1)
        {
            ll s = std::min(1LL, A[i + 1]);
            A[i] += s;
            A[i + 1] -= s;
        }
    }
    ll sum = 0;
    REP(i, N)
    {
        sum += A[i] / 2;
    }
    cout << sum << endl;
    return 0;
}#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[100005];

int main()
{
    int N;
    cin >> N;
    REP(i, N)
    {
        cin >> A[i];
    }
    REP(i, N - 1)
    {
        if (A[i] % 2 == 1)
        {
            ll s = std::min(1LL, A[i + 1]);
            A[i] += s;
            A[i + 1] -= s;
        }
    }
    ll sum = 0;
    REP(i, N)
    {
        sum += A[i] / 2;
    }
    cout << sum << endl;
    return 0;
}

Compiler output:
a.cc:40:2: error: stray '#' in program
   40 | }#include <bits/stdc++.h>
      |  ^
a.cc:40:3: error: 'include' does not name a type
   40 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:50:10: error: redefinition of 'const ll MOD'
   50 | const ll MOD = 1000000007;
      |          ^~~
a.cc:11:10: note: 'const ll MOD' previously defined here
   11 | const ll MOD = 1000000007;
      |          ^~~
a.cc:51:10: error: redefinition of 'const ll INF'
   51 | const ll INF = (ll)1e15;
      |          ^~~
a.cc:12:10: note: 'const ll INF' previously defined here
   12 | const ll INF = (ll)1e15;
      |          ^~~
a.cc:53:4: error: redefinition of 'll A [100005]'
   53 | ll A[100005];
      |    ^
a.cc:14:4: note: 'll A [100005]' previously declared here
   14 | ll A[100005];
      |    ^
a.cc:55:5: error: redefinition of 'int main()'
   55 | int main()
      |     ^~~~
a.cc:16:5: note: 'int main()' previously defined here
   16 | int main()
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

int main() {
  cin.tie(0); ios::sync_with_stdio(false);

  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  ll ans = 0;
  if (n == 1) {
    cout << n/2 << enld;
    return 0;
  }
  rep(i, n-1) {
    ll tmp = (a[i]+a[i+1]) / 2;
    if (tmp > 0) {
      ans += tmp;
      a[i+1] = (a[i]+a[i+1]) % 2;
    }
    cerr << ans << endl;
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:20: error: 'enld' was not declared in this scope
   19 |     cout << n/2 << enld;
      |                    ^~~~
Language: C++

#include<iostream>
using namespace std;
int arr[100000+50];
int main(){
  int n; cin>>n;
  long long cnt=0;
  for(int i=0;i<n;i++) cin>>arr[i];
  for(int i=0;i<n-1;i++){
   	 if(arr[i]%2!=0 && arr[i+1]>0){
     cnt+=arr[i]/2+1; arr[i+1]--;
     }
    else {
      cnt+=arr[i]/2;
    }
  }
  cout<<count;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'count' was not declared in this scope; did you mean 'cnt'?
   16 |   cout<<count;
      |         ^~~~~
      |         cnt
Language: C++

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
  int n, a[100500], ans;

int main(){
  
  cin >> n;
  for(int i=1;i<=n;i++){
    cin >> a[i];
  }int cnt = 0;
  for(int i=1;i<=n;i++){
    if(a[i] == 0){
      ans += cnt / 2;
      cnt = 0;
      continue;
    }
    cnt += a[i];
  }
  if(cnt > 0)ans += s / 2;
  cout << ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:21: error: 's' was not declared in this scope
   20 |   if(cnt > 0)ans += s / 2;
      |                     ^
Language: C++

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
  int n, a[100500], ans;

int main(){
  
  cin >> n;
  for(int i=1;i<=n;i++){
    cin >> a[i];
  }int cnt = 0;
  for(int i=1;i<=n;i++){
    if(a[i] == 0){
      ans += cnt / 2;
      cnt = 0;
      continue;
    }
    cnt += a[i];
  }
  if(s > 0)ans += s / 2;
  cout << ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:6: error: 's' was not declared in this scope
   20 |   if(s > 0)ans += s / 2;
      |      ^
Language: C++

#include <bits/stdc++.h>
#define LL long long 
#define N 1000005
using namespace std;
LL int n,ar[N],sum;
char c[N];
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++
		scanf("%d",&ar[i]);
	for(int i=1;i<=n;i++)
	{
		sum+=ar[i]/2;
		if(ar[i]%2 && ar[i+1])
			sum++,ar[i+1]--;
	}
	//~ for(int i=1;i<=n;i++)
	//~ {
		//~ if(ar[i]==1 && ar[i+1]==1)
			//~ sum++,ar[i+1]=0,ar[i]=0;
	//~ }
	printf("%lld",sum);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: expected ')' before 'scanf'
   10 |         for(int i=1;i<=n;i++
      |            ~                ^
      |                             )
   11 |                 scanf("%d",&ar[i]);
      |                 ~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<numeric>
#include<iomanip>
#include<utility>
#include<cstdlib>
#include<typeinfo>


using namespace std;
#define INF 1000000005
int main()
{
int n;
std::vector<int> a;
std::cin >> n;
std::vector<int> b(n,0);
std::vector<int> c(n,0);

for(int i = 0; i < n; i++){
    int temp;
    std::cin >> temp;
    a.push_back(temp);
}
for(int i = 0; i < n; i++){
    b[i] = a[i];
    c[i] = a[i];
}
long long int suma = 0;

for(int i = 0; i < n - 1; i++){
    if(a[i] % 2 == 1){
        if(a[i + 1] > 0){
            a[i]--;
            a[i + 1]--;
            suma++;
        }
    }
}

for(int i = 0; i < n; i++){
    if(a[i] >= 2){
        int temp = a[i] / 2;
        suma += temp;
    }
    if(b[i] >= 2){
        int temp = b[i] / 2;
        sumb += temp;
    }
}

std::cout << suma << std::endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:9: error: 'sumb' was not declared in this scope; did you mean 'suma'?
   55 |         sumb += temp;
      |         ^~~~
      |         suma
Language: C++

#pragma GCC optimize(2)
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
	int n,a[100005];
	bool vis[100005];
	while(scanf("%d",&n)!=EOF) {
		LL ans=0;
		memset(vis,false,sizeof(vis));
		for(int i=0; i<n; i++) {
			scanf("%d",&a[i]);
			if(a[i])vis[i]=true;
			ans+=a[i]/2;
			a[i]%=2;
		}
		for(int i=1; i<n; i++) {
			if(a[i]&&a[i-1]) {
				a[i]=0;
				a[i-1]=0;
				ans++;
			} else if(a[i]==0&&a[i-1])
				if(vis[i]) a[i]++,a[i-1]--;
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'LL' was not declared in this scope; did you mean 'll'?
    9 |                 LL ans=0;
      |                 ^~
      |                 ll
a.cc:14:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |                         ans+=a[i]/2;
      |                         ^~~
      |                         abs
a.cc:21:33: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |                                 ans++;
      |                                 ^~~
      |                                 abs
a.cc:25:33: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |                 printf("%lld\n",ans);
      |                                 ^~~
      |                                 abs
Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+20;

inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch&15);ch=getchar();}
	return x*f;
}

int n,a[N];ll ans;

int main()
{
	n=read();
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<n;i++)
	{
		ans+=a[i]/2;a[i]%=2;
		if(a[i] && a[i+1]) ans++,a[i+1]--;
	}
	printf("%lld\n",ans);return 0;
}

Compiler output:
a.cc:14:12: error: 'll' does not name a type
   14 | int n,a[N];ll ans;
      |            ^~
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:22:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |                 ans+=a[i]/2;a[i]%=2;
      |                 ^~~
      |                 abs
a.cc:25:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |         printf("%lld\n",ans);return 0;
      |                         ^~~
      |                         abs
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const int mnx = 3e5 + 9;
const int mod = 1e9 + 7;

ll n;
ll a[mnx];

int main(){

cin>>n;

for(int i=1; i<=n; i++){
    cin>>a[i];
}

for(int i=1; i<=n; i++){
    ans += a[i] / 2;
    if(a[i] % 2 != 0 && a[i+1] != 0){ ans++; a[i+1]--; }
}

cout<<ans<<'\n';

return 0;

}














Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |     ans += a[i] / 2;
      |     ^~~
      |     abs
a.cc:25:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 | cout<<ans<<'\n';
      |       ^~~
      |       abs
Language: C++

#include "stdafx.h"


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define INF 1e9
#define PI acos(-1)
typedef long long ll;
typedef pair<int, int> p_ii;



int main() {
	int i, n; cin >> n;
	vector<int> a(n);
	ll ans = 0;
	for (i = 0; i < n; i++)cin >> a[i];

	for (i = 1; i < n; i++) {
		if (i != n - 1 && a[i] % 2 == 0 && a[i - 1] % 2 == 1 && a[i + 1] % 2 == 1 && a[i] > 0 && a[i - 1] > 0 && a[i + 1] > 0) {
			ans += (a[i - 1] - 1) / 2;
			ans += (a[i + 1] - 1) / 2;
			ans += 2;
			a[i - 1] = 0;
			a[i + 1] = 0;
			ans += (a[i] - 2) / 2;
			a[i] = 0;
			i++;
		}
		else if (a[i] % 2 == 1 && a[i - 1] % 2 == 0 ) {
			ans += a[i - 1]/2;
			a[i - 1] = 0;
			ans += a[i] / 2;
			a[i] = 1;
		}
		else if (i != n - 1 && a[i] % 2 == 0 && a[i - 1] % 2 == 1 && a[i + 1] % 2 == 0 ) {
			ans += a[i - 1] / 2;
			a[i - 1] = 1;
			ans += a[i] / 2;
			a[i] = 0;
			ans += a[i + 1] / 2;
			a[i + 1] = 0;
			i++;
		}
		else if (a[i] % 2 == 0 && a[i - 1] % 2 == 0 ) {
			ans += a[i] / 2;
			a[i] = 0;
			ans += a[i - 1] / 2;
			a[i - 1] = 0;
		}
		else if (a[i] % 2 == 1 && a[i - 1] % 2 == 1 ) {
			ans += a[i] / 2;
			a[i] = 1;
			ans += a[i - 1] / 2;
			a[i - 1] = 1;
		}
		else if (a[i] % 2 == 0 && a[i - 1] % 2 == 1) {
			ans += a[i] / 2;
			a[i] = 0;
			ans += a[i - 1] / 2;
			a[i - 1] = 1;
		}
	}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;

const int N = 100005;
int n, num, a[N], b[N]; ll cnt;
int main () {
	cin >> n, cnt = 0;
	for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	for (int i = 1; i <= n; ++i) cnt += a[i] >> 1, a[i] &= 1;
	for (int i = 1; i <= n; ++i) if (a[i]) b[++num] = i;
	for (int i = 1; i < num; ++i) if (b[i + 1] - b[i] == 1) ++cnt, ++i;
	cout << cnt << endl;
	return 0;
}

Compiler output:
a.cc:5:25: error: 'll' does not name a type
    5 | int n, num, a[N], b[N]; ll cnt;
      |                         ^~
a.cc: In function 'int main()':
a.cc:7:19: error: 'cnt' was not declared in this scope; did you mean 'int'?
    7 |         cin >> n, cnt = 0;
      |                   ^~~
      |                   int
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    long long ans=0,a,cnt=0;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a)cnt+=a[i];
        else{
            ans+=cnt/2;
            cnt=0;
        }
    }
    cout<<ans+(cnt/2)<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: invalid types 'long long int[int]' for array subscript
    9 |         if(a)cnt+=a[i];
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    long long ans=0;
    int n,a[100000],int cnt=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i])cnt+=a[i];
        else{
            ans+=cnt/2;
            cnt=0;
        }
    }
    cout<<ans+(cnt/2)<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:21: error: expected unqualified-id before 'int'
    5 |     int n,a[100000],int cnt=0;
      |                     ^~~
a.cc:9:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
    9 |         if(a[i])cnt+=a[i];
      |                 ^~~
      |                 int
a.cc:11:18: error: 'cnt' was not declared in this scope; did you mean 'int'?
   11 |             ans+=cnt/2;
      |                  ^~~
      |                  int
a.cc:15:16: error: 'cnt' was not declared in this scope; did you mean 'int'?
   15 |     cout<<ans+(cnt/2)<<endl;
      |                ^~~
      |                int
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

int main(){
  int n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  ll ans=0;
  for(int i=0;i<n-1;i++){
    ans+=a[i]/2;
    if(a[i]%2==1&&a[i+1]>=1){
      a[i+1]--;
      ans++;
    }
  }
  ans+=a[n-1]/2;
  cout<<ans<<endl;
  return 

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: expected primary-expression at end of input
   22 |   return
      |         ^
a.cc:22:9: error: expected ';' at end of input
   22 |   return
      |         ^
      |         ;
a.cc:22:9: error: expected '}' at end of input
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n;
ll a[100005];

ll kilk(int l,int r)
{
          ll s1=0;
          for(int i=l;i<=r;i++)
                    s1+=a[i];
          return s1/2;
}

int main()a
{
          cin>>n;
          for(int i=1;i<=n;i++)
                    cin>>a[i];
          a[n+1]=0;
          int pos1=1,pos2=1;
          ll s=0;
          for(int i=1;i<=n+1;i++)
          {
                    if(a[i]==0)
                    {
                              s+=kilk(pos1,pos2);
                              pos1=-1;
                              pos2=-1;
                              continue;
                    }
                    if(pos1==-1)
                    {
                              pos1=i;
                              pos2=i;
                    }
                    else
                    {
                              pos2++;
                    }
          }
          cout<<s;
}


Compiler output:
a.cc:17:11: error: expected initializer before 'a'
   17 | int main()a
      |           ^
Language: C++

#include <iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	int a[n];
	int ans = 0;
	bool r = false;
	for (int i = 0,i < n,i++) {
		cin >> a[i];
		ans += a[i] / 2;
		a[i] = a[i] % 2;
	}
	for (int i = 0,i < n,i++) {
		if (a[i] == 1) {
			if (r) {
				ans++;
				r = false;
			}
			else {
				r = true;
			}
		}
		else {
			r = false;
		}
	}
	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: expected ';' before '<' token
   11 |         for (int i = 0,i < n,i++) {
      |                         ^~
      |                         ;
a.cc:11:26: error: expected primary-expression before '<' token
   11 |         for (int i = 0,i < n,i++) {
      |                          ^
a.cc:11:33: error: expected ';' before ')' token
   11 |         for (int i = 0,i < n,i++) {
      |                                 ^
      |                                 ;
a.cc:16:25: error: expected ';' before '<' token
   16 |         for (int i = 0,i < n,i++) {
      |                         ^~
      |                         ;
a.cc:16:26: error: expected primary-expression before '<' token
   16 |         for (int i = 0,i < n,i++) {
      |                          ^
a.cc:16:33: error: expected ';' before ')' token
   16 |         for (int i = 0,i < n,i++) {
      |                                 ^
      |                                 ;
Language: C++

#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int tree[100010];
int root(int x) {
	return tree[x] == x ? x : tree[x] = root(tree[x]);
}


int main() {
	int  N, A[100010];
	cin >> N;
	int d = 0;
	int a,b;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		d += A[i] / 2;
		A[i] = A[i] % 2;
	}
	for (int i = 0; i < N-1; i++) {
		a = min(A[i], A[i + 1]);
		d += a;
		A[i] -= a;
		A[i + 1] -= a;
	}
	
	cout << d << endl;
	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:33:18: error: expected '}' at end of input
   33 |         return 0;
      |                  ^
a.cc:13:12: note: to match this '{'
   13 | int main() {
      |            ^