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

#pragma GCC target("avx")
#pragma GCC optimize ("Ofast")
#include <iostream>
#include <cmath>
 
inline void fastscan(int &num) {
    bool neg = false;
    int c;
    num = 0;
    c = getchar_unlocked();
    if (c == '-') {
        neg = true;
        c = getchar_unlocked();
    }
    for (; (c > 47 && c < 58); c = getchar_unlocked()) num = (num<<3) + (num<<1) + c - 48;
    if (neg) num *= -1;
}

void fastout(int &n) {
    int N = n, rev, count = 0;
    rev = N;
    if (N == 0) { putchar_unlocked('0'); putchar_unlocked('\n'); return ;}
    while ((rev % 10) == 0) { ++count; rev /= 10;}
    rev = 0;
    while (N != 0) { rev = (rev<<3) + (rev<<1) + N % 10; N /= 10;}
    while (rev != 0) { putchar_unlocked(rev % 10 + '0'); rev /= 10;}
    while (count--) putchar_unlocked('0');
}
 
int main(){
    
    int N; fastscan(N);
    int v[N];
    for (int i = 0; i < N; ++i) fastscan(v[i]);
    int sum = 0;
 
    for (int i = 1; i < N; ++i) sum += abs(v[i - 1] - v[i]);
    sum += abs(0 - v[0]) + abs(v[N - 1]);
    int diff[N]; 
    diff[0] = abs(0 - v[0]) + abs(v[0] - v[1]) - abs(0 - v[1]);
    for (int i = 1; i < N - 1; ++i){
        diff[i] = abs(v[i - 1] - v[i]) + abs(v[i] - v[i + 1]) - abs(v[i - 1] - v[i + 1]);
    }
    diff[N - 1] = abs(v[N - 2] - v[N - 1]) + abs(v[N - 1]) - abs(v[N - 2]);
 
    for (int i = 0; i < N; ++i){
        fastout(sum - diff[i]); putchar_unlocked('\n');
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:21: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   47 |         fastout(sum - diff[i]); putchar_unlocked('\n');
      |                 ~~~~^~~~~~~~~
a.cc:19:19: note:   initializing argument 1 of 'void fastout(int&)'
   19 | void fastout(int &n) {
      |              ~~~~~^
Language: Java

import java.util.Scanner;

public class C92 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[] A = new int[N + 2];
		A[0] = 0;
		A[N + 1] = 0;
		
		for(int i = 1; i <= N; i++) {
			A[i] = sc.nextInt();
		}
		
		int[] d = new int[N + 2];
		int D = 0;
		
		for(int i = 1; i <= N + 1; i++) {
			d[i] = A[i] - A[i - 1];
			D += Math.abs(d[i]);
		}
		
		int money = 0;
		
		for(int i = 1; i <= N; i++) {
			money = D - Math.abs(d[i]) - Math.abs(d[i + 1]) + Math.abs(d[i] + d[i + 1]);
			System.out.println(money);
		}
		
	}
}


Compiler output:
Main.java:3: error: class C92 is public, should be declared in a file named C92.java
public class C92 {
       ^
1 error
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#define rep(i,N) for(ll i=0;i<N;i++)
typedef long long int ll;
using namespace std;
using vl=vector<ll>;

int main(){
    ll N,ans;
    cin>>N;
    vl A(N+2);
    A[0]=0;
    A[N+1]=0;
    rep(i,N){
        cin>>A[i+1];
    }
    
    vl def(N+1);
    rep(i,N+1){
        def[i]=abs(A[i+1]-A[i]);
    }
    
    ll sum=accumulate(def.begin(),def.end(),0);
    
    rep(i,N){
        cout<<sum-def[i]-def[i+1]+abs(A[i+2]-A[i]);<<endl;
    }
    
    
    return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:52: error: expected primary-expression before '<<' token
   29 |         cout<<sum-def[i]-def[i+1]+abs(A[i+2]-A[i]);<<endl;
      |                                                    ^~
Language: C++

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <locale>
#include<set>



using namespace std;

#define MAX 200000
int main() {

    int n,i,j,k,nedan,temp,aa1,aa2;
    bool flg1,flg2;
    cin>>n;
    vector<int> a(n);


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

        nedan=0;
        for(i=0;i<n-1;i++){
            nedan+=abs(a[i+1]-a[i]);
        }
        nedan+=abs(a[n-1])+abs(a[0]);

    for(i=0;i<n;i++){
        flg1=false;flg2=false;
        aa1 = a[i - 1];
        aa2 = a[i + 1];
        if(i==0)aa1=0;
        else if(i==n-1)aa2=0;

            if(aa1>a[i]&&aa2>a[i])flg1=true;//戻り
            else if(aa1<a[i]&&aa2<a[i])flg2=true;//行き過ぎ

        if(flg1){
            cout << nedan- abs(aa1-a[i]) -abs(aa2-a[i])+abs(aa2-aa1) << endl;
        }
        else if(flg2){
            cout << nedan -abs(a[i]-aa1) -abs(a[i]-aa2)+abs(aa2-aa1) << endl;
        }else{
            cout  << nedan << endl;
        }
    }




//    std::cout << ans << std::endl;
    return 0;
}
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <locale>
#include<set>



using namespace std;

#define MAX 200000
int main() {

    int n,i,j,k,nedan,temp,aa1,aa2;
    bool flg1,flg2;
    cin>>n;
    vector<int> a(n);


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

        nedan=0;
        for(i=0;i<n-1;i++){
            nedan+=abs(a[i+1]-a[i]);
        }
        nedan+=abs(a[n-1])+abs(a[0]);

    for(i=0;i<n;i++){
        flg1=false;flg2=false;
        aa1 = a[i - 1];
        aa2 = a[i + 1];
        if(i==0)aa1=0;
        else if(i==n-1)aa2=0;

            if(aa1>a[i]&&aa2>a[i])flg1=true;//戻り
            else if(aa1<a[i]&&aa2<a[i])flg2=true;//行き過ぎ

        if(flg1){
            cout << nedan- abs(aa1-a[i]) -abs(aa2-a[i])+abs(aa2-aa1) << endl;
        }
        else if(flg2){
            cout << nedan -abs(a[i]-aa1) -abs(a[i]-aa2)+abs(aa2-aa1) << endl;
        }else{
            cout  << nedan << endl;
        }
    }




//    std::cout << ans << std::endl;
    return 0;
}


Compiler output:
a.cc:71:5: error: redefinition of 'int main()'
   71 | int main() {
      |     ^~~~
a.cc:14:5: note: 'int main()' previously defined here
   14 | int main() {
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int>data(N + 1,0), datasub.at(N);
  for (int i = 0; i < N; i++) {
    cin >> data.at(i);
    datasub.at(i) = data.at(i);
  }
  for (int i = 0; i < N; i++) {
    if(datasub.at(i) == data.at(0)) {
      cout << 2 * abs(data.at(N) - data.at(1)) << endl;
    } else if (datasub.at(i) == data.at(N)) {
      cout << 2 * abs(data.at(N - 1) - data.at(0)) << endl;
    } else {
      cout << 2 * abs(data.at(N) - data.at(0)) << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:36: error: expected initializer before '.' token
    6 |   vector<int>data(N + 1,0), datasub.at(N);
      |                                    ^
a.cc:9:5: error: 'datasub' was not declared in this scope; did you mean 'data'?
    9 |     datasub.at(i) = data.at(i);
      |     ^~~~~~~
      |     data
a.cc:12:8: error: 'datasub' was not declared in this scope; did you mean 'data'?
   12 |     if(datasub.at(i) == data.at(0)) {
      |        ^~~~~~~
      |        data
Language: C++

#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}




int main(){
  int N;
  cin>>N;
  int A[N+2];
  A[0]=0
  for(int i=1;i<N+1;i++){
    cin>>A[i];
  }
  A[N+1]=0;
  int sum=0;
  for(int i=0;i<N+2;i++){
    sum+=abs(A[i]-A[i+1]);
  }
  for(int i=1;i<N+1;i++){
    cout<<sum+abs(A[i-1]-A[i+1])-abs(A[i-1]-A[i])-abs(A[i]-A[i+1])<<endl;
  }
  


}


  
  



Compiler output:
a.cc: In function 'int main()':
a.cc:121:9: error: expected ';' before 'for'
  121 |   A[0]=0
      |         ^
      |         ;
  122 |   for(int i=1;i<N+1;i++){
      |   ~~~    
a.cc:122:15: error: 'i' was not declared in this scope
  122 |   for(int i=1;i<N+1;i++){
      |               ^
Language: C++

#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        int s[100005];
        for(int i=0;i<n;i++)
        {
            scanf("%d",&s[i]);
        }
        int sum=0;
        for(int i=0;i<n;i++)
        {
            if(i==0)
                sum=abs(s[i]);
            else
                sum=sum+abs(s[i]-s[i-1]);
        }
        sum=sum+abs(s[n-1]);

        for(int i=0;i<n;i++)
        {
            int c=sum;
            if(i==0)
                c=c-abs(s[i])-abs(s[i+1]-s[i])+abs(s[i+1]);
            else if(i==n-1)
                c=c-abs(s[i])-abs(s[i]-s[i-1])+abs(s[i-1]);
            else
                c=c-abs(s[i]-s[i-1])-abs(s[i]-s[i+1])+abs(s[i-1]-s[i+1]);
            printf("%d\n",c);
        }

    }
    return 0;
}


#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        int s[100005];
        for(int i=0;i<n;i++)
        {
            scanf("%d",&s[i]);
        }
        int sum=0;
        for(int i=0;i<n;i++)
        {
            if(i==0)
                sum=abs(s[i]);
            else
                sum=sum+abs(s[i]-s[i-1]);
        }
        sum=sum+abs(s[n-1]);

        for(int i=0;i<n;i++)
        {
            int c=sum;
            if(i==0)
                c=c-abs(s[i])-abs(s[i+1]-s[i])+abs(s[i+1]);
            else if(i==n-1)
                c=c-abs(s[i])-abs(s[i]-s[i-1])+abs(s[i-1]);
            else
                c=c-abs(s[i]-s[i-1])-abs(s[i]-s[i+1])+abs(s[i-1]-s[i+1]);
            printf("%d\n",c);
        }

    }
    return 0;
}




Compiler output:
a.cc:50:5: error: redefinition of 'int main()'
   50 | int main()
      |     ^~~~
a.cc:7:5: note: 'int main()' previously defined here
    7 | int main()
      |     ^~~~
Language: Java

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int points = sc.nextInt();

		List<Integer> list = new ArrayList<>();
		list.add(0);

		for (int i = 0; i < points; i++) {
			list.add(sc.nextInt());
		}
		sc.close();
		list.add(0);

		List<Integer> tempList = new ArrayList<>(list);

		for (int i = 1; i < list.size() - 1; i++) {

			int temp = tempList.get(i);
			tempList.remove(i);
			System.out.println(calc(tempList));
			tempList.add(i, temp);
		}
	}

	private static int calc(List<Integer> list) {

		int temp = 0;
		for (int i = 0; i < list.size() - 1; i++) {
			temp += Math.abs(list.get(i + 1) - list.get(i));
		}

		return temp;
	}


Compiler output:
Main.java:40: error: reached end of file while parsing
	}
	 ^
1 error
Language: C

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

int main(void){
  long N,ans,sum = 0;
  scanf("%ld",&N);
  int A[N];

  for(int i = 0;i < N;i++){
    scanf("%d",&A[i]);
    if(i == 0){
      sum += abs(A[i]);
    }else{
      sum += abs(A[i]-A[i-1]);
    }
  }
  sum += abs(A[N-1]);

  if(i == 2){
    printf("%ld\n",A[1]*2);
    printf("%ld\n",A[0]*2);
    return 0;
  }
  for(int i = 0;i < N;i++){
    ans = sum;
    if(i == 0){
      ans += abs(A[1]) - abs(A[1]-A[0])-abs(A[0]);
    }else if(i == N-1){
      ans += abs(A[N-2]) - abs(A[N-1]-A[N-2])-abs(A[N-1]);
    }else{
      if(A[i-1] <= A[i] && A[i] <= A[i+1]){
      }else if(A[i+1] <= A[i] && A[i] <= A[i-1]){
      }else{
        ans += abs(A[i+1]-A[i-1]) - abs(A[i+1]-A[i])-abs(A[i]-A[i-1]);
      }
    }
    printf("%ld\n",ans);
  }

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:6: error: 'i' undeclared (first use in this function)
   19 |   if(i == 2){
      |      ^
main.c:19:6: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using lli = long long int;
ll MM = 1000000000;
ll mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)

int main(){
    ll n; cin >> n;
    ll a[100001];
    ll len = 0;
    ll ans[n];
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        ans[i] = 0;
    }
    a[n] = 0;
    for(ll i = 1; i < n+1; i++){
        len += abs(a[i-1] - a[i]);
    }
    ans = len;
    for(ll i = 1; i < n+1; i++){
        ans += abs(a[i-1] - a[i+1]);
        ans -= abs(a[i-1] - a[i]) + abs(a[i] - a[i+1]);
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: incompatible types in assignment of 'll' {aka 'long long int'} to 'll [n]' {aka 'long long int [n]'}
   23 |     ans = len;
      |     ~~~~^~~~~
a.cc:25:13: error: incompatible types in assignment of 'long long int' to 'll [n]' {aka 'long long int [n]'}
   25 |         ans += abs(a[i-1] - a[i+1]);
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:26:13: error: incompatible types in assignment of 'long long int' to 'll [n]' {aka 'long long int [n]'}
   26 |         ans -= abs(a[i-1] - a[i]) + abs(a[i] - a[i+1]);
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using lli = long long int;
ll MM = 1000000000;
ll mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)

int main(){
    ll n; cin >> n;
    ll a[100001];
    ll len = 0;
    ll ans[n] = {0};
    for(ll i = 0; i < n; i++){
        cin >> a[i];
    }
    a[n] = 0;
    for(ll i = 1; i < n+1; i++){
        len += abs(a[i-1] - a[i]);
    }
    ans = len;
    for(ll i = 1; i < n+1; i++){
        ans += abs(a[i-1] - a[i+1]);
        ans -= abs(a[i-1] - a[i]) + abs(a[i] - a[i+1]);
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: incompatible types in assignment of 'll' {aka 'long long int'} to 'll [n]' {aka 'long long int [n]'}
   22 |     ans = len;
      |     ~~~~^~~~~
a.cc:24:13: error: incompatible types in assignment of 'long long int' to 'll [n]' {aka 'long long int [n]'}
   24 |         ans += abs(a[i-1] - a[i+1]);
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:25:13: error: incompatible types in assignment of 'long long int' to 'll [n]' {aka 'long long int [n]'}
   25 |         ans -= abs(a[i-1] - a[i]) + abs(a[i] - a[i+1]);
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
	int a;
	cin >> a;
	int ans;
	int b[a+1];
	int c[a+1];
	for (int i = 0;i < a;i++) {
		cin >> b[i];
		c[i] = b[i];
	}
	c[a] = 0;
	sort(c,c+a+1);
	for (int i = 0;i < a+1;i++) {
		if (b[i] == c[0]) {
			ans = (c[a]-c[1])*2;
		} else if (b[i] == c[a]) {
			ans = (c[a-1]-c[0])*2;
		} else {
			ans = (c[a]-c[0])*2;
		}
		cout << ans << endl;
	}
}

Compiler output:
a.cc:1:10: fatal error: bits/stdc++: No such file or directory
    1 | #include <bits/stdc++>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<cstdio>
#include<cstdlib>
using namespace std;

int main(){
  int n, i, a[100005], sum = 0;
  scanf("%d",&n);
  a[0] = a[n+1] = 0;
  for(i = 1; i <= n; i++){
    scanf("%d",&a[i]);
    sum += abs.(a[i-1]-a[i]);
  }
  sum += abs.(a[n]-a[n+1]);
  for(i = 1; i <= n; i++)
    printf("%d\n",sum - abs.(a[i-1]-a[i]) - abs.(a[i]-a[i+1]) + abs.(a[i-1]-a[i+1]));
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: expected unqualified-id before '(' token
   11 |     sum += abs.(a[i-1]-a[i]);
      |                ^
a.cc:13:14: error: expected unqualified-id before '(' token
   13 |   sum += abs.(a[n]-a[n+1]);
      |              ^
a.cc:15:29: error: expected unqualified-id before '(' token
   15 |     printf("%d\n",sum - abs.(a[i-1]-a[i]) - abs.(a[i]-a[i+1]) + abs.(a[i-1]-a[i+1]));
      |                             ^
a.cc:15:49: error: expected unqualified-id before '(' token
   15 |     printf("%d\n",sum - abs.(a[i-1]-a[i]) - abs.(a[i]-a[i+1]) + abs.(a[i-1]-a[i+1]));
      |                                                 ^
a.cc:15:69: error: expected unqualified-id before '(' token
   15 |     printf("%d\n",sum - abs.(a[i-1]-a[i]) - abs.(a[i]-a[i+1]) + abs.(a[i-1]-a[i+1]));
      |                                                                     ^
Language: C++

#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstring>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;
int main() {
	ll N;
  	cin>>N;
	ll a[10010];
	for (ll i = 1; i <=N; i++) {
		cin >> a[i];
	}
  	ll sum=0;
  	a[0] = 0;
	a[N+1] = 0;
  	for(ll i=0; i<=N; i++){
      sum+=abs(a[i+1]-a[i]);
    }
	for (ll i = 1; i <=N; i++) {
      	ll x=sum;
		x += abs(a[i - 1] - a[i + 1]);
		x -= abs(a[i-1] - a[i]);
		x 　-= abs(a[i] - a[i + 1]);
		cout << x << endl;
	}


}








Compiler output:
a.cc:34:19: error: extended character 　 is not valid in an identifier
   34 |                 x 　-= abs(a[i] - a[i + 1]);
      |                   ^
a.cc: In function 'int main()':
a.cc:34:18: error: expected ';' before '\U00003000'
   34 |                 x 　-= abs(a[i] - a[i + 1]);
      |                  ^~~
      |                  ;
Language: C++

#include <cstdio>
#include <numeric>
using namespace std;

int main(){
    int N;
    scanf("%d",&N);
    int A[N+2];
    long long int s=0;
    A[0]=0;A[N+1]=0;
    for(int i=1;i<N+1;i++){scanf("%d",A+i);}
    for(int i=0;i<N+1;i++){
        s+=abs(A[i+1]-A[i]);
    }
    for(int i=1;i<N+1;i++){
        printf("%lld\n",s+abs(A[i-1]-A[i+1])-(abs(A[i-1]-A[i])+abs(A[i]-A[i+1])));
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: error: 'abs' was not declared in this scope
   13 |         s+=abs(A[i+1]-A[i]);
      |            ^~~
a.cc:16:27: error: 'abs' was not declared in this scope
   16 |         printf("%lld\n",s+abs(A[i-1]-A[i+1])-(abs(A[i-1]-A[i])+abs(A[i]-A[i+1])));
      |                           ^~~
Language: C++

#include <stdio.h>
 
int main(void)
{
  int N;
  int A[100002];
  scanf("%d",&N);
  int n,sum=0;
  for(n=1;n<=N;n++){
  	scanf("%d",&A[n]);
  	if(n>0){
  		sum+=abs(A[n]-A[n-1]);
  	}
  }
  A[0]=0;
  A[N+1]=0;
  sum+=abs(A[N]);
  
  
  
  for(n=0;n<N;n++){
  	if(A[n+1]-A[n]>0){
  		if(A[n+2]-A[n+1]<0){
  			int k;
  			if(A[n+2]-A[n]>0){
  				 k=sum-abs(A[n+1]-A[n])-abs(A[n+2]-A[n+1])+abs(A[n+2]-A[n]);
  			}else{
  				k=sum-2*abs(A[n+1]-A[n]);
  			}
  			printf("%d\n",k);
  		}else{
  			printf("%d\n",sum);
  		}
  	}else{
  		if(A[n+2]-A[n+1]<0){
  			printf("%d\n",sum);
  		}else{
  			int k;
  			if(A[n+2]-A[n]<0){
  				 k=sum-abs(A[n+1]-A[n])-abs(A[n+2]-A[n+1])+abs(A[n+2]-A[n]);
  			}else{
  				k=sum-2*abs(A[n+1]-A[n]);
  			}
  			printf("%d\n",k);
  		}
  	}
  }
  
   
  
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:22: error: 'abs' was not declared in this scope
   12 |                 sum+=abs(A[n]-A[n-1]);
      |                      ^~~
a.cc:17:8: error: 'abs' was not declared in this scope
   17 |   sum+=abs(A[N]);
      |        ^~~
Language: C++

#include <iostream>
using namespace std;

int main() {
	int n,a[10000],ans;
	cin >> n;
	for(int i=0; i!=n; i++){
		cin >> a[i];
		a[i] = abs(a[i]);
	}
	int m = 0;
	for(int i=0; i!=n; i++){
		for(int j=0; j!=n; j++){
			if(m == i){
				countinue;
			}
			ans = ans + abs(a[i-1] - a[i]);
		}
		cout << ans<< '\n';
		ans = 0;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:33: error: 'countinue' was not declared in this scope
   15 |                                 countinue;
      |                                 ^~~~~~~~~
Language: C++

#include<string>
#include<algorithm>
#include<set>
#include<climits>
#include <cstdlib>

using namespace std;
int main(){
  int n;
  int a[10010] = {0};

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

  int all_price=0;
  for(int i=0; i <= n+1; i++){
    all_price += abs(a[i] - a[i+1]);
  }

  for(int i=1; i <= n; i++){
    int diff_price = all_price + abs(a[i+1]+a[i-1]) - (abs(a[i-1]-a[i])+abs(a[i]-a[i+1]));
    cout << diff_price << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'cin' was not declared in this scope
   12 |   cin >> n;
      |   ^~~
a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #include <cstdlib>
  +++ |+#include <iostream>
    6 | 
a.cc:23:5: error: 'cout' was not declared in this scope
   23 |     cout << diff_price << endl;
      |     ^~~~
a.cc:23:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:27: error: 'endl' was not declared in this scope
   23 |     cout << diff_price << endl;
      |                           ^~~~
a.cc:6:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    5 | #include <cstdlib>
  +++ |+#include <ostream>
    6 |
Language: C++

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int s,x1.x2,x3,N,a[10000],i,sum=0;;
	cin>>N;
	a[0]=0;a[N]=0;
	for(i=1;i<=N;i++)
	{
		cin>>a[i];
	}
	for(i=0;i<=N+1;i++)
	{
		sum+=abs(a[i+1]-a[i]);
	}
	for(i=1;i<=N;i++)
	{
			x1=abs(a[i]-a[i-1]);
			x2=abs(a[i+1]-a[i]);
			x3=abs(a[i+1]-a[i-1]);
		s=sum-x1-x2+x3;
		cout<<s<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: expected initializer before '.' token
    6 |         int s,x1.x2,x3,N,a[10000],i,sum=0;;
      |                 ^
a.cc:7:14: error: 'N' was not declared in this scope
    7 |         cin>>N;
      |              ^
a.cc:8:9: error: 'a' was not declared in this scope
    8 |         a[0]=0;a[N]=0;
      |         ^
a.cc:9:13: error: 'i' was not declared in this scope
    9 |         for(i=1;i<=N;i++)
      |             ^
a.cc:13:13: error: 'i' was not declared in this scope
   13 |         for(i=0;i<=N+1;i++)
      |             ^
a.cc:15:17: error: 'sum' was not declared in this scope
   15 |                 sum+=abs(a[i+1]-a[i]);
      |                 ^~~
a.cc:17:13: error: 'i' was not declared in this scope
   17 |         for(i=1;i<=N;i++)
      |             ^
a.cc:19:25: error: 'x1' was not declared in this scope; did you mean 'y1'?
   19 |                         x1=abs(a[i]-a[i-1]);
      |                         ^~
      |                         y1
a.cc:20:25: error: 'x2' was not declared in this scope
   20 |                         x2=abs(a[i+1]-a[i]);
      |                         ^~
a.cc:21:25: error: 'x3' was not declared in this scope
   21 |                         x3=abs(a[i+1]-a[i-1]);
      |                         ^~
a.cc:22:19: error: 'sum' was not declared in this scope
   22 |                 s=sum-x1-x2+x3;
      |                   ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

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

  for(int i=1;i<N+1;i++){
    if(((A[i-1]<=A[i]) && (A[i]<=A[i+1])) || ((A[i-1]>=A[i]) && (A[i]>=A[i+1]))){
      cout << sum << endl;
    }else if(abs(A[i+1]-A[i])>abs(A[i]-A[i-1]){
      cout << sum-2*(abs(A[i-1]-A[i])) << endl;
    }else{
      cout << sum-2*(abs(A[i]-A[i+1])) << endl;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:47: error: expected ')' before '{' token
   21 |     }else if(abs(A[i+1]-A[i])>abs(A[i]-A[i-1]){
      |             ~                                 ^
      |                                               )
a.cc:26:3: error: expected primary-expression before '}' token
   26 |   }
      |   ^
Language: C++

        #include<stdio.h>
        #include<stdlib.h>
        int a[100001],b[100000];
         
            int main(void)
            {
               int i,n,s;
               int ans[100000];
               scanf("%d",&n);
             
               for(i=1;i<=n;i++)
                  scanf("%d",&a[i]);
              
               a[0]=0;
               a[n+1]=0

               for(i=0;i<=n;i++)
               s+=abs(a[i+1]-a[i]);
               for(i=0;i<=n;i++)
               b[i]=abs(a[i+1]-a[i]);
             
               for(i=1;i<=n;i++)
             
               ans[i]=s-b[i-1]-b[i]+abs(a[i+1]-a[i-1]);
             
               for(i=1;i<=n;i++)
                  printf("%d\n",ans[i]);
             
               return 0;
            }

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: expected ';' before 'for'
   15 |                a[n+1]=0
      |                        ^
      |                        ;
   16 | 
   17 |                for(i=0;i<=n;i++)
      |                ~~~      
a.cc:17:32: error: expected ';' before ')' token
   17 |                for(i=0;i<=n;i++)
      |                                ^
      |                                ;
Language: C++

        #include<stdio.h>
        #include<stdlib.h>
        int a[100000001]={},b[100000000];
         
            int main(void)
            {
               int i,n;
         
               int sum;
               scanf("%d",&n);
             
               for(i=1;i<=n;i++)
                  scanf("%d",&a[i]);
             
               for(i=0;i<=n;i++)
              sum=abs(a[i+1]-a[i]);
               for(i=0;i<=n;i++)
               b[i]=abs(a[i+1]-a[i]);
             
               for(i=1;i<=n;i++)
             
               ans[i]=sum-b[i-1]-b[i]+abs(a[i+1]-a[i-1]);
             
               for(i=1;i<=n;i++)
                  printf("%d\n",ans[i]);
             
               return 0;
            }

Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |                ans[i]=sum-b[i-1]-b[i]+abs(a[i+1]-a[i-1]);
      |                ^~~
      |                abs
a.cc:25:33: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |                   printf("%d\n",ans[i]);
      |                                 ^~~
      |                                 abs
Language: C++

    #include<stdio.h>
    #include<stdlib.h>
     
    int a[10001]={}
    int main(void)
    {
       int i,p,n,tmp;
      
       scanf("%d",&n);
       
       for(i=1;i<=n;i++)
          scanf("%d",&a[i]);
     
       for(i=0;i<=n;i++)
       tmp+=abs(a[i+1]-a[i]);
       
       for(i=1;i<=n;i++)
       printf("%d\n",tmp-abs(a[i+1]-a[i])-abs(a[i-1]-a[i])+abs(a[i+1]-a[i-1]));
     
     
       return 0;
    }

Compiler output:
a.cc:5:5: error: expected ',' or ';' before 'int'
    5 |     int main(void)
      |     ^~~
Language: C++

int main(void)
{
   int i,n;
   int a[10001]={},b[10000];
   int ans[10000]={};
   scanf("%d",&n);

   for(i=1;i<=n;i++)
      scanf("%d",&a[i]);

   for(i=0;i<=n;i++)
   ans[0]+=abs(a[i+1]-a[i]);
   for(i=0;i<=n;i++)
   b[i]=abs(a[i+1]-a[i]);

   for(i=1;i<=n;i++)

   ans[i]=ans[0]-b[i-1]-b[i]+abs(a[i+1]-a[i-1]);

   for(i=1;i<=n;i++)
      printf("%d\n",ans[i]);

   return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:4: error: 'scanf' was not declared in this scope
    6 |    scanf("%d",&n);
      |    ^~~~~
a.cc:12:12: error: 'abs' was not declared in this scope; did you mean 'ans'?
   12 |    ans[0]+=abs(a[i+1]-a[i]);
      |            ^~~
      |            ans
a.cc:14:9: error: 'abs' was not declared in this scope; did you mean 'ans'?
   14 |    b[i]=abs(a[i+1]-a[i]);
      |         ^~~
      |         ans
a.cc:18:30: error: 'abs' was not declared in this scope; did you mean 'ans'?
   18 |    ans[i]=ans[0]-b[i-1]-b[i]+abs(a[i+1]-a[i-1]);
      |                              ^~~
      |                              ans
a.cc:21:7: error: 'printf' was not declared in this scope
   21 |       printf("%d\n",ans[i]);
      |       ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void)
Language: C

#include<stdio.h>
#include<stdlib.h>
int main(void)
{
   int n,i,a[100000],sum=0,tmp;
   scanf("%d",&n);
   a[0]=0;
   a[n+1]=0;
   for(i=1;i<=n;i++){
      scanf("%d",&a[i]);
      sum+=abs(a[i]-a[i-1]);
   }
   sum+=abs(a[n]-0);
   for(i=1;i<=n;i++){
      if(a[i]<=0 && (a[i]<a[i-1] || a[i-1]>0) && a[i]<a[i+1])
         printf("%d\n",sum-abs(a[i]-a[i-1])*2);
      else if(a[i]>=0 && (a[i]>a[i-1] || a[i-1]<0) && a[i]>a[i+1])
         printf("%d\n",sum-abs(a[i]-a[i-1])*2);
      else
         printf("%d\n",sum);
   }

Compiler output:
main.c: In function 'main':
main.c:21:4: error: expected declaration or statement at end of input
   21 |    }
      |    ^
Language: C++

#include <iostream>
#include <cstdlib>
using namespace std;
int main(){
int i,N,sum,k,s;
int A[200000];
cin >> N;
sum=0;
A[0]=0;
for(i=1;i<=N;i++){
cin >> A[i];
}
A[N+1]=0;
for(i=0;i<=N;i++){
	sum += abs(A[i+1]-A[i]);
}
	s = sum;
for(k=1;k<=N;k++){
	if(A[k-1]<=A[k] && A[k]<=A[k+1]){
		cout << sum << endl;}
	else if(A[k+1]<=A[k] && A[k]<=A[k-1]){
cout << sum <<endl;
}else{
sum -= 2*min(abs(A[k-1]-A[k]),abs(A[k]-A[k+1]));
cout << sum << endl;
sum = s;
}
}

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

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


int main(void)
{
   int i,a,b,j,n;
   int a[10001]={};
   int ans[10000]={};
   scanf("%d",&n);
   
   for(i=1;i<=n;i++)
      scanf("%d",&a[i]);

   a=n+1;
   for(i=1;i<=n;i++){
      b=i+1;
      for(j=1;j<=a;j++){
         if(j!=i){
            if (j==b) ans[i]+=abs(a[j]-a[j-2]);      
            else  ans[i]+=abs(a[j]-a[j-1]);}
}}

   for(i=1;i<=n;i++)
      printf("%d\n",ans[i]);

   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: conflicting declaration 'int a [10001]'
    8 |    int a[10001]={};
      |        ^
a.cc:7:10: note: previous declaration as 'int a'
    7 |    int i,a,b,j,n;
      |          ^
a.cc:13:20: error: invalid types 'int[int]' for array subscript
   13 |       scanf("%d",&a[i]);
      |                    ^
a.cc:20:36: error: invalid types 'int[int]' for array subscript
   20 |             if (j==b) ans[i]+=abs(a[j]-a[j-2]);
      |                                    ^
a.cc:20:41: error: invalid types 'int[int]' for array subscript
   20 |             if (j==b) ans[i]+=abs(a[j]-a[j-2]);
      |                                         ^
a.cc:21:32: error: invalid types 'int[int]' for array subscript
   21 |             else  ans[i]+=abs(a[j]-a[j-1]);}
      |                                ^
a.cc:21:37: error: invalid types 'int[int]' for array subscript
   21 |             else  ans[i]+=abs(a[j]-a[j-1]);}
      |                                     ^
Language: C

int main(void)
{
   int n, i, j, s;
   int a[N_MAX];
   int from, to, mon;
   mon = from = to = 0;

   printf("N : ");
   if(scanf("%d",&n) < 1){
      printf("error:ill-formed fraction.\n");
      return 1;                                                      
   }

   for(i=0;i<n;i++){
      printf("A%d : ",i+1);

      if(scanf("%d",&a[i]) < n){
      printf("error:ill-formed fraction.\n");
      return 1;
      }
   }

   printf("\n");

   for(i=0;i<n;i++){
      for(j=0;j<n;j++){
         if(i != j){
            to = a[j];
            s = from - to;
            mon += abs(s);
            from = to;
         }
      }
      s = from - 0;
      mon += abs(s);
      printf("%d\n",mon);
      mon = from = to = 0;
   }

   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:10: error: 'N_MAX' undeclared (first use in this function)
    4 |    int a[N_MAX];
      |          ^~~~~
main.c:4:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:4: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    8 |    printf("N : ");
      |    ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | int main(void)
main.c:8:4: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    8 |    printf("N : ");
      |    ^~~~~~
main.c:8:4: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:9:7: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    9 |    if(scanf("%d",&n) < 1){
      |       ^~~~~
main.c:9:7: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:9:7: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:9:7: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:17:10: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   17 |       if(scanf("%d",&a[i]) < n){
      |          ^~~~~
main.c:17:10: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:30:20: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   30 |             mon += abs(s);
      |                    ^~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
  +++ |+#include <stdlib.h>
    1 | int main(void)
Language: C++

int main(void)
{
   int i,j,n;
   int a[10001]={};
   int ans[10000]={};
   scanf("%d",&n);

   for(i=1;i<=n;i++)
      scanf("%d",&a[i]);


   for(i=1;i<=n;i++)
      for(j=1;j<=(n+1);j++){
         if(j==i);
         else if (j==(i+1)) ans[i]+=abs(a[j]-a[j-2]);  
         else  ans[i]+=abs(a[j]-a[j-1]);
}

   for(i=1;i<=n;i++)
      printf("%d\n",ans[i]);

   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:4: error: 'scanf' was not declared in this scope
    6 |    scanf("%d",&n);
      |    ^~~~~
a.cc:15:37: error: 'abs' was not declared in this scope; did you mean 'ans'?
   15 |          else if (j==(i+1)) ans[i]+=abs(a[j]-a[j-2]);
      |                                     ^~~
      |                                     ans
a.cc:16:24: error: 'abs' was not declared in this scope; did you mean 'ans'?
   16 |          else  ans[i]+=abs(a[j]-a[j-1]);
      |                        ^~~
      |                        ans
a.cc:20:7: error: 'printf' was not declared in this scope
   20 |       printf("%d\n",ans[i]);
      |       ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void)
Language: C++

#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
	int n;
	cin >> n;
	int a[n];
	int b[n+1];
	
	rep(i,0,n){
		cin >> a[i];
		if(i == 0 )
			b[i] = abs(0-a[i]);
		else
			b[i] = abs(a[i-1] - a[i]);
	}
	b[n] = abs(a[n-1]);
	
	long sum = 0;
	rep(i,0,n+1)
		sum += b[i];
	
	rep(i,0,n){
		long ans;
		if(i == 0 )
			ans = sum - b[0] - b[1] + abs(a[1]);
/bin/bash: :x: コマンドが見つかりません
			ans = sum - b[i] - b[i+1] + abs(a[i-1]-a[i+1]);
		else
			ans = sum - b[i] - b[i+1] + abs(a[n-2]);
		P(ans);
	}	
	
	ret 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:1: error: expected primary-expression before '/' token
   56 | /bin/bash: :x: コマンドが見つかりません
      | ^
a.cc:56:2: error: 'bin' was not declared in this scope; did you mean 'sin'?
   56 | /bin/bash: :x: コマンドが見つかりません
      |  ^~~
      |  sin
a.cc:56:6: error: 'bash' was not declared in this scope
   56 | /bin/bash: :x: コマンドが見つかりません
      |      ^~~~
a.cc:58:17: error: 'else' without a previous 'if'
   58 |                 else
      |                 ^~~~
Language: C++

N = int(input())
A = list(map(int, input().split()))

A_before=0
full_price=0
for i in range (N):
    full_price=full_price+abs(A[i]-A_before)
    A_before=A[i]
full_price=full_price+abs(A[N-1])

total_price=0
#No.1
negative=abs(A[0]-0)+ abs(A[1]-A[0])-abs(A[1]-(0))
total_price=full_price-negative
print(total_price)

for j in range (1,N-1):
    negative=abs(A[j]-A[j-1])+ abs(A[j+1]-A[j])-abs(A[j+1]-(A[j-1]))
    total_price=full_price-negative
    print(total_price)
    
#No.Last
negative=abs(0-A[N-1])+ abs(A[N-1]-A[N-2])-abs(0-A[N-2]) 
total_price=full_price-negative
print(total_price)


Compiler output:
a.cc:12:2: error: invalid preprocessing directive #No
   12 | #No.1
      |  ^~
a.cc:22:2: error: invalid preprocessing directive #No
   22 | #No.Last
      |  ^~
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: C++

#include<bits/stdc++.h>
#include <afxres.h>//max / min macro
using namespace std;

using ll = long long int;
using ul = unsigned long long int;
using vi = vector<int>;

inline ll compute(vi ary,ll i,ll sum){
    ll ans = sum - abs(ary[i+2]-ary[i+1]) - abs(ary[i+1] - ary[i]) + abs(ary[i+2] - ary[i]);
    return ans;
}

int main(){
    ll x=1000,sum=0;
    cin>>x;
    vi ary(x+2);
    ary[0]=0;
    for(int i =0;i<x;i++){
        cin>>ary[i+1];
        sum += abs(ary[i+1]-ary[i]);
    }
    ary.push_back(0);
    sum += abs(ary[x]-0);
    //define
    for(int i=0;i<x;i++){
        cout<<compute(ary,i,sum)<<endl;
    }
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: afxres.h: No such file or directory
    2 | #include <afxres.h>//max / min macro
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdlib>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)

using namespace std;

int main() {
    // 入力
    const int MAX_N = 100000;
    int N; scanf("%d", &N);
    int A[MAX_N]; rep(i, N) scanf("%d", &A[i]);

    // 出力
    rep(i, N) {
        int a = 0, b = 0, sum = 0;

        rep(j, N) {
            a = b; if (i != j) b = A[j]; 
            sum += abs(b - a)
        }
        sum += abs(b);

        printf("%d\n", sum);
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: expected ';' before '}' token
   20 |             sum += abs(b - a)
      |                              ^
      |                              ;
   21 |         }
      |         ~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <string.h>
#include <math.h>
typedef long long ll;
#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MIN(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REP(i,x,y)	for (int (i)=(x);(i)<(y);(i)++)
#define REP_(i,x,y)	for ((i)=(x);(i)<(y);(i)++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;
typedef pair<int, int> Point;
typedef vector<vector<Point>> Graph;

#define P 100
#define Q (P/2)

int N,S,A[100002];


int main() {
	
	cin >> N;
	
	REP(i,0,N) cin >> A[i+1],S+=ABS(A[i+1] - A[i]);
	S+=ABS(A[N+1] - A[N]);
	
	REP(i,1,N+1) cout << S-( ABS(A[i-1],A[i]) + ABS(A[i],A[i+1]) - ABS(A[i-1],A[i+1]) ) << endl;

	return 0;
}


Compiler output:
a.cc:33:49: error: macro "ABS" passed 2 arguments, but takes just 1
   33 |         REP(i,1,N+1) cout << S-( ABS(A[i-1],A[i]) + ABS(A[i],A[i+1]) - ABS(A[i-1],A[i+1]) ) << endl;
      |                                                 ^
a.cc:11:9: note: macro "ABS" defined here
   11 | #define ABS(x)          (((x) < 0)? (-1*(x)) : (x))
      |         ^~~
a.cc:33:68: error: macro "ABS" passed 2 arguments, but takes just 1
   33 |         REP(i,1,N+1) cout << S-( ABS(A[i-1],A[i]) + ABS(A[i],A[i+1]) - ABS(A[i-1],A[i+1]) ) << endl;
      |                                                                    ^
a.cc:11:9: note: macro "ABS" defined here
   11 | #define ABS(x)          (((x) < 0)? (-1*(x)) : (x))
      |         ^~~
a.cc:33:89: error: macro "ABS" passed 2 arguments, but takes just 1
   33 |         REP(i,1,N+1) cout << S-( ABS(A[i-1],A[i]) + ABS(A[i],A[i+1]) - ABS(A[i-1],A[i+1]) ) << endl;
      |                                                                                         ^
a.cc:11:9: note: macro "ABS" defined here
   11 | #define ABS(x)          (((x) < 0)? (-1*(x)) : (x))
      |         ^~~
a.cc: In function 'int main()':
a.cc:33:34: error: 'ABS' was not declared in this scope
   33 |         REP(i,1,N+1) cout << S-( ABS(A[i-1],A[i]) + ABS(A[i],A[i+1]) - ABS(A[i-1],A[i+1]) ) << endl;
      |                                  ^~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N;
  cin >> N;
  int A[N+2];
  A[0] = 0;
  A[N+1] = 0;
  int sum = 0;
  int before = 0;
  for(int i=1;i<N+1;i++) cin >> A[i];
  for(int i=1;i<N+2;i++){
    S += abs(A[i]-A[i-1])
  }
  for(int i=1;i<N+1;i++){
    cout << S - (abs(A[i+1]-A[i])) - abs(A[i]-A[i-1]) + abs(A[i+1]-A[i-1]) << endl;
  }
  /*
  for(int i=0;i<N;i++){
  	sum = 0;
	  before = 0;
	  for(int j=0;j<N;j++){
	    if(i!=j){
	      sum += abs(A[j] - before);
	  	  before = A[j];
	    }
  	}
  	sum += abs(before);
  	cout << sum << endl;
  }
  */
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'S' was not declared in this scope
   14 |     S += abs(A[i]-A[i-1])
      |     ^
a.cc:17:13: error: 'S' was not declared in this scope
   17 |     cout << S - (abs(A[i+1]-A[i])) - abs(A[i]-A[i-1]) + abs(A[i+1]-A[i-1]) << endl;
      |             ^
Language: C

#define __STDC_WANT_LIB_EXT1__ 1
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>

int Solve1()
{
	int n, a[ 100002 ];
	scanf("%d", &n);
	a[ 0 ] = a[ n + 1 ] = 0;
	for(int iPlace = 1; iPlace <= n; ++iPlace) {
		scanf("%d", &a[ iPlace ]);
	}
	for(int iSkipPlace = 1; iSkipPlace <= n; ++iSkipPlace) {
		int cost = 0;
		for(int jNextPlace = 1, m = n + 1; jNextPlace <= m; ++jNextPlace) {

			if(jNextPlace == iSkipPlace)
				continue;
			else if(jNextPlace == iSkipPlace + 1)
				cost += abs(a[ jNextPlace ] - a[ jNextPlace - 2 ]);
			else
				cost += abs(a[ jNextPlace ] - a[ jNextPlace - 1 ]);
		}
		printf("%d\n", cost);
	}
	return 0;
}

int Solve2()
{
	int n, c[ 100002 ],a,x1=0,x2=0;
	scanf_s("%d", &n);
	c[ 0 ] = c[ n + 1 ] = 0;
	for(int iA = 1; iA <= n; ++iA) {
		scanf_s("%d", &a);
		for(int jC = 1; jC <= n; ++jC) {
			if(jC == iA) continue;
			else if(jC + 1 == iA) c[ jC ] += abs(a - x2);
			else c[ jC ] += abs(a - x1);
		}
		x2 = x1;
		x1 = a;
	}
	for(int jC = 1; jC <= n-1; ++jC) c[ jC ] += abs(a - x1);
	c[ n ] += abs(a - x2);
	for(int jC=1;jC<=n;++jC) printf("%d\n", c[ jC ]);
	return 0;
}

int main() {
	return Solve2();
}


Compiler output:
main.c: In function 'Solve1':
main.c:21:41: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   21 |                                 cost += abs(a[ jNextPlace ] - a[ jNextPlace - 2 ]);
      |                                         ^~~
main.c:5:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    4 | #include <math.h>
  +++ |+#include <stdlib.h>
    5 | 
main.c: In function 'Solve2':
main.c:33:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   33 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C

#include <stdio.h>
#include <math.h>

int Solve2()
{
	int n, c[ 100002 ],a,x1=0,x2=0;
	scanf_s("%d", &n);
	c[ 0 ] = c[ n + 1 ] = 0;
	for(int iA = 1; iA <= n; ++iA) {
		scanf_s("%d", &a);
		for(int jC = 1; jC <= n; ++jC) {
			if(jC == iA) continue;
			else if(jC + 1 == iA) c[ jC ] += abs(a - x2);
			else c[ jC ] += abs(a - x1);
		}
		x2 = x1;
		x1 = a;
	}
	for(int jC = 1; jC <= n-1; ++jC) c[ jC ] += abs(a - x1);
	c[ n ] += abs(a - x2);
	for(int jC=1;jC<=n;++jC) printf("%d\n", c[ jC ]);
	return 0;
}

int main() {
	return Solve2();
}


Compiler output:
main.c: In function 'Solve2':
main.c:7:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    7 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
main.c:13:58: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   13 |                         else if(jC + 1 == iA) c[ jC ] += abs(a - x2);
      |                                                          ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 |
Language: C++

#include<iostream>
#include<vector>
using namespace std;
vector<int> a;
int main()
{
	int n;
	scanf("%d",&n);
	a.resize(n + 2);
	a[0] = 0;
	a[n + 1] = 0;
	int total = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d",&a[i]);
		total +=fabs(a[i] - a[i - 1]);
	}
	total+= fabs(a[n] - a[0]);
	for (int i = 1; i <= n; i++)
	{
		int s = total -fabs(a[i]-a[i-1]) - fabs(a[i]-a[i + 1]) + fabs(a[i - 1] - a[i + 1]);
		printf("%d\n",s);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   16 |                 total +=fabs(a[i] - a[i - 1]);
      |                         ^~~~
      |                         labs
a.cc:18:17: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   18 |         total+= fabs(a[n] - a[0]);
      |                 ^~~~
      |                 labs
Language: C

#include <stdio.h>
int main(void){
    int N,i,j,G=0;
    scanf("%d",&N);
    int x[N+2];
    
    x[0] = 0;
    x[N+1] = 0;
    
    for(i=1;i<=N;i++){
        scanf("%d",&x[i]);
    }
    
    G = 0;
    for(i=1;i<N+1;i++){ //一旦抜かずに全行程での旅費計算
        G += abs(x[i] - x[i-1]); 
    }
    G += abs(i[N]);
    
    //それぞれ抜いた場合の旅費を計算
    int G_;
    G_ = G;
    for(i=1;i<N+1;i++){
        G_ -= abs(x[i] - x[i-1]);
        G_ -= abs(x[i+1] - x[i]);
        G_ += abs(x[i+1] - x[i-1]);
        printf("%d\n",G_);
        G_ = G;
    }
}

Compiler output:
main.c: In function 'main':
main.c:16:14: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   16 |         G += abs(x[i] - x[i-1]);
      |              ^~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | int main(void){
main.c:18:15: error: subscripted value is neither array nor pointer nor vector
   18 |     G += abs(i[N]);
      |               ^