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

#include <iostream>
using namespace std;

int main(){
    int n;
    int m;
    int a;
    int pos;
    int dis;
    int ans = 0;
    int x[100010];
    scanf("%d %d",&n,&m);
    x[0] = 0;
    for(int i = 1;i < n;i++){
        scanf("%d", &dis);
        x[i] = x[i - 1] + dis;
    }
    while( m-- ){
        scanf("%d", &a);
        dis = x[pos + a] - x[pos];
        pos += dis
        if(dis < 0){
            dis = (-1) * dis;
        }
        ans += dis;
    }

    ans %= ans / 100000;
    printf("%d\n", result);

}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:19: error: expected ';' before 'if'
   21 |         pos += dis
      |                   ^
      |                   ;
   22 |         if(dis < 0){
      |         ~~         
a.cc:29:20: error: 'result' was not declared in this scope
   29 |     printf("%d\n", result);
      |                    ^~~~~~
Language: C++

#include<iostream>
using namespace std; 

int main(){
    int n;
    int m;
    int dis;
    int l;
    int pos = 0
    int ans = 0;
    int x[100010];

    scanf("%d %d",&n,&m);
    x[0] = 0;
    for (int i = 1; i < n; i++){
        scanf("%d", &x[i]);
        x[i] += x[i - 1];
    }
    while (m--){
        scanf("%d", &l);
        result += abs(x[pos + l] - x[pos]);
        result %= M;
        pos += l;
    }
    printf("%d\n", result);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: expected ',' or ';' before 'int'
   10 |     int ans = 0;
      |     ^~~
a.cc:21:9: error: 'result' was not declared in this scope
   21 |         result += abs(x[pos + l] - x[pos]);
      |         ^~~~~~
a.cc:22:19: error: 'M' was not declared in this scope
   22 |         result %= M;
      |                   ^
a.cc:25:20: error: 'result' was not declared in this scope
   25 |     printf("%d\n", result);
      |                    ^~~~~~
Language: C++

#include<cstdio>
#include<math.h>
#include <stdlib.h>
#define M 100000

#include<iostream>
using namespace std; 

int main(){
    int n;
    int m;
    int dis;
    int l;
    int pos = 0
    int ans = 0;
    int x[100010];

    scanf("%d %d",&n,&m);
    x[0] = 0;
    for (int i = 1; i < n; i++){
        scanf("%d", &x[i]);
        x[i] += x[i - 1];
    }
    while (m--){
        scanf("%d", &l);
        result += abs(x[pos + l] - x[pos]);
        result %= M;
        pos += l;
    }
    printf("%d\n", result);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: expected ',' or ';' before 'int'
   15 |     int ans = 0;
      |     ^~~
a.cc:26:9: error: 'result' was not declared in this scope
   26 |         result += abs(x[pos + l] - x[pos]);
      |         ^~~~~~
a.cc:30:20: error: 'result' was not declared in this scope
   30 |     printf("%d\n", result);
      |                    ^~~~~~
Language: C++

#include <vector>
#include <iostream>

using namespace std;

int main()
{
    int n, m, d, r;
    
    scanf("%d", &n);
    scanf("%d", &m);
    
    vector<int> s(n); s[0] = 0;
    vector<int> a(m + 1); a[0] = 0;
    
    for(int i = 1; i < n; i++)
    {
        scanf("%d", &d);
        
        s[i] = d + s[i - 1];
    }
    
    long long ret = 0;
    
    for(int i = 1; i <= m; i++)
    {
        scanf("%d", &r);
        
        a[i] = r + a[i - 1];
        
        ret += sum[a[i]] - sum[a[i - 1]];
    }
    
    printf("%lld\n", ret);
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:16: error: 'sum' was not declared in this scope
   31 |         ret += sum[a[i]] - sum[a[i - 1]];
      |                ^~~
Language: C++

#include <cstdio>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;

#define mygc getchar_unlocked
inline void reader(int *x) {
	int k, m = 0; *x = 0;
	while (true) {
		mygc(k);
		if (k == '-') { m = 1; break; }
		if (48 <= k && k <= 57) { *x = k - 48; break; }
	}
	while (true) {
		mygc(k);
		if (k < 48 || 57 < k) break;
		*x = (*x) * 10 + k - 48;
	}
	if (m) (*x) = -(*x);
}

int n, m, s[100009], x[100009];
int main() {
	reader(&n); reader(&m);
	for (int i = 1; i < n; i++) reader(&s[i]), s[i] += s[i - 1];
	long long ret = 0;
	for (int i = 1; i <= m; i++) {
		reader(&x[i]), x[i] += x[i - 1];
		if (x[i] < x[i - 1]) ret += s[x[i - 1]] - s[x[i]];
		else ret += s[x[i]] - s[x[i - 1]];
	}
	printf("%d\n", ret % 100000);
	return 0;
}

Compiler output:
a.cc: In function 'void reader(int*)':
a.cc:10:21: error: too many arguments to function 'int getchar_unlocked()'
   10 |                 mygc(k);
      |                     ^
In file included from /usr/include/c++/14/cstdio:42,
                 from a.cc:1:
/usr/include/stdio.h:590:12: note: declared here
  590 | extern int getchar_unlocked (void);
      |            ^~~~~~~~~~~~~~~~
a.cc:15:21: error: too many arguments to function 'int getchar_unlocked()'
   15 |                 mygc(k);
      |                     ^
/usr/include/stdio.h:590:12: note: declared here
  590 | extern int getchar_unlocked (void);
      |            ^~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int n,m,d[100005],nowwhere,imos[100005];
long long int ans=0;
int main(){
    cin>>n>>m;
    for(int i=1; i<n; i++) cin>>d[i];??¨    nowwhere=1;
    int a;
    for(int i=1; i<=m; i++){
        cin>>a;
        if(a>0){
            imos[nowwhere]++;
            nowwhere+=a;
            imos[nowwhere]--;
        }else{
            imos[nowwhere]--;
            nowwhere+=a;
            imos[nowwhere]++;
        }
    }
    for(int i=1; i<n; i++) {
        imos[i]+=imos[i-1];
    }
    for(int i=1; i<n; i++) ans+=imos[i]*d[i];
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:38: error: expected primary-expression before '?' token
    8 |     for(int i=1; i<n; i++) cin>>d[i];??¨    nowwhere=1;
      |                                      ^
a.cc:8:39: error: expected primary-expression before '?' token
    8 |     for(int i=1; i<n; i++) cin>>d[i];??¨    nowwhere=1;
      |                                       ^
a.cc:8:40: error: '\U000000a8' was not declared in this scope
    8 |     for(int i=1; i<n; i++) cin>>d[i];??¨    nowwhere=1;
      |                                        ^
a.cc:8:41: error: expected ':' before 'nowwhere'
    8 |     for(int i=1; i<n; i++) cin>>d[i];??¨    nowwhere=1;
      |                                         ^   ~~~~~~~~
      |                                         :
a.cc:8:55: error: expected ':' before ';' token
    8 |     for(int i=1; i<n; i++) cin>>d[i];??¨    nowwhere=1;
      |                                                       ^
      |                                                       :
a.cc:8:55: error: expected primary-expression before ';' token
Language: C++

#include<iostream>
#include<cstdio>

using namespace std;

int dp[100000][100000];
int field[100000];
int method[100000];
int n,m;

void dpcreate(void){
	for(int lp=0;lp<n;lp++){
		dp[lp][lp]=0;
	}
	for(int lp=1;lp<n;lp++){
		dp[0][lp]=dp[0][lp-1]+field[lp-1];
		dp[lp][0]=dp[0][lp];
	}
	for(int lp1=1;lp1<n-1;lp1++){
		for(int lp2=lp1+1;lp2<n;lp2++){
			dp[lp1][lp2]=dp[0][lp2]-dp[0][lp1];
			dp[lp2][lp1]=dp[lp1][lp2];
		}
	}
}
int solve(void){
	int prevpos=0,nextpos=0;
	int answer=0;
	for(int day=0;day<m;day++){
		nextpos=prevpos+method[day];
		answer+=dp[prevpos][nextpos];
		prevpos=nextpos;
		if(answer>100000){
			answer=answer%100000;
		}
	}
	return answer;
}

int main(void){
	scanf("%d %d",&n,&m);
	for(int lp=0;lp<n-1;lp++){
		scanf("%d",&field[lp]);
	}
	for(int lp=0;lp<m;lp++){
		scanf("%d",&method[lp]);
	}
	dpcreate();
	printf("%d",solve());
	return 0;
}
	

Compiler output:
/tmp/ccGeNW8S.o: in function `dpcreate()':
a.cc:(.text+0x2d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x6c): relocation truncated to fit: R_X86_64_PC32 against symbol `field' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0xc0): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x195): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x1a8): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGeNW8S.o
/tmp/ccGeNW8S.o: in function `solve()':
a.cc:(.text+0x1f1): relocation truncated to fit: R_X86_64_PC32 against symbol `method' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x263): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccGeNW8S.o
/tmp/ccGeNW8S.o: in function `main':
a.cc:(.text+0x280): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x28a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x2be): relocation truncated to fit: R_X86_64_PC32 against symbol `field' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x2e2): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<cstdio>

using namespace std;

int dp[100000][100000];
int field[100000];
int method[100000];
int n,m;

void dpcreate(void){
	for(int lp=0;lp<n;lp++){
		dp[lp][lp]=0;
	}
	for(int lp=1;lp<n;lp++){
		dp[0][lp]=dp[0][lp-1]+field[lp-1];
		dp[lp][0]=dp[0][lp];
	}
	for(int lp1=1;lp1<n-1;lp1++){
		for(int lp2=lp1+1;lp2<n;lp2++){
			dp[lp1][lp2]=dp[0][lp2]-dp[0][lp1];
			dp[lp2][lp1]=dp[lp1][lp2];
		}
	}
}
int solve(void){
	int prevpos=0,nextpos=0;
	int answer=0;
	for(int day=0;day<m;day++){
		nextpos=prevpos+method[day];
		answer+=dp[prevpos][nextpos];
		prevpos=nextpos;
		if(answer>100000){
			answer=answer%100000;
		}
	}
	return answer;
}

int main(void){
	scanf("%d %d",&n,&m);
	for(int lp=0;lp<n-1;lp++){
		scanf("%d",&field[lp]);
	}
	for(int lp=0;lp<m;lp++){
		scanf("%d",&method[lp]);
	}
	dpcreate();
	printf("%d\n",solve());
	return 0;
}
	

Compiler output:
/tmp/ccylBOhu.o: in function `dpcreate()':
a.cc:(.text+0x2d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x6c): relocation truncated to fit: R_X86_64_PC32 against symbol `field' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0xc0): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x195): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x1a8): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccylBOhu.o
/tmp/ccylBOhu.o: in function `solve()':
a.cc:(.text+0x1f1): relocation truncated to fit: R_X86_64_PC32 against symbol `method' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x263): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccylBOhu.o
/tmp/ccylBOhu.o: in function `main':
a.cc:(.text+0x280): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x28a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x2be): relocation truncated to fit: R_X86_64_PC32 against symbol `field' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x2e2): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, init, n) for(int i = init; i < (n); i++)

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

int main()
{
    int N, M;
    cin >> N >> M;

    vector<int> dist(N, 0);

    rep(i, N - 1)
    {
        int input;
        cin >> input;
        dist[i + 1] = input;
    }

    rep(i, N) dist[i + 1] += dist[i];

    int now = 0, ans = 0;

    rep(i, M)
    {
        int input;
        cin >> input;
        
        ans += abs(dist[now + input] - dist[now]);
        now += input;
    }

    cout << ans % 1e5 << endl;


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:17: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   50 |     cout << ans % 1e5 << endl;
      |             ~~~ ^ ~~~
      |             |     |
      |             int   double
Language: C++

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

const int size = 100001;
int length[size];

int main( void ) {
    int n, m;
    cin >> n >> m;

    length[0] = 0;
    for ( int i = 1; i < n; i++ ) {
        int si;
        cin >> si;
        length[i] = length[i-1] + si;
    }

    int k = 0;
    int answer = 0;
    for ( int i = 0; i < m; i++ ) {
        int ai;
        cin >> ai;
        int prev = k;
        int next = k + ai;
        answer += abs( length[next] - length[prev] );
        k = next;
    }

    cout << answer << endl;

    return 0;
}

Compiler output:
a.cc:6:12: error: reference to 'size' is ambiguous
    6 | int length[size];
      |            ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:11: note:                 'const int size'
    5 | const int size = 100001;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:12:5: error: 'length' was not declared in this scope
   12 |     length[0] = 0;
      |     ^~~~~~
Language: C++

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int n, m;
	int sumLoad[100001];
	int now;
	int ans;
	
	scanf("%d%d", &n, &m);
	
	sumLoad[0] = 0;
	for (int i = 0; i < n - 1; i++){
		scanf("%d", &sumLoad[i + 1]);
		sumLoad[i + 1] += sumLoad[i];
	}
	
	now = 0;
	ans = 0;
	for (int i = 0; i < m; i++){
		int a;
		scanf("%d", &a);
		
		ans = (ans + abs(sumLoad[now + a] - sumLoa) % 100000;
		now += a;
	}
	
	printf("%d\n", ans);
	
	return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:53: error: 'sumLoa' was not declared in this scope; did you mean 'sumLoad'?
   25 |                 ans = (ans + abs(sumLoad[now + a] - sumLoa) % 100000;
      |                                                     ^~~~~~
      |                                                     sumLoad
a.cc:25:69: error: expected ')' before ';' token
   25 |                 ans = (ans + abs(sumLoad[now + a] - sumLoa) % 100000;
      |                       ~                                             ^
      |                                                                     )
Language: C++

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int n, m;
	int sumLoad[100001];
	int now;
	int ans;
	
	scanf("%d%d", &n, &m);
	
	sumLoad[0] = 0;
	for (int i = 0; i < n - 1; i++){
		scanf("%d", &sumLoad[i + 1]);
		sumLoad[i + 1] += sumLoad[i];
	}
	
	now = 0;
	ans = 0;
	for (int i = 0; i < m; i++){
		int a;
		scanf("%d", &a);
		
		ans = (ans + abs(sumLoad[now + a] - sumLoad)) % 100000;
		now += a;
	}
	
	printf("%d\n", ans);
	
	return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:51: error: invalid operands of types 'int' and 'int [100001]' to binary 'operator-'
   25 |                 ans = (ans + abs(sumLoad[now + a] - sumLoad)) % 100000;
      |                                  ~~~~~~~~~~~~~~~~ ^ ~~~~~~~
      |                                                 |   |
      |                                                 int int [100001]
Language: C++

#include<vector>
#include<cstdio>
#include<math>
using namespace std;
int main(void){
	int n,m,s,cnt=0,w=0;
	vector<int> a;
	//a.push_back(0);
	scanf("%d%d",&n,&m);
	for(int i=1;i<n;i++){
		scanf("%d",&s);
		a.push_back(s);
	}
	for(int i=0;i<m;i++){
		scanf("%d",&s);
		for(int j=0;j<s;j++){
			cnt+=a[w++];
		}
		for(int j=0;j>s;j--){
			cnt+=a[--w];
		}
	}
	
	printf("%d\n",cnt%100000);
	return 0;
}

Compiler output:
a.cc:3:9: fatal error: math: No such file or directory
    3 | #include<math>
      |         ^~~~~~
compilation terminated.
Language: C++

#include <cstdio>
int x[100005],w=1;
long long s=0;
int main(n,m,a,i){
scanf("%d %d",&n,&m);
for(i=1;i<n;i++){
scanf("%d",&x[i]);
}
for(i=0;i<m;i++){
scanf("%d",&a);
if(a>0){
for(int j=0;j<a;j++){
s+=x[w+j];
}
}else{
for(int j=a;j<0;j++){
s+=x[w+j];
}
}
w+=a;
}
printf("%lld\n",s%100000);
return 0;
}

Compiler output:
a.cc:4:5: error: cannot declare '::main' to be a global variable
    4 | int main(n,m,a,i){
      |     ^~~~
a.cc:4:10: error: 'n' was not declared in this scope
    4 | int main(n,m,a,i){
      |          ^
a.cc:4:12: error: 'm' was not declared in this scope
    4 | int main(n,m,a,i){
      |            ^
a.cc:4:14: error: 'a' was not declared in this scope
    4 | int main(n,m,a,i){
      |              ^
a.cc:4:16: error: 'i' was not declared in this scope
    4 | int main(n,m,a,i){
      |                ^
a.cc:4:17: error: expression list treated as compound expression in initializer [-fpermissive]
    4 | int main(n,m,a,i){
      |                 ^
Language: C++

#include <cstdio>
int x[100005],w=1;
long long s=0;
main(n,m,a,i){
scanf("%d %d",&n,&m);
for(i=1;i<n;i++){
scanf("%d",&x[i]);
}
for(i=0;i<m;i++){
scanf("%d",&a);
if(a>0){
for(int j=0;j<a;j++){
s+=x[w+j];
}
}else{
for(int j=a;j<0;j++){
s+=x[w+j];
}
}
w+=a;
}
printf("%lld\n",s%100000);
return 0;
}

Compiler output:
a.cc:4:5: error: expected constructor, destructor, or type conversion before '(' token
    4 | main(n,m,a,i){
      |     ^
Language: C++

#include <cstdio>
int x[100005],w=1;
long long s=0;
main(int n,m,a,i){
scanf("%d %d",&n,&m);
for(i=1;i<n;i++){
scanf("%d",&x[i]);
}
for(i=0;i<m;i++){
scanf("%d",&a);
if(a>0){
for(int j=0;j<a;j++){
s+=x[w+j];
}
}else{
for(int j=a;j<0;j++){
s+=x[w+j];
}
}
w+=a;
}
printf("%lld\n",s%100000);
return 0;
}

Compiler output:
a.cc:4:12: error: 'm' has not been declared
    4 | main(int n,m,a,i){
      |            ^
a.cc:4:14: error: 'a' has not been declared
    4 | main(int n,m,a,i){
      |              ^
a.cc:4:16: error: 'i' has not been declared
    4 | main(int n,m,a,i){
      |                ^
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(int n,m,a,i){
      | ^~~~
a.cc:4:1: warning: second argument of 'int main(int, int, int, int)' should be 'char **' [-Wmain]
a.cc:4:1: warning: third argument of 'int main(int, int, int, int)' should probably be 'char **' [-Wmain]
a.cc:4:1: warning: 'int main(int, int, int, int)' takes only zero or two arguments [-Wmain]
a.cc: In function 'int main(int, int, int, int)':
a.cc:5:19: error: 'm' was not declared in this scope
    5 | scanf("%d %d",&n,&m);
      |                   ^
a.cc:6:5: error: 'i' was not declared in this scope
    6 | for(i=1;i<n;i++){
      |     ^
a.cc:9:5: error: 'i' was not declared in this scope
    9 | for(i=0;i<m;i++){
      |     ^
a.cc:10:13: error: 'a' was not declared in this scope
   10 | scanf("%d",&a);
      |             ^
Language: C++

#include <iostream>
using namespace std;
int main(){
int n;
int m;
cin >>n;
cin >>m;
int a[n];
a[0]=0;
int b;
int c;
b=0;
while(b<n){
cin >>c;
a[b+1]=a[b]+c;
b=b+1;}
int e;
e=0;
int d;
d=0;
b=0;
while(b<m){
cin >>c;
if(c>0){e=(e+a[d+c]-a[d])%100000}
else{e=(e+a[d]-a[d+c])%100000}
d=d+c;
b=b+1;}
cout <<e<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: error: expected ';' before '}' token
   24 | if(c>0){e=(e+a[d+c]-a[d])%100000}
      |                                 ^
      |                                 ;
a.cc:25:30: error: expected ';' before '}' token
   25 | else{e=(e+a[d]-a[d+c])%100000}
      |                              ^
      |                              ;
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include<vector>
using namespace std;
#define AMA(100000)
int N,M;
int S[100005];
int main(){
  scanf("%d %d",&N,&M);
  for(int i=2;i<=N;i++){
    int s;
    scanf("%d",&s);
    S[i]=S[i-1]+s;
  }
  int now = 1;
  int res = 0;
  for(int i=0;i<M;i++){
    int a;
    scanf("%d",&a);
    res += (abs(S[now+a]-S[now]))%AMA;
    now = now + a;
  }
  printf("%d\n",res%AMA);
}

Compiler output:
a.cc:8:13: error: expected parameter name, found "100000"
    8 | #define AMA(100000)
      |             ^~~~~~
a.cc: In function 'int main()':
a.cc:23:35: error: 'AMA' was not declared in this scope
   23 |     res += (abs(S[now+a]-S[now]))%AMA;
      |                                   ^~~
a.cc:26:21: error: 'AMA' was not declared in this scope
   26 |   printf("%d\n",res%AMA);
      |                     ^~~
Language: C++

#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
  
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < k; i++)
typedef long long ll;
typedef unsigned long long ull;
  
int main(){
    int n,m;
    int field[128000]={0};
    scanf("%d%d",&n,&m);
    rep(i,n-1){
        scanf("%d",&field[i]);
    }
    int mod = 100000;
    int res = 0;
    int now = 0;
    rep(i,m){
        int x;
        scanf("%d",&x);
        if(x > 0){
            if(res+field[j]>=mod)reps(j,now,now+x)res = (res+field[j])%mod;
else{
reps(j,now,now+x)res = res+field[j];
            now += x;
        }
        else{
if(res+field[j]>=100000)
            for(int j = now-1;j > now+x-1; j--)res = (res+field[j])%mod;
else{
for(int j = now-1;j > now+x-1; j--)res = (res+field[j]);
            now += x;
        }
    }
    printf("%d\n",res);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:26: error: 'j' was not declared in this scope
   39 |             if(res+field[j]>=mod)reps(j,now,now+x)res = (res+field[j])%mod;
      |                          ^
a.cc:44:9: error: expected '}' before 'else'
   44 |         else{
      |         ^~~~
a.cc:38:18: note: to match this '{'
   38 |         if(x > 0){
      |                  ^
a.cc:45:14: error: 'j' was not declared in this scope
   45 | if(res+field[j]>=100000)
      |              ^
a.cc:54:2: error: expected '}' at end of input
   54 | }
      |  ^
a.cc:25:11: note: to match this '{'
   25 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
typedef uint16_t li;
const li linf = 0xfffffffffffffff;
li dp[5005][5005][2];
short int leng[10005] = { 0 };
int main()
{
	for (int i = 0; i < 5005; i++) {
		for (int j = 0; j < 5005; j++) {
			dp[i][j][0] = linf;
			dp[i][j][1] = linf;
		}
	}
	dp[0][0][0] = 0;
	dp[0][0][1] = 0;
	int n;
	cin >> n;
	for (int i = 1; i < n; i++) cin >> leng[i];
	for (int i = 0; i <= n / 2; i++) {
		for (int j = 0; j <= n / 2; j++) {
			if (i > 0) {
				dp[i][j][0] = min(dp[i - 1][j][1] + leng[i + j], dp[i - 1][j][0] + leng[i + j] - leng[i + j - 1]);
			}
			if (j > 0) {
				dp[i][j][1] = min(dp[i][j - 1][0] + leng[i + j], dp[i][j - 1][1] + leng[i + j] - leng[i + j - 1]);
			}
		}
	}
	cout << min(dp[n / 2][n / 2][0], dp[n / 2][n / 2][1]) << endl;
	return 0;
}


Compiler output:
a.cc:4:9: error: 'uint16_t' does not name a type
    4 | typedef uint16_t li;
      |         ^~~~~~~~
a.cc:3:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    2 | #include <algorithm>
  +++ |+#include <cstdint>
    3 | using namespace std;
a.cc:5:7: error: 'li' does not name a type
    5 | const li linf = 0xfffffffffffffff;
      |       ^~
a.cc:6:1: error: 'li' does not name a type
    6 | li dp[5005][5005][2];
      | ^~
a.cc: In function 'int main()':
a.cc:12:25: error: 'dp' was not declared in this scope
   12 |                         dp[i][j][0] = linf;
      |                         ^~
a.cc:12:39: error: 'linf' was not declared in this scope
   12 |                         dp[i][j][0] = linf;
      |                                       ^~~~
a.cc:16:9: error: 'dp' was not declared in this scope
   16 |         dp[0][0][0] = 0;
      |         ^~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
typedef uint16_t li;
const li linf = 1000000;
li dp[5005][5005][2];
short int leng[10005] = { 0 };
int main()
{
	for (int i = 0; i < 5005; i++) {
		for (int j = 0; j < 5005; j++) {
			dp[i][j][0] = linf;
			dp[i][j][1] = linf;
		}
	}
	dp[0][0][0] = 0;
	dp[0][0][1] = 0;
	int n;
	cin >> n;
	for (int i = 1; i < n; i++) cin >> leng[i];
	for (int i = 0; i <= n / 2; i++) {
		for (int j = 0; j <= n / 2; j++) {
			if (i > 0) {
				dp[i][j][0] = min(dp[i - 1][j][1] + leng[i + j], dp[i - 1][j][0] + leng[i + j] - leng[i + j - 1]);
			}
			if (j > 0) {
				dp[i][j][1] = min(dp[i][j - 1][0] + leng[i + j], dp[i][j - 1][1] + leng[i + j] - leng[i + j - 1]);
			}
		}
	}
	cout << min(dp[n / 2][n / 2][0], dp[n / 2][n / 2][1]) << endl;
	return 0;
}


Compiler output:
a.cc:4:9: error: 'uint16_t' does not name a type
    4 | typedef uint16_t li;
      |         ^~~~~~~~
a.cc:3:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    2 | #include <algorithm>
  +++ |+#include <cstdint>
    3 | using namespace std;
a.cc:5:7: error: 'li' does not name a type
    5 | const li linf = 1000000;
      |       ^~
a.cc:6:1: error: 'li' does not name a type
    6 | li dp[5005][5005][2];
      | ^~
a.cc: In function 'int main()':
a.cc:12:25: error: 'dp' was not declared in this scope
   12 |                         dp[i][j][0] = linf;
      |                         ^~
a.cc:12:39: error: 'linf' was not declared in this scope
   12 |                         dp[i][j][0] = linf;
      |                                       ^~~~
a.cc:16:9: error: 'dp' was not declared in this scope
   16 |         dp[0][0][0] = 0;
      |         ^~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <deque>
#include <complex>
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define REP(i,a) FOR(i,0,a)
#define X real() 
#define Y imag()
using namespace std;
typedef long long ll;
typedef int useType;
typedef pair<useType,useType> pr;
typedef vector<useType> VI;
const int INF=1<<30;
int DP[2][2][10002];
int main(){
	int n,p;
	while(cin >> n && n){

		REP(i,2)
			REP(j,10002){
				DP[0][i][j]=INF;
				DP[1][i][j]=INF;
			}

		DP[0][0][1]=0;
		DP[0][1][0]=0;
		REP(i,n-1){
			cin >> p;
			FOR(k,1,n+1)
				DP[(i+1)&1][0][k]=min(DP[i&1][0][k-1],DP[i&1][1][k-1]+p);
			REP(k,n1)
				DP[(i+1)&1][1][k]=min(DP[i&1][0][k]+p,DP[i&1][1][k]);
		}
		cout << min(DP[(n+1)&1][0][n/2],DP[(n+1)&1][1][n/2]) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:31: error: 'n1' was not declared in this scope; did you mean 'n'?
   36 |                         REP(k,n1)
      |                               ^~
a.cc:9:42: note: in definition of macro 'FOR'
    9 | #define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
      |                                          ^
a.cc:36:25: note: in expansion of macro 'REP'
   36 |                         REP(k,n1)
      |                         ^~~
Language: C++

//0550　Dividing Snacks　お菓子の分割 　
#include <cstdio>
#include <algorithm>
using namespace std;
int dp[2][5010][2];
#define MAX  100000000
int main(void){
	int n;
	scanf("%d",&n);
	int i,j;
	int a[10001];
	for(i=0;i<n-1;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<2;i++){
		for(j=0;j<=5001;j++){
			dp[i][j][0]=MAX;
			dp[i][j][1]=MAX;
		}
	}
	dp[0][0][0]=0;//スタート地点
	for(i=0;i<n;i++){
		int m=min(5010,i);
		for(j=0;j<=m;j++){
			dp[(i+1)&1][j+1][0]=min(dp[i&1][j][0],dp[i&1][j][1]+a[i]);
			dp[(i+1)&1][j][1]=min(dp[i&1][j][1],dp[i&1][j][0]+a[i]);
		}
		dp[i&1][0][0]=MAX;
	}
	int min=MAX;
	for(i=0;i<2;i++){
		if(dp[0][n/2][i]<min){
			min=dp[0][n/2][i];
		}
		if(dp[01[n/2][i]<min){
			min=dp[1][n/2][i];
		}
	}
	printf("%d\n",min);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:25: error: invalid types 'int[int]' for array subscript
   35 |                 if(dp[01[n/2][i]<min){
      |                         ^
a.cc:35:37: error: expected ']' before ')' token
   35 |                 if(dp[01[n/2][i]<min){
      |                                     ^
      |                                     ]
Language: C++

#include <cstdio>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n, t, dp[2][5001][2];
    scanf("%d",&n);
	rep(i,2)rep(j,5001)rep(k,2)dp[i][j][k]=100000000;
    dp[0][1][0] = 0; dp[0][0][1] = 0;
    for(int i = 1; i < n; i++){
        scanf("%d",&t);
        for(int j = 0; j <= n/2; j++){
            if(j != 0){
                dp[1][j][0] = min(dp[0][j-1][0],dp[0][j-1][1]+t);
                dp[1][j][1] = min(dp[0][j][1],dp[0][j][0]+t);
            } else dp[1][j][1] = dp[0][j][1];
        }
        for(int j = 0; j <= n/2; j++)rep(k,2)dp[0][j][k] = dp[1][j][k];
    }
    printf("%d\n", min(dp[0][n/2][0],dp[0][n/2][1]));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:31: error: 'min' was not declared in this scope; did you mean 'main'?
   13 |                 dp[1][j][0] = min(dp[0][j-1][0],dp[0][j-1][1]+t);
      |                               ^~~
      |                               main
a.cc:19:20: error: 'min' was not declared in this scope; did you mean 'main'?
   19 |     printf("%d\n", min(dp[0][n/2][0],dp[0][n/2][1]));
      |                    ^~~
      |                    main
Language: C++

nclude<bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
int main()
{
  int N, t[10000] = {};
  int dp[5001][2];
  fill_n(*dp, 5001 * 2, INF);

  scanf("%d", &N);
  for(int i = 0; i < N - 1; i++) scanf("%d", &t[i]);

  dp[1][0] = 0;
  for(int i = 0; i < N - 1; i++) {
    for(int j = N / 2; j > 0; j--) {
      dp[j][1] = min(dp[j    ][1], dp[j    ][0] + t[i]);
      dp[j][0] = min(dp[j - 1][0], dp[j - 1][1] + t[i]);
    }
  }
  printf("%d\n", dp[N / 2][0]);
}

Compiler output:
a.cc:1:1: error: 'nclude' does not name a type
    1 | nclude<bits/stdc++.h>
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:8:3: error: 'fill_n' was not declared in this scope
    8 |   fill_n(*dp, 5001 * 2, INF);
      |   ^~~~~~
a.cc:10:3: error: 'scanf' was not declared in this scope
   10 |   scanf("%d", &N);
      |   ^~~~~
a.cc:16:18: error: 'min' was not declared in this scope; did you mean 'main'?
   16 |       dp[j][1] = min(dp[j    ][1], dp[j    ][0] + t[i]);
      |                  ^~~
      |                  main
a.cc:20:3: error: 'printf' was not declared in this scope
   20 |   printf("%d\n", dp[N / 2][0]);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | nclude<bits/stdc++.h>
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef long long ll;

int k[10000];
int dp[2][5101][2];

signed main()
{
	int N, i, j;
	cin >> N;
	rep(i,N-1) cin >> k[i];
	
	memset(dp, 0x7f, sizeof(dp));
	dp[0][0][0] = 0;
	rep(i,N) {
		int m = min(5009, i);
		for (j=0; j<=m; j++) {
			dp[(i+1)&1][j+1][0] = min(dp[i&1][j][0], dp[i&1][j][1] + k[i]);
			dp[(i+1)&1][j][1] = min(dp[i&1][j][1], dp[i&1][j][0] + k[i]);
		}
		dp[i&1][0][0] = 0x7f7f;
	}

	cout << dp[N%2][N/2][0];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:28: error: no matching function for call to 'min(int, long long int&)'
   19 |                 int m = min(5009, i);
      |                         ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:19:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   19 |                 int m = min(5009, i);
      |                         ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:19:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   19 |                 int m = min(5009, i);
      |                         ~~~^~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <bitset>
#include <fstream>
#include <cmath>
#include <ctime>
#include <numeric>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define REP(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define MSG(a) cout << #a << " "  << a << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

int snac[10000];
int dp[2][5105][2]; // dp[i][j][k] := i : |CgiôïÅg¢Üí·jj : [Ì k : ¼OÌrbg

const int INF = 0x7f7f;

int main()
{
	int n;
	while(cin >> n && n)
	{
		memset(dp, INF, sizeof(dp));
		memset(snac, 0, sizeof(snac));

		rep(i, n-1)
			cin >> snac[i];

		dp[0][0][0] = 0;
		rep(i, n)
		{
			int m = min(i, 5009);
			rep(j, m+1)
			{
				dp[(i+1)&1][j+1][0] = min(dp[i&1][j][0], dp[i&1][j][1] + snac[i]);
				dp[(i+1)&1][j][1]   = min(dp[i&1][j][1], dp[i&1][j][0] + snac[i]);
			}
			dp[i&1][0][0] = INF;
		}
		cout << dp[n&1][n/2][0] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: 'memset' was not declared in this scope
   34 |                 memset(dp, INF, sizeof(dp));
      |                 ^~~~~~
a.cc:14:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   13 | #include <numeric>
  +++ |+#include <cstring>
   14 | using namespace std;
Language: C++

在しない数の個数が許容される範囲（空白カードがあれば 1 以下、無ければは 0 以下）に収ま

Compiler output:
a.cc:1:56: error: extended character 、 is not valid in an identifier
    1 | 在しない数の個数が許容される範囲（空白カードがあれば 1 以下、無ければは 0 以下）に収ま
      |                                                        ^
a.cc:1:1: error: '\U00005728\U00003057\U0000306a\U00003044\U00006570\U0000306e\U0000500b\U00006570\U0000304c\U00008a31\U00005bb9\U00003055\U0000308c\U0000308b\U00007bc4\U000056f2\U0000ff08\U00007a7a\U0000767d\U000030ab\U000030fc\U000030c9\U0000304c\U00003042\U0000308c\U00003070' does not name a type
    1 | 在しない数の個数が許容される範囲（空白カードがあれば 1 以下、無ければは 0 以下）に収ま
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<cstdio>
#include<iostream>
#define INF 10000000
using namespace std;
int dp[2][100000][2]={{{0}}};

int main(){

    for(int i = 0;i < 2;i++){
        for(int j = 0;j < 100000;j++){
            dp[i][j][0] = dp[i][j][1] = INF;
        }
    }
    int N;
    cin>>N;
    int v[100000]={0};
    for(int i = 0; i < N - 1;i++){
        cin>>v[i+1];
    }
    v[N-1] = 0;
    for(int i = 0;i < N;i++){
        for(int j = 0;j < N+1;j++){
            for(int k = 0;k < 2;k++){
                dp[(i+1)%2][j][k] = INF;
            }
        }
        dp[(i+1)%2][0][1] = v[i];
        for(int j = 0;j < N/2;j++){
            if(dp[i%2][j][1]!=INF){
                dp[(i+1)%2][j+1][0] = min(dp[(i+1)%2][j+1][0],dp[i%2][j][1]+v[i]);
                dp[(i+1)%2][j][1] = min(dp[(i+1)%2][j][1],dp[i%2][j][1]-v[i-1]+v[i]);
            }
            if(dp[i%2][j][0]!=INF){
                dp[(i+1)%2][j+1][0] = min(dp[(i+1)%2][j+1][0],dp[i%2][j][0]-v[i-1]+v[i]);
                dp[(i+1)%2][j][1] = min(dp[(i+1)%2][j][1],dp[i%2][j][0]+v[i]);
            }
        }
    cout<<dp[0][N/2-1][0]<<endl;
    return 0;
}

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

#include<cstdio>
using namespace std;

int main(){
	const int I=99999999;
	int n,c,m;
	int p[2][5000+2][2];
	for(int i=0;i<2;i++)for(int j=0;j<5002;j++){p[i][j][0]=I; p[i][j][1]=I;}
	p[1][1][0]=0;
	p[1][0][1]=0;
	cin>>n;
	for(int i=2;i<=n;i++){
		int s=i%2,t=1-s;
		cin>>c;
		m=min(i,n/2);
		for(int j=0;j<=m;j++){
			if(j!=0)p[s][j][0]=min(p[t][j-1][0],p[t][j-1][1]+c);
			p[s][j][1]=min(p[t][j][0]+c,p[t][j][1]);
		}
	}
	cout<<min(p[0][m][0],p[0][m][1])<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope
   11 |         cin>>n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cstdio>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:15:19: error: 'min' was not declared in this scope; did you mean 'main'?
   15 |                 m=min(i,n/2);
      |                   ^~~
      |                   main
a.cc:21:9: error: 'cout' was not declared in this scope
   21 |         cout<<min(p[0][m][0],p[0][m][1])<<endl;
      |         ^~~~
a.cc:21:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:15: error: 'min' was not declared in this scope; did you mean 'main'?
   21 |         cout<<min(p[0][m][0],p[0][m][1])<<endl;
      |               ^~~
      |               main
a.cc:21:43: error: 'endl' was not declared in this scope
   21 |         cout<<min(p[0][m][0],p[0][m][1])<<endl;
      |                                           ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<cstdio>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++


#include<iostream>
#include<cstdio>
#include<cstdlib>

using namespace std;

#define MAXN 10012
#define INF 1e+9

int SwapDim1Array(int **a,int **b);

typedef struct{
	int exist;
	int none;
} dint;
dint origin[MAXN];
dint buffer[MAXN];
dint *dp = origin;
dint *dpbuf = buffer;
int field[MAXN] = {0};
int length = 0;

int main (void){
	scanf("%d",&length);
	for(int i=0;i<=length;i++){
			dp[i].exist = INF;
			dp[i].none = INF;
	}
	dp[0].none = 0;
	for(int i=1;i<length;i++){
		scanf("%d",&field[i]);
	}


	for(int i=0;i<length;i++){		//くばるDP
		for(int j=0;j<=i;j++){
			dpbuf[j+1].exist = min(min(dp[j].exist + field[i+1] - field[i] , dp[j].none + field[i] + field[i+1]) , dpbuf[j+1].exist);
			dpbuf[j].none = min(min(dp[j].exist , dp[j].none) , dpbuf[j].none);
			SwapDim1Array(dp,dpbuf);
		}
	}

	int answer = 0;
	answer = min(dp[length/2].exist,dp[length/2].none);
	printf("%d\n",answer);
	/*puts("field");
	for(int i=1;i<length;i++){
		printf("%d\t",field[i]);
	}puts("");
	printf("###%d###%d\n",dp[1][1].exist,dp[1][1].none);*/

	return 0;
}

int SwapDim1Array(int **a,int **b){
	int *c;
	c = *a;
	*a = *b;
	*b = c;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:39: error: cannot convert 'dint*' to 'int**'
   40 |                         SwapDim1Array(dp,dpbuf);
      |                                       ^~
      |                                       |
      |                                       dint*
a.cc:11:25: note:   initializing argument 1 of 'int SwapDim1Array(int**, int**)'
   11 | int SwapDim1Array(int **a,int **b);
      |                   ~~~~~~^
Language: C++


#include<iostream>
#include<cstdio>
#include<cstdlib>

using namespace std;

#define MAXN 10012
#define INF 1e+9

typedef struct{
	int exist;
	int none;
} dint;
int SwapDim1Array(dint **a,dint **b);

dint origin[MAXN];
dint buffer[MAXN];
dint *dp = origin;
dint *dpbuf = buffer;
int field[MAXN] = {0};
int length = 0;

int main (void){
	scanf("%d",&length);
	for(int i=0;i<=length;i++){
			dp[i].exist = INF;
			dp[i].none = INF;
	}
	dp[0].none = 0;
	for(int i=1;i<length;i++){
		scanf("%d",&field[i]);
	}


	for(int i=0;i<length;i++){		//くばるDP
		for(int j=0;j<=i;j++){
			dpbuf[j] = INF;
		}
		for(int j=0;j<=i;j++){
			dpbuf[j+1].exist = min(min(dp[j].exist + field[i+1] - field[i] , dp[j].none + field[i] + field[i+1]) , dpbuf[j+1].exist);
			dpbuf[j].none = min(min(dp[j].exist , dp[j].none) , dpbuf[j].none);
			SwapDim1Array(dp,dpbuf);
		}
	}

	int answer = 0;
	answer = min(dp[length/2].exist,dp[length/2].none);
	printf("%d\n",answer);

	return 0;
}

int SwapDim1Array(dint **a,dint **b){
	dint *c;
	c = *a;
	*a = *b;
	*b = c;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: no match for 'operator=' (operand types are 'dint' and 'double')
    9 | #define INF 1e+9
      |             ^~~~
a.cc:38:36: note: in expansion of macro 'INF'
   38 |                         dpbuf[j] = INF;
      |                                    ^~~
a.cc:14:3: note: candidate: 'constexpr dint& dint::operator=(const dint&)'
   14 | } dint;
      |   ^~~~
a.cc:14:3: note:   no known conversion for argument 1 from 'double' to 'const dint&'
a.cc:14:3: note: candidate: 'constexpr dint& dint::operator=(dint&&)'
a.cc:14:3: note:   no known conversion for argument 1 from 'double' to 'dint&&'
a.cc:43:39: error: cannot convert 'dint*' to 'dint**'
   43 |                         SwapDim1Array(dp,dpbuf);
      |                                       ^~
      |                                       |
      |                                       dint*
a.cc:15:26: note:   initializing argument 1 of 'int SwapDim1Array(dint**, dint**)'
   15 | int SwapDim1Array(dint **a,dint **b);
      |                   ~~~~~~~^
Language: C++


#include<iostream>
#include<cstdio>
#include<cstdlib>

using namespace std;

#define MAXN 10012
#define INF 1e+9

typedef struct{
	int exist;
	int none;
} dint;
int SwapDim1Array(dint **a,dint **b);

//dint origin[MAXN];
//dint buffer[MAXN];
dint *dp = origin;
dint *dpbuf = buffer;
dp = (dint *)malloc(sizeof(dint)*MAXN);
dpbuf = (dint *)malloc(sizeof(dint)*MAXN);
int field[MAXN] = {0};
int length = 0;

int main (void){
	scanf("%d",&length);
	for(int i=0;i<=length;i++){
			dp[i].exist = INF;
			dp[i].none = INF;
	}
	dp[0].none = 0;
	for(int i=1;i<length;i++){
		scanf("%d",&field[i]);
	}


	for(int i=0;i<length;i++){		//くばるDP
		for(int j=0;j<=i;j++){
			dpbuf[j] = INF;
		}
		for(int j=0;j<=i;j++){
			dpbuf[j+1].exist = min(min(dp[j].exist + field[i+1] - field[i] , dp[j].none + field[i] + field[i+1]) , dpbuf[j+1].exist);
			dpbuf[j].none = min(min(dp[j].exist , dp[j].none) , dpbuf[j].none);
			SwapDim1Array(dp,dpbuf);
		}
	}

	int answer = 0;
	answer = min(dp[length/2].exist,dp[length/2].none);
	printf("%d\n",answer);

	return 0;
}

int SwapDim1Array(dint **a,dint **b){
	dint *c;
	c = *a;
	*a = *b;
	*b = c;
	return 0;
}

Compiler output:
a.cc:19:12: error: 'origin' was not declared in this scope
   19 | dint *dp = origin;
      |            ^~~~~~
a.cc:20:15: error: 'buffer' was not declared in this scope; did you mean 'setbuffer'?
   20 | dint *dpbuf = buffer;
      |               ^~~~~~
      |               setbuffer
a.cc:21:1: error: 'dp' does not name a type
   21 | dp = (dint *)malloc(sizeof(dint)*MAXN);
      | ^~
a.cc:22:1: error: 'dpbuf' does not name a type
   22 | dpbuf = (dint *)malloc(sizeof(dint)*MAXN);
      | ^~~~~
a.cc: In function 'int main()':
a.cc:9:13: error: no match for 'operator=' (operand types are 'dint' and 'double')
    9 | #define INF 1e+9
      |             ^~~~
a.cc:40:36: note: in expansion of macro 'INF'
   40 |                         dpbuf[j] = INF;
      |                                    ^~~
a.cc:14:3: note: candidate: 'constexpr dint& dint::operator=(const dint&)'
   14 | } dint;
      |   ^~~~
a.cc:14:3: note:   no known conversion for argument 1 from 'double' to 'const dint&'
a.cc:14:3: note: candidate: 'constexpr dint& dint::operator=(dint&&)'
a.cc:14:3: note:   no known conversion for argument 1 from 'double' to 'dint&&'
a.cc:45:39: error: cannot convert 'dint*' to 'dint**'
   45 |                         SwapDim1Array(dp,dpbuf);
      |                                       ^~
      |                                       |
      |                                       dint*
a.cc:15:26: note:   initializing argument 1 of 'int SwapDim1Array(dint**, dint**)'
   15 | int SwapDim1Array(dint **a,dint **b);
      |                   ~~~~~~~^
Language: C++


#include<iostream>
#include<cstdio>
#include<cstdlib>

using namespace std;

#define MAXN 10012
#define INF 1e+9

typedef struct{
	int exist;
	int none;
}dint;
int SwapDim1Array(dint **a,dint **b);

dint origin[MAXN];
dint buffer[MAXN];
dint *dp = origin;
dint *dpbuf = buffer;
int field[MAXN] = {0};
int length = 0;

int main (void){
	scanf("%d",&length);
	for(int i=0;i<=length;i++){
			dp[i].exist = INF;
			dp[i].none = INF;
	}
	dp[0].none = 0;
	for(int i=1;i<length;i++){
		scanf("%d",&field[i]);
	}


	for(int i=0;i<length;i++){		//くばるDP
		for(int j=0;j<=i;j++){
			dpbuf[j].exist = INF;
			dpbuf[j].none = INF;
		}
		for(int j=0;j<=i;j++){
			dpbuf[j+1].exist = min(min(dp[j].exist + field[i+1] - field[i] , dp[j].none + field[i] + field[i+1]) , dpbuf[j+1].exist);
			dpbuf[j].none = min(min(dp[j].exist , dp[j].none) , dpbuf[j].none);
			SwapDim1Array(dp,dpbuf);
		}
	}

	int answer = 0;
	answer = min(dp[length/2].exist,dp[length/2].none);
	printf("%d\n",answer);

	return 0;
}

int SwapDim1Array(dint **a,dint **b){
	dint *c;
	c = *a;
	*a = *b;
	*b = c;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:39: error: cannot convert 'dint*' to 'dint**'
   44 |                         SwapDim1Array(dp,dpbuf);
      |                                       ^~
      |                                       |
      |                                       dint*
a.cc:15:26: note:   initializing argument 1 of 'int SwapDim1Array(dint**, dint**)'
   15 | int SwapDim1Array(dint **a,dint **b);
      |                   ~~~~~~~^