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

#include <iostream>
#include <stdlib.h>
using namespace std;

int main() {
  int min(int x, int y);
  int A, B;
  cin >> A >> B;
  char grid[10000][3];
  if (A >= B) {
    for (int i = 0; i < B - 1; i += 2) {
      for (int j = 0; j < 3) {
        grid[i][j] = '#';
        grid[i + 1][j] = '.';
      }
    }
    for (int i = 2 * B; i < A - B - 1; i += 2) {
      for(int j = 0; j < 3; j++) {
        grid[i][j] = '#';
        grid[i + 1][j] = '#';
      }
      grid[i + 1][1] = '.';
    }
    for(int i = 0; i < 3; i++) {
      grid[2 * A][i] = '#';
      grid[2 * A + 1][i] = '.';
    }
    cout << 3 << " " << 2 * A + 2 << endl;
    for (int h = 0; h < 3; h++) {
      for (int w = 0; w < 2 * A + 2; w++) {
        cout << grid[w][h];
      }
      cout << endl;
    }
  } else {
    for (int i = 0; i < A - 1; i += 2) {
      for (int j = 0; j < 3) {
        grid[i][j] = '.';
        grid[i + 1][j] = '#';
      }
    }
    for (int i = 2 * A; i < B - A - 1; i += 2) {
      for(int j = 0; j < 3; j++) {
        grid[i][j] = '.';
        grid[i + 1][j] = '.';
      }
      grid[i + 1][1] = '#';
    }
    for(int i = 0; i < 3; i++) {
      grid[2 * B][i] = '.';
      grid[2 * B + 1][i] = '#';
    }
    cout << 3 << " " << 2 * B + 2 << endl;
    for (int h = 0; h < 3; h++) {
      for (int w = 0; w < 2 * B + 2; w++) {
        cout << grid[w][h];
      }
      cout << endl;
    }
  }
}

int min(int x, int y) {
  if (x > y) {
    return y;
  } else {
    return x;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:28: error: expected ';' before ')' token
   12 |       for (int j = 0; j < 3) {
      |                            ^
      |                            ;
a.cc:37:28: error: expected ';' before ')' token
   37 |       for (int j = 0; j < 3) {
      |                            ^
      |                            ;
Language: Java

import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] a = new int[n+1];
		for(int i=0; i<n; i++){
			a[i] = scn.nextInt();
		}
      	int sum = 0;
      	int x = n;
      	for(int i=0; i<n; i++){
          sum += Math.abs(a[i]-a[x]);
          x = i;
        }
      	sum += Math.abs(a[n-1]-a[n]);
      	x = n;
      	for(int i=0; i<n; i++){
      	  int ans = sum;
      	  ans += Math.abs(a[x] - a[i+1]) - Math.abs(a[i] - a[x]) - Math.abs(a[i+1] - a[i]);
      	  System.out.println(ans)
      	  x = i;
    	}
	}
}

Compiler output:
Main.java:22: error: ';' expected
      	  System.out.println(ans)
      	                         ^
1 error
Language: C++

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;

template <typename T> inline void print(T val) { cout << val << '\n'; }

template <typename Iterator> inline void print(Iterator begin, Iterator end) {
  for (auto it = begin; it != end; it = next(it)) {
    cout << *it << ' ';
  }
  cout << '\n';
}

template <class T> inline T square(T x) {
  T result;
  result = x * x;
  return result;
};

#ifdef LOCAL
#define DBG_MACRO_NO_WARNING
#include <dbg.h>
#else
#define dbg(...) 0
#endif

const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);

  auto start = chrono::steady_clock::now();
#endif

  int n;
  cin >> n;

  vector<int> a(n + 1);
  a[0] = 0;

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

  int sum = 0;

  for (auto i = 0; i <= n; ++i) {
    if (i == 0) {
      sum += abs(a[n] - a[0]);
      continue;
    }

    sum += abs(a[i] - a[i - 1]);
    dbg(i, sum);
  }

  for (auto i = 1; i <= n; ++i) {
    if (i == n) {
      print((sum - abs(a[n] - a[n - 1]) - abs(a[n] - a[0]) +
                abs(a[n - 1] + a[0]));

      continue;
    }
    print(sum - abs(a[i] - a[i - 1]) - abs(a[i] - a[i + 1]) +
          abs(a[i - 1] - a[i + 1]));

    dbg(sum - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) +
        abs(a[i - 1] - a[i + 1]));
  }

  dbg(sum);

#ifdef LOCAL
  auto end = chrono::steady_clock::now();
  auto diff = end - start;

  cout << "Duration: " << chrono::duration<double, milli>(diff).count() << " ms"
       << '\n';
#endif

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:69:38: error: expected ')' before ';' token
   69 |                 abs(a[n - 1] + a[0]));
      |                                      ^
      |                                      )
a.cc:68:12: note: to match this '('
   68 |       print((sum - abs(a[n] - a[n - 1]) - abs(a[n] - a[0]) +
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
long long counter=0;
long long n;
cin>>n;
long long b[n+2]={};
long long a[n+2]={};
long long c[n+2]={};
long long d[n]={};
for(long long i=0; i<n; i++){
cin>>a[i+1];}
for(long long i=0; i<n; i++){
b[i]=abs(a[i+1]-a[i]);
c[i]=abs(a[i+2]-a[i]);
b[n]=abs(a[n+1]);
counter+=b[n];
for(long long i=0; i<n-1; i++){
cout<<counter-b[i]-b[i+1]+c[i]<<endl;}
cout<<counter-b[n-1]*2<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:31: error: expected '}' at end of input
   20 | cout<<counter-b[n-1]*2<<endl;}
      |                               ^
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

int main(){
  ll N; cin>>N;
  ll a[N]; CINA(a,N);
  ll d[N+1];
  for(int i=0;i<N+1;i++){
    if(i==0){d[0] = abs(a[0]);continue;}
    if(i==N){d[N] = abs(a[N-1]);continue;}
    d[i] = abs(a[i]-a[i-1]);
  }
  
  ll s = sum(d,N+1);
  REP(i,N){
    ll r;
    if(i==0){ r = s - (d[0]+d[1]) + abs(a[1]);}
    else if(i==N-1){ r = s - (d[N-1]+d[N]) + abs(a[N-2]);}
    else{r = s - (d[i]+d[i+1]) + abs(a[i+1]-a[i-1]);}
    cout << r <<"\n";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:10: error: 'sum' was not declared in this scope
   27 |   ll s = sum(d,N+1);
      |          ^~~
Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll n;
  cin>>n;
  vll t(0);
  t.pb(0);
  rep(i,n){
    ll a
    cin>>a;
    t.pb(a);
  }
  t.pb(0);
  ll ans=0;
  for(int i=1;i<n+1;i++){
    ans+=abs(t[i]-t[i-1]);
  }
  for(int i=1;i<n+1;i++){
    ll aa=ans;
    aa-=abs(t[i]-t[i-1])+abs(t[i+1]-t[i]);
    aa+=abs(t[i+1]-t[i-1]);
    COUT(aa);
  }
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:40:5: error: expected initializer before 'cin'
   40 |     cin>>a;
      |     ^~~
a.cc:41:10: error: 'a' was not declared in this scope
   41 |     t.pb(a);
      |          ^
Language: C++

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

int main() {
  int n;
  vector<int> a(n + 2);
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a.at(i + 1);
  }
  a.at(0) = 0;
  a.at(n + 1) = 0;
  vector<int> b(n);
  for(int i = 0; i < n + 1; i++){
    b.at(i) = a.at(i + 1) - a.at(i);
  }
  vector<int> c(n);
  for(int i = 0; i < n; i++){
    c.at(i) = a.at(i + 2) - a.at(i);
  }
  long int sum = 0;
  for(int i = 0; i < n + 1; i++){
    out += b.at(i);
  }
  for(int i = 0; i < n; i++){
    cout << out - b.at(i) - b.at(i + 1) + c.at(i) << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'out' was not declared in this scope
   23 |     out += b.at(i);
      |     ^~~
a.cc:26:13: error: 'out' was not declared in this scope
   26 |     cout << out - b.at(i) - b.at(i + 1) + c.at(i) << endl;
      |             ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

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

    vector<pair<int, int>> LR(N);
    int l, r, D[M+10];
    rep(i,M)
    {
        cin >> l >> r >> D[i];
        LR[i].first = l;
        LR[i].second = r;
    }

    sort(LR.begin, LR.end);

    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: no matching function for call to 'sort(<unresolved overloaded function type>, <unresolved overloaded function type>)'
   27 |     sort(LR.begin, LR.end);
      |     ~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   template argument deduction/substitution failed:
a.cc:27:9: note:   couldn't deduce template parameter '_RAIter'
   27 |     sort(LR.begin, LR.end);
      |     ~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
const ll INF = LLONG_MAX;
const ll MOD = 1e9 + 7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    vector<ll> A(N), B(N) = {};
    ll sum = 0;
    rep(i, N) { cin >> A[i];
        sum += A[i];
    }
    rep(i, N - 1) { B[i] = abs(A[i + 1] - A[i]); }
    rep(i, N) {
        cout << sum - B[i] - B[i + 1] + A[i] + A[i + 1] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:27: error: expected ',' or ';' before '=' token
   13 |     vector<ll> A(N), B(N) = {};
      |                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,a[100007],s;
int main(){
  cin >> n;
  for(int i = 1; i<=n; i++) cin >> a[i];
  for(int i = 0; i<=n; i++) s+=abs(a[i]-a[i+1]);
  for(int i = 1; i<=n; i++)
    cout<<s+abs(a[i-1]-a[i+1])-abs(a[i]-a[i+1])-abs(a[i]-a[i-1]))<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:65: error: expected ';' before ')' token
    9 |     cout<<s+abs(a[i-1]-a[i+1])-abs(a[i]-a[i+1])-abs(a[i]-a[i-1]))<<endl;
      |                                                                 ^
      |                                                                 ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,a[100007],tot;
int main(){
  cin >> n;
  for(int i = 1; i<=n; i++) cin >> a[i];
  for(int i = 0; i<=n; i++) s+=abs(a[i]-a[i+1]);
  for(int i = 1; i<=n; i++)
    cout<<s+abs(a[i-1]-a[i+1])-abs(a[i]-a[i+1])-abs(a[i]-a[i-1]))<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:29: error: 's' was not declared in this scope
    7 |   for(int i = 0; i<=n; i++) s+=abs(a[i]-a[i+1]);
      |                             ^
a.cc:9:11: error: 's' was not declared in this scope
    9 |     cout<<s+abs(a[i-1]-a[i+1])-abs(a[i]-a[i+1])-abs(a[i]-a[i-1]))<<endl;
      |           ^
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main()
{int N ; cin >> N;
 vector<int> A(N+2,0);//A[0],A[N+1]を発着地点とする
 for(int i = 1; i <= N;i++)
 {cin >> A[i];}
 
 int total = 0:
 
 for(int i = 0; i <= N; i++)
 {total += abs(A[i+1] - A[i]);}
 
 for(int j = 1; j <= N; j++)
 {int c = abs(A[j+1] - A[j]) + abs(A[j] - A[j-1]) - abs(A[j+1] - A[j]);
  cout << total - c << endl;}
 
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: expected ',' or ';' before ':' token
   12 |  int total = 0:
      |               ^
a.cc:14:17: error: 'i' was not declared in this scope
   14 |  for(int i = 0; i <= N; i++)
      |                 ^
Language: C++

#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  int n,num[110000],ans=0;
  cin>>n;
  for(int i=0;i<n+1;i++){
    if(i=0 or i=n)
      num[i]=0;
    else{
      cin>>num[i];
      ans+=abs(num[i]-num[i-1]);
    }
  }
  for(int j=1;j<n;j++){
    cout<<ans-(abs(num[j]-num[j-1])+abs(num[j+1]-num[j]))+abs(num[j-1]-num[j+1])<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: lvalue required as left operand of assignment
   11 |     if(i=0 or i=n)
      |          ~~^~~~
Language: C++

.#include<bits/stdc++.h>
using namespace std;
#define MAXN 100100
#define eps 1e-9
#define For(i,a,b) for(int i=a;i<=b;i++) 
#define Fore(i,a,b) for(int i=a;i>=b;i--) 
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define mkp make_pair
#define pb push_back
#define cr clear()
#define met(a,b) memset(a,b,sizeof(a))
#define iossy ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define fre freopen
#define pi acos(-1.0)
#define inf 1e9+9
#define Vector Point
#define fir first
#define sec second
#define fxx(a) cout<<fixed<<setprecision(a)
#define flu cout.flush()
typedef pair<int,int> pii;
const int Mod=1000000007;
typedef unsigned long long ull;
typedef long long ll;
const int base=227;
const int base1=123;
const int maxn=2005;
int a,b;
void solve(){
	cin>>a>>b;
	cout<<100<<" "<<100<<endl;
	char c;
	For(i,1,100) {
		if(a>0 && b>0) {
			if(i&1) {
				For(j,1,50) cout<<".";a--;
				For(j,51,100) cout<<"#";b--;
			}else {
				For(j,1,50) cout<<"#";b--;
				For(j,51,100) cout<<".";a--;
			}
		}else if(a==0 && b==1) {
			For(j,1,100) cout<<".";a=-1;c='#';b=-1;
		}else if(b==0 && a==1) {
			For(j,1,100) cout<<"#";b=-1;c='.';a=-1;
		}else if(a==-1 && b==-1){
			For(j,1,100) cout<<c;
		}else if(a==0 && b==0) {
			For(j,1,100) cout<<".";	
		}cout<<endl;
	}
}
int main(){
	iossy;
	int t=1;
	For(i,1,t) solve();
	return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | .#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: expected unqualified-id before '.' token
    1 | .#include<bits/stdc++.h>
      | ^
a.cc:22:9: error: 'pair' does not name a type
   22 | typedef pair<int,int> pii;
      |         ^~~~
a.cc: In function 'void solve()':
a.cc:31:9: error: 'cin' was not declared in this scope
   31 |         cin>>a>>b;
      |         ^~~
a.cc:32:9: error: 'cout' was not declared in this scope
   32 |         cout<<100<<" "<<100<<endl;
      |         ^~~~
a.cc:32:30: error: 'endl' was not declared in this scope
   32 |         cout<<100<<" "<<100<<endl;
      |                              ^~~~
a.cc: In function 'int main()':
a.cc:13:15: error: 'ios' has not been declared
   13 | #define iossy ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
      |               ^~~
a.cc:55:9: note: in expansion of macro 'iossy'
   55 |         iossy;
      |         ^~~~~
a.cc:13:43: error: 'cin' was not declared in this scope
   13 | #define iossy ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
      |                                           ^~~
a.cc:55:9: note: in expansion of macro 'iossy'
   55 |         iossy;
      |         ^~~~~
a.cc:13:54: error: 'cout' was not declared in this scope
   13 | #define iossy ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
      |                                                      ^~~~
a.cc:55:9: note: in expansion of macro 'iossy'
   55 |         iossy;
      |         ^~~~~
Language: C++

def inpl(): return [int(i) for i in input().split()]
N = int(input())
A = [0]+inpl()+[0]
sumtr = 0
for i in range(N+1):
    sumtr += abs(A[i+1]-A[i])
for i in range(1,N+1):
    print(sumtr +abs(A[i+1]-A[i-1]) -abs(A[i]-A[i-1]) -abs(A[i+1]-A[i]))    

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def inpl(): return [int(i) for i in input().split()]
      | ^~~
Language: C++

#include "stdafx.h"
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"

#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define ll long long int
#define sp ' '
#define intmax 2147483647
#define intmin -2147483647
#define llmax 9223372036854775807
using namespace std;

int n, a[100002], s;

int main(){
	cin >> n;
	a[0] = 0;
	s = 0;
	lp(n) {
		cin >> a[i + 1];
		s += abs(a[i + 1] - a[i]);
	}
	s += abs(a[n]);
	a[n + 1] = 0;
	lp(n)
		cout << s - abs(a[i + 1] - a[i]) - abs(a[i + 2] - a[i + 1]) + abs(a[i + 2] - a[i]) << 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<iostream>
#include<vector>
using namespace std;
int abs(int,int)
int main(){
int N,i,x;
scanf("%d",&N);
vector<int>a(N),b(N),c(N);
b[0]=0;
for(i=0;i<N;i++){
scanf("%d",&a[i]);
if(i!=0){
b[i]=abs(a[i-1],a[i]);
c[i]=b[i-1]+b[i];
}
}
for(i=0;i<N;i++){
x=c[x-1]+c[N-1]-c[x+1]+abs(a[x-1],a[x+1]);
printf("%d\n",x);
}
return 0;
} 
int abs(int a,int b){
int c;
if(b-a>=0)c=b-a;
else c=a-b;
return c;
}

Compiler output:
a.cc:5:1: error: expected initializer before 'int'
    5 | int main(){
      | ^~~
Language: C++

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

int main() {
	int n;
	vector<int>vec(n);
	int sum=max(vec.at(0),-vec.at(0));
	cin>>n;
	
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		vec.at(i)=a;
	}
	for(int i=0;i<n-1;i++){
		sum+=max(vec.at(i+1)-vec.at(i),vec.at(i)-vec.at(i+1));
	}
	sum+=max(vec.at(i-1),-vec.at(i-1));
	if(vec.at(1)>=vec.at(0)>=0||vec.at(1)<=vec.at(0)<=0){
			cout<<sum<<endl;
		}
		else if(vec.at(0)>=vec.at(1)>=0||vec.at(0)<=0<=vec.at(1)){
			cout<<sum-max(vec.at(0),-vec.at(0))<<endl;
		}
		else{
			cout<<sum-max(vec.at(1)-vec.at(0),vec.at(0)-vec.at(1))<<endl;
		}
	for(int i=0;i<n-2;i++){
		if(vec.at(i+2)>=vec.at(i+1)>=vec.at(i)||vec.at(i+2)<=vec.at(i+1)<=vec.at(i)){
			cout<<sum<<endl;
		}
		else if(vec.at(i+1)>=vec.at(i+2)>=vec.at(i)||vec.at(i+1)<=vec.at(i)<=vec.at(i+2)){
			cout<<sum-max(vec.at(i+1)-vec.at(i),vec.at(i)-vec.at(i+1))<<endl;
		}
		else{
			cout<<sum-max(vec.at(i+2)-vec.at(i+1),vec.at(i+1)-vec.at(i+2))<<endl;
		}
		
	}
	if(0>=vec.at(n-1)>=vec.at(n-2)||0<=vec.at(n-1)<=vec.at(n-2)){
			cout<<sum<<endl;
		}
		else if(vec.at(n-1)>=0>=vec.at(n-2)||vec.at(n-1)<=vec.at(n-2)<=0){
			cout<<sum-max(vec.at(n-1)-vec.at(n-2),vec.at(n-1)-vec.at(n-2))<<endl;
		}
		else{
			cout<<sum-max(-vec.at(n-1),vec.at(n-1))<<endl;
		}
		
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: 'i' was not declared in this scope
   19 |         sum+=max(vec.at(i-1),-vec.at(i-1));
      |                         ^
Language: C++

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

int main()
{
    long long n, d;
    cin >> n >> d;
    long long x[n] = {};
    int lb[n] = {};
    for(int i = 0; i<n; i++){
        cin >> x[i];
    }
    for(int i = 0; i<n; i++){
        auto b = lower_bound(x+i, x+n, x[i]+d+1);
        lb[i] = (long long)b-x;
    }
    long long ans = 0;
    for(int l=0, r=1; l<n-2; l++){
        if(lb[l] == n) break;
        r--;
        while(r < lb[l]){
            if(lb[l] < lb[r]) ans += lb[r] - lb[l];
            r++;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:29: error: invalid operands of types 'long long int' and 'long long int [n]' to binary 'operator-'
   16 |         lb[i] = (long long)b-x;
      |                 ~~~~~~~~~~~~^~
      |                 |            |
      |                 |            long long int [n]
      |                 long long int
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll = int long long;
map <int ,int> mpa,mpb;

int main(){
  int N;
  cin >> N;
  int A[N+5]={0}, B[N+5]={0};
  ll sum=0;
  ll t=0;
  A[0]=0, B[0]=0,B[N+1]=0,A[N+1]=0;
  for(int i=1;i<=N;i++){
    cin >> A[i];
  }
  for(int i=0;i<=N;i++){
    B[i]=abs(A[i]-A[i-1]);
    sum+=B[i];
  }

  for(int i=1;i<=N;i++){
    t=sum;
    t-=d[i-1]+d[i];
		t+=abs(a[i+1]-a[i-1]);
		cout<<t<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:8: error: 'd' was not declared in this scope
   32 |     t-=d[i-1]+d[i];
      |        ^
a.cc:33:24: error: 'a' was not declared in this scope
   33 |                 t+=abs(a[i+1]-a[i-1]);
      |                        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

int N,sum;
int A[112345];
int B[112345];
int main(){
  cin>>N;

  int sum = 0;
  FOR(i,1,N+1){
    cin>>A[i];
    sum+=abs(A[i]-A[i-1]);
  }
  sum+=abs(A[N]);
  FOR(i,1,N+1){
    int a = abs(A[i-1]-A[i])+abs(A[i]-A[i+1]);
    int b = abs(A[i-1]-A[i+1]-A[i+1]);
  }
  cout<<sum- a+b<<endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:14: error: 'a' was not declared in this scope
   33 |   cout<<sum- a+b<<endl;
      |              ^
a.cc:33:16: error: 'b' was not declared in this scope
   33 |   cout<<sum- a+b<<endl;
      |                ^
Language: C++

/*
Contest: AtCoder Regular Contest
C - Traveling Plan
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAXN int(1e5)
struct Node
{
	int pos,num;
}poi[MAXN+5];
int n;
bool cmp(Node A,Node B)
{
	return A.pos<B.pos;
}
int main()
{
	//freopen("in.txt","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&poi[i].pos);
		poi[i].num=i;
	}
	sort(poi+1,poi+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		int left=0,right=0;
		if(poi[1].num==i) left=min(0,poi[2].pos);
		else left=min(0,poi[1].pos);
		if(poi[n].num==i) right=max(0,poi[n-1].pos);
		else right=max(0,poi[n].pos);
		printf("%d\n",(right-left)*2);
	}d
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:10: error: 'd' was not declared in this scope
   37 |         }d
      |          ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

// white 0; black 1
int mp[110][110];
int main(){
    int a, b;
    cin >> a >> b;
    int n = 100;
    metset(mp, 0, sizeof(mp));
    for(int i = 0; i < n / 2; i ++){
        for(int j = 0; j < n; i ++){
            mp[i][j] = 1;
        }
    }
    a --; b --;
    for(int i = 0; i < n; ++i){
    	int j = (i & 1 ? 1 : 0);
        for(; j < n && a; j+=2, a--){
        	mp[i][j] = 0;
        }
    }
  	for(int i = n / 2 + 1; i < n; ++i){
      int j = (i & 1 > 0 : 1);
      for(; j < n && b; j+=2, b--){
        mp[i][j] = 1;
      }
    }
  	cout << n << " " << n << endl;
  	for(int i = 0; i < n; ++i){
      for(int j = 0; j < n; ++j){
      	cout << mp[i][j];
      }
      cout << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'metset' was not declared in this scope; did you mean 'memset'?
   11 |     metset(mp, 0, sizeof(mp));
      |     ^~~~~~
      |     memset
a.cc:25:25: error: expected ')' before ':' token
   25 |       int j = (i & 1 > 0 : 1);
      |               ~         ^~
      |                         )
Language: C++

#include <bits/stdc++.h>

using namespace std;

// white 0; black 1
int mp[110][110];
int main(){
    int a, b;
    cin >> a >> b;
    int n = 100;
    metset(mp, 0, sizeof(mp));
    for(int i = 0; i < n / 2; i ++){
        for(int j = 0; j < n; i ++){
            mp[i][j] = 1;
        }
    }
    a --; b --;
    for(int i = 0; i < n; ++i){
    	int j = (i & 1 ? 1 : 0);
        for(; j < n && a; j+=2, a--){
        	mp[i][j] = 0;
        }
    }
  	for(int i = n / 2 + 1; i < n; ++i){
      int j = (i & 1 > 0 : 1);
      for(; j < n && b; j+=2, b--){
        mp[i][j] = 1;
      }
    }
  	cout << n << endl;
  	for(int i = 0; i < n; ++i){
      for(int j = 0; j < n; ++j){
      	cout << mp[i][j];
      }
      cout << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'metset' was not declared in this scope; did you mean 'memset'?
   11 |     metset(mp, 0, sizeof(mp));
      |     ^~~~~~
      |     memset
a.cc:25:25: error: expected ')' before ':' token
   25 |       int j = (i & 1 > 0 : 1);
      |               ~         ^~
      |                         )
Language: C

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  cin>>n;
  vi a(n+2);
  rep(i,n)cin>>a[i+1];
  a[0]=a[n+1]=0;
  n+=2;

  vi x(n,0),y(n,0);
  //x[i] := 最初の座標0から観光スポットi-1までの値段
  //y[i] := 観光スポットi+1から最後の座標0までの値段

  rep(i,n-1) 
    x[i+1]=x[i]+abs(a[i+1]-a[i]);
  for(i=n-1;i>0;i--)
    y[i-1]=y[i]+abs(a[i-1]-a[i]);

  loop(i,1,n-1){
    cout<<x[i-1]+abs(a[i-1]-a[i+1])+y[i+1]<<endl;
  }

}


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

n = int(input())
spots = list(map(int, input().split()))

costs = [n1 - n2 for n1, n2 in zip(spots + [0], [0] + spots)]
costs_sum = sum([abs(cost) for cost in costs])

for i in range(n):
    if costs[i] * costs[i + 1] < 0:
        elim = min([abs(costs[i]), abs(costs[i + 1])])
        print(costs_sum - 2 * abs(elim))
    else:
        print(costs_sum)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cstdlib>


using namespace std;


int main() {
	int n, min, max, b = 0, sum = 0, smax, smin;
	int a[100000] = { 0 }, c[100000] = { 0 };
	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}



	for (int i = 0; i < n; i++) {
		c[i] = a[i];
	}

	sort(a, a + n + 1);



	min = a[0];
	smin = a[1];
	smax = a[n - 1];
	max = a[n];

	for (int i = 0; i <= n; i++) {
		sum += abs(c[i] - b);
		b = c[i];
	}





	for (int i = 0; i < n; i++) {
		if (c[i] == min) {
	
				printf("%d\n", sum - abs(2 * (smin - min)));
			
		
		}
		else if (c[i] == max) {
			
				printf("%d\n", sum - abs(2 * (max - smax)));
			
		
		}
		else {
			printf("%d\n", sum);
		}
	}

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cstdlib>


using namespace std;


int main() {
	int n, min, max, b = 0, sum = 0, smax, smin;
	int a[100000] = { 0 }, c[100000] = { 0 };
	scanf_s("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf_s("%d", &a[i]);
	}



	for (int i = 0; i < n; i++) {
		c[i] = a[i];
	}

	sort(a, a + n);



	min = a[0];
	smin = a[1];
	smax = a[n - 2];
	max = a[n - 1];

	for (int i = 0; i <= n; i++) {
		sum += abs(c[i] - b);
		b = c[i];
	}





	for (int i = 0; i < n; i++) {
		if (c[i] == min) {
			if ((min > 0) == (smin > 0)) {
				printf("%d\n", sum - abs(2 * (smin - min)));
			}
			else {
				printf("%d\n", sum - abs(2 * min));
			}
		}
		else if (c[i] == max) {
			if ((max > 0) == (smax > 0)) {
				printf("%d\n", sum - abs(2 * (max - smax)));
			}
			else {
				printf("%d", sum - abs(2 * max));
			}
		}
		else {
			printf("%d\n", sum);
		}
	}




}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   15 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++


#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cstdlib>


using namespace std;


int main() {
	int n, min, max, b = 0, sum=0, smax, smin;
	int a[100000] = { 0 }, c[100000] = { 0 };
	scanf_s("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf_s("%d", &a[i]);
	}

	

	for (int i = 0; i < n; i++) {
		c[i] = a[i];
	}

	sort(a, a + n);

	

	min = a[0];
	smin = a[1];
	smax = a[n - 2];
	max = a[n - 1];

	for (int i = 0; i <= n; i++) {
		sum += abs(c[i] - b);
		b = c[i];
	}
	
	
	


	for (int i = 0; i < n; i++) {
		if (c[i] == min ) {
			if ((min > 0) == (smin > 0)) {
				printf("%d\n", sum - abs(2 * (smin - min)));
			}
			else {
				printf("%d\n", sum - abs(2 * min));
			}
		}
		else if (c[i] == max) {
			if ((max > 0) == (smax > 0)) {
				printf("%d\n", sum - abs(2 * (max - smax)));
			}
			else {
				printf("%d", sum - abs(2 * max));
			}
		}
		else {
			printf("%d\n", sum);
		}
	}
	


	
}

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

n = int(input())
a = [0] + list(map(int,input().split())) + [0]
b = 0
for i in range(0,n+1):
	b += int(abs(a[i+1]-a[i]))
for i in range(1,n+1):
	ans = b
	ans -= abs(a[i]-a[i-1])
	ans -= abs(a[i+1]-a[i])
	ans += abs(a[i+1]-a[i-1])
	print(ans)


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

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

     using namespace std;

    int travel_plan(int N, std::vector<int> nodes)
    {
        if(N != nodes.size())
        {
            return -1;
        }
    int sum = abs(nodes[0]) + abs(nodes[N-1]);
     
    std::vector<int> dist_ad;
    dist_ad.resize(N+1);
   std::vector<int> dist_jump;
    dist_jump.resize(N);

    dist_ad[0] = abs(nodes[0]);
    dist_ad[N] = abs(nodes[N-1]);
    dist_jump[0] = abs(nodes[1]);
    dist_jump[N-1] = abs(nodes[N-2]);
    for(int i=1; i<N; i++) {
    dist_ad[i] = abs(nodes[i] - nodes[i-1]);
        sum += dist_ad[i];
    if(i < N-1)
    {
    dist_jump[i] = abs(nodes[i+1] - nodes[i-1]);
    }
    }
     
    for(int i=0; i<N; i++) {
        int tmp_sum = sum - dist_ad[i] - dist_ad[i+1] + dist_jump[i];
        std::cout<<tmp_sum<<std::endl;
    }
     return 0;
    }

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

     using namespace std;

    int travel_plan(int N, std::vector<int> nodes)
    {
        if(N != nodes.size())
        {
            return -1;
        }
    int sum = abs(nodes[0]) + abs(nodes[N-1]);
    std::vector<int> dist(N+2);
    dist[0] = 0;
    dist[N+1] = 0;
     
    std::vector<int> dist_ad(N+1);
   std::vector<int> dist_jump(N);
    dist[0] = 0;
    dist[N+1] = 0;
    dist_ad[0] = abs(nodes[0]);
    dist_ad[N] = abs(nodes[N-1]);
    dist_jump[0] = abs(nodes[1]);
    dist_jump[N-1] = abs(nodes[N-2]);
    for(int i=1; i<N; i++) {
    dist_ad[i] = abs(nodes[i] - nodes[i-1]);
        sum += dist_ad[i];
    if(i < N-1)
    {
    dist_jump[i] = abs(nodes[i+1] - nodes[i-1]);
    }
    dist[i] = nodes[i-1];
    }
     
    for(int i=0; i<N; i++) {
        int tmp_sum = sum - dist_ad[i] - dist_ad[i+1] + dist_jump[i];
        std::cout<<tmp_sum<<std::endl;
    }
     
    }

Compiler output:
a.cc: In function 'int travel_plan(int, std::vector<int>)':
a.cc:42:5: warning: control reaches end of non-void function [-Wreturn-type]
   42 |     }
      |     ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++


#include <bits/stdc++.h>

#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;
using ld = long double;

constexpr ll MOD = 1000000007LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> A(N + 2, 0);
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }
    ll orig = 0;
    for (int i = 0; i <= N; i++) {
        orig += abs(A[i] - A[i + 1]);
    }
    vector<ll> adv(N + 2);
    for (int i = 1; i <= N; i++) {
        adv[i] = abs(A[i - 1] - A[i]) + abs(A[i] - A[i + 1]) - abs(A[i - 1] - A[i + 1]);
    }
    for (int i = 1; i <= N; i++) {
        cout << orig - adv[i] << endl;
    }
    return 0;
}

#include <bits/stdc++.h>

#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;
using ld = long double;

constexpr ll MOD = 1000000007LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> A(N + 2, 0);
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }
    ll orig = 0;
    for (int i = 0; i <= N; i++) {
        orig += abs(A[i] - A[i + 1]);
    }
    vector<ll> adv(N + 2);
    for (int i = 1; i <= N; i++) {
        adv[i] = abs(A[i - 1] - A[i]) + abs(A[i] - A[i + 1]) - abs(A[i - 1] - A[i + 1]);
    }
    for (int i = 1; i <= N; i++) {
        cout << orig - adv[i] << endl;
    }
    return 0;
}


Compiler output:
a.cc:49:14: error: redefinition of 'constexpr const ll MOD'
   49 | constexpr ll MOD = 1000000007LL;
      |              ^~~
a.cc:11:14: note: 'constexpr const ll MOD' previously defined here
   11 | constexpr ll MOD = 1000000007LL;
      |              ^~~
a.cc:52:13: error: redefinition of 'template<class T> constexpr const T INF'
   52 | constexpr T INF = numeric_limits<T>::max() / 10;
      |             ^~~
a.cc:14:13: note: 'template<class T> constexpr const T INF<T>' previously declared here
   14 | constexpr T INF = numeric_limits<T>::max() / 10;
      |             ^~~
a.cc:54:5: error: redefinition of 'int main()'
   54 | int main()
      |     ^~~~
a.cc:16:5: note: 'int main()' previously defined here
   16 | int main()
      |     ^~~~
Language: C++

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

     using namespace std;

    int travel_plan(int N, std::vector<int> nodes)
    {
        if(N != nodes.size())
        {
            return -1;
        }
    int sum = abs(nodes[0]) + abs(nodes[N-1]);
    std::vector<int> dist(N+2);
    dist[0] = 0;
    dist[N+1] = 0;
     
    std::vector<int> dist_ad(N+1);
   std::vector<int> dist_jump(N);
    dist[0] = 0;
    dist[N+1] = 0;
    dist_ad[0] = abs(Nodes[0]);
    dist_ad[N] = abs(Nodes[N-1]);
    dist_jump[0] = abs(Nodes[1]);
    dist_jump[N-1] = abs(Nodes[N-2]);
    for(int i=1; i<N; i++) {
    dist_ad[i] = abs(nodes[i] - nodes[i-1]);
        sum += dist_ad[i];
    if(i < N-1)
    {
    dist_jump[i] = abs(nodes[i+1] - nodes[i-1]);
    }
    dist[i] = nodes[i-1];
    }
     
    for(int i=0; i<N; i++) {
        int tmp_sum = sum - dist_ad[i] - dist_ad[i+1] + dist_jump[i];
        std::cout<<tmp_sum<<std::endl;
    }
     
    }

Compiler output:
a.cc: In function 'int travel_plan(int, std::vector<int>)':
a.cc:23:22: error: 'Nodes' was not declared in this scope; did you mean 'nodes'?
   23 |     dist_ad[0] = abs(Nodes[0]);
      |                      ^~~~~
      |                      nodes
a.cc:42:5: warning: control reaches end of non-void function [-Wreturn-type]
   42 |     }
      |     ^
Language: C++

    #include <vector>
     using namespace std;

    int travel_plan(int N, std::vector<int> nodes)
    {
        if(N != nodes.size())
        {
            return -1;
        }
    int sum = abs(nodes[0]) + abs(nodes[N-1]);
    std::vector<int> dist(N+2);
    dist[0] = 0;
    dist[N+1] = 0;
     
    std::vector<int> dist_ad(N+1);
   std::vector<int> dist_jump(N);
    dist[0] = 0;
    dist[N+1] = 0;
    dist_ad[0] = abs(Nodes[0]);
    dist_ad[N] = abs(Nodes[N-1]);
    dist_jump[0] = abs(Nodes[1]);
    dist_jump[N-1] = abs(Nodes[N-2]);
    for(int i=1; i<N; i++) {
    dist_ad[i] = abs(nodes[i] - nodes[i-1]);
        sum += dist_ad[i];
    if(i < N-1)
    {
    dist_jump[i] = abs(nodes[i+1] - nodes[i-1]);
    }
    dist[i] = nodes[i-1];
    }
     
    for(int i=0; i<N; i++) {
        int tmp_sum = sum - dist_ad[i] - dist_ad[i+1] + dist_jump[i];
         fprintf("%d\n", tmp_sum);
    }
     
    }

Compiler output:
a.cc: In function 'int travel_plan(int, std::vector<int>)':
a.cc:10:15: error: 'abs' was not declared in this scope
   10 |     int sum = abs(nodes[0]) + abs(nodes[N-1]);
      |               ^~~
a.cc:19:22: error: 'Nodes' was not declared in this scope; did you mean 'nodes'?
   19 |     dist_ad[0] = abs(Nodes[0]);
      |                      ^~~~~
      |                      nodes
a.cc:35:10: error: 'fprintf' was not declared in this scope
   35 |          fprintf("%d\n", tmp_sum);
      |          ^~~~~~~
a.cc:38:5: warning: control reaches end of non-void function [-Wreturn-type]
   38 |     }
      |     ^
Language: C++

#include <vector>

int travel_plan(int N, vector<int> nodes)
{
    if(N != nodes.size())
    {
        return -1;
    }
int sum = abs(nodes[0]) + abs(nodes[N-1]);
vector<int> dist(N+2);
dist[0] = 0;
dist[N+1] = 0;

vector<int> dist_ad(N+1);
vector<int> dist_jump(N);
dist[0] = 0;
dist[N+1] = 0;
dist_ad[0] = abs(Nodes[0]);
dist_ad[N] = abs(Nodes[N-1]);
dist_jump[0] = abs(Nodes[1]);
dist_jump[N-1] = abs(Nodes[N-2]);
for(int i=1; i<N; i++) {
dist_ad[i] = abs(nodes[i] - nodes[i-1]);
    sum += dist_ad[i];
if(i < N-1)
{
dist_jump[i] = abs(nodes[i+1] - nodes[i-1]);
}
dist[i] = nodes[i-1];
}

for(int i=0; i<N; i++) {
    int tmp_sum = sum - dist_ad[i] - dist_ad[i+1] + dist_jump[i];
     fprintf("%d\n", tmp_sum);
}

}

Compiler output:
a.cc:3:24: error: 'vector' has not been declared
    3 | int travel_plan(int N, vector<int> nodes)
      |                        ^~~~~~
a.cc:3:30: error: expected ',' or '...' before '<' token
    3 | int travel_plan(int N, vector<int> nodes)
      |                              ^
a.cc: In function 'int travel_plan(int, int)':
a.cc:5:13: error: 'nodes' was not declared in this scope
    5 |     if(N != nodes.size())
      |             ^~~~~
a.cc:9:15: error: 'nodes' was not declared in this scope
    9 | int sum = abs(nodes[0]) + abs(nodes[N-1]);
      |               ^~~~~
a.cc:9:11: error: 'abs' was not declared in this scope
    9 | int sum = abs(nodes[0]) + abs(nodes[N-1]);
      |           ^~~
a.cc:10:1: error: 'vector' was not declared in this scope
   10 | vector<int> dist(N+2);
      | ^~~~~~
a.cc:10:1: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:10:8: error: expected primary-expression before 'int'
   10 | vector<int> dist(N+2);
      |        ^~~
a.cc:11:1: error: 'dist' was not declared in this scope
   11 | dist[0] = 0;
      | ^~~~
a.cc:14:8: error: expected primary-expression before 'int'
   14 | vector<int> dist_ad(N+1);
      |        ^~~
a.cc:15:8: error: expected primary-expression before 'int'
   15 | vector<int> dist_jump(N);
      |        ^~~
a.cc:18:1: error: 'dist_ad' was not declared in this scope
   18 | dist_ad[0] = abs(Nodes[0]);
      | ^~~~~~~
a.cc:18:18: error: 'Nodes' was not declared in this scope
   18 | dist_ad[0] = abs(Nodes[0]);
      |                  ^~~~~
a.cc:20:1: error: 'dist_jump' was not declared in this scope
   20 | dist_jump[0] = abs(Nodes[1]);
      | ^~~~~~~~~
a.cc:34:6: error: 'fprintf' was not declared in this scope
   34 |      fprintf("%d\n", tmp_sum);
      |      ^~~~~~~
a.cc:37:1: warning: control reaches end of non-void function [-Wreturn-type]
   37 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define N 100010
int n,sum,a[N];
int Abs(int x) {return x>0?x:-x;}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&a[i]);
		sum+=Abs(a[i]-a[i-1])

	}
	sum+=Abs(a[n]);
	for(int i=1;i<=n;++i) 
	{
		sum-=Abs(a[i]-a[i-1]);
		sum-=Abs(a[i]-a[i+1]);
		sum+=Abs(a[i+1]-a[i-1]);
		printf("%d\n",sum);
		sum+=Abs(a[i]-a[i-1]);
		sum+=Abs(a[i]-a[i+1]);
		sum-=Abs(a[i+1]-a[i-1]);
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:38: error: expected ';' before '}' token
   12 |                 sum+=Abs(a[i]-a[i-1])
      |                                      ^
      |                                      ;
   13 | 
   14 |         }
      |         ~
Language: C

#include<bits/stdc++.h>
using namespace std;
int a,b,x,y,b2[110][110];
int main()
{ 
	scanf("%d%d",&a,&b); 
	a--;
	b--;
	for(int i=1;i<=50+1;i++)
	{
		for(int j=1;j<=100+1;j++)
		{
			b2[i][j]=1;
		}
	}
	x=1;
	y=1;
    while(a!=0)
    {
        b2[x][y]=0;       
        a--;       
     	y+=2;
       	if(y>=100)
        {
            x+=2;
            y=0;
        }
    }    
    x=100;
	y=1;    
	while(b!=0)
	{
        b2[x][y]=1;
        y+=2;        
        b--;
        if(y>=100)
        {
            x-=2;
            y=0;
        }
    }
    cout<<100<<' '<<100<<endl;
    for(int i=1;i<=100;i++)
    {
        for(int j=1;j<=100;j++)
        {
        	if(b2[i][j]) 
			{
				cout<<"#";
			}
            else 
			{
				cout<<".";
			}
        }
        cout<<endl;
    }
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  int a,b;
  cin >> a >> b;
  cout << 100 << " " << 100 << endl;
  int ans[100][100];
  rep(i,50)rep(j,100)ans[i][j]=0;
  rep(i,50)rep(j,100)ans[50+i][j]=1;
  int h=0;
  w=0;
  while(a-1!=0){
    a--;
    ans[h][w]=1;
    if(w+2<100)w+=2;
    else h+=2;
  }
  int h=60;
  w=0;
  while(b-1!=0){
    b--;
    ans[h][w]=0;
    if(w+2<100)w+=2;
    else h+=2;
  }
  rep(i,100){
    rep(j,100){
      if(ans[i][j]==1)cout << '.';
      else cout << '#';
    }
    cout << endl;
  }
}   


Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'w' was not declared in this scope
   18 |   w=0;
      |   ^
a.cc:25:7: error: redeclaration of 'int h'
   25 |   int h=60;
      |       ^
a.cc:17:7: note: 'int h' previously declared here
   17 |   int h=0;
      |       ^