Language: C++

#include <bits/stdc++.h>
using namespace std;
__int64 dp[100005][2],s[100005][2];
int a[100005];
int main() 
{
	//freopen("1.txt","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;++i) scanf("%d",&a[i]);
	if(a[0]<0)
	{
		dp[0][0]=0;
		s[0][0]=a[0];
		dp[0][1]=1-a[0];
		s[0][1]=1;
	}
	else if(a[0]>0)
		 {
		 	dp[0][1]=0;
			s[0][1]=a[0];
			dp[0][0]=1+a[0];
			s[0][0]=-1;
		 }
		 else
		 {
		 	dp[0][0]=1;
			s[0][0]=-1;
			dp[0][1]=1;
			s[0][1]=1;
		 }
	for(int i=1;i<n;++i)
	{
		__int64 x=s[i-1][1];
		x+=a[i];
		if(x<0)
		{
			dp[i][0]=0;
			s[i][0]=x;
		}
		else if(x>0)
			 {
			 	dp[i][0]=1+x;
				s[i][0]=-1;
			 }
			 else
			 {
			 	dp[i][0]=1;
				s[i][0]=-1;
			 }
		dp[i][0]+=dp[i-1][1];

		x=s[i-1][0];
		x+=a[i];
		if(x<0)
		{
			dp[i][1]=1-x;
			s[i][1]=1;
		}
		else if(x>0)
			 {
			 	dp[i][1]=0;
				s[i][1]=x;
			 }
			 else
			 {
			 	dp[i][1]=1;
				s[i][1]=1;
			 }
		dp[i][1]+=dp[i-1][0];
	}
	printf("%I64d\n",min(dp[n-1][0],dp[n-1][1]));
    return 0;
}


Compiler output:
a.cc:3:1: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 | __int64 dp[100005][2],s[100005][2];
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:13:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   13 |                 dp[0][0]=0;
      |                 ^~
      |                 dup
a.cc:14:17: error: 's' was not declared in this scope
   14 |                 s[0][0]=a[0];
      |                 ^
a.cc:20:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   20 |                         dp[0][1]=0;
      |                         ^~
      |                         dup
a.cc:21:25: error: 's' was not declared in this scope
   21 |                         s[0][1]=a[0];
      |                         ^
a.cc:27:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   27 |                         dp[0][0]=1;
      |                         ^~
      |                         dup
a.cc:28:25: error: 's' was not declared in this scope
   28 |                         s[0][0]=-1;
      |                         ^
a.cc:34:17: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   34 |                 __int64 x=s[i-1][1];
      |                 ^~~~~~~
      |                 __ynf64
a.cc:35:17: error: 'x' was not declared in this scope
   35 |                 x+=a[i];
      |                 ^
a.cc:38:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   38 |                         dp[i][0]=0;
      |                         ^~
      |                         dup
a.cc:39:25: error: 's' was not declared in this scope
   39 |                         s[i][0]=x;
      |                         ^
a.cc:43:33: error: 'dp' was not declared in this scope; did you mean 'dup'?
   43 |                                 dp[i][0]=1+x;
      |                                 ^~
      |                                 dup
a.cc:44:33: error: 's' was not declared in this scope
   44 |                                 s[i][0]=-1;
      |                                 ^
a.cc:48:33: error: 'dp' was not declared in this scope; did you mean 'dup'?
   48 |                                 dp[i][0]=1;
      |                                 ^~
      |                                 dup
a.cc:49:33: error: 's' was not declared in this scope
   49 |                                 s[i][0]=-1;
      |                                 ^
a.cc:51:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   51 |                 dp[i][0]+=dp[i-1][1];
      |                 ^~
      |                 dup
a.cc:53:19: error: 's' was not declared in this scope
   53 |                 x=s[i-1][0];
      |                   ^
a.cc:72:30: error: 'dp' was not declared in this scope; did you mean 'dup'?
   72 |         printf("%I64d\n",min(dp[n-1][0],dp[n-1][1]));
      |                              ^~
      |                              dup