Problem p03403 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#define ll long long
#define mx 800
#define max(x, y) ((x) > (y) ? (x) : (y))
#define min(x, y) ((x) < (y) ? (x) : (y))
#define fur(i, x, y) for (i = x; i <= y; i++)
#define fdr(i, x, y) for (i = x; i >= y; i--)
#define Fur(i, x, y) for (ll i = x; i <= y; i++)
#define Fdr(x, y) for (ll i = x; i >= y; i--)
#define in2(x, y)                                                              \
  in(x);                                                                       \
  in(y)
#define in3(x, y, z)                                                           \
  in2(x, y);                                                                   \
  in(z)
#define in4(a, b, c, d)                                                        \
  in2(a, b);                                                                   \
  in2(c, d)
#define clr(x, y) memset(x, y, sizeof(x))
using namespace std;
/*---------------------------------------*/
namespace fib {
char b[300000] = {}, *f = b;
}
#define gc                                                                     \
  ((*fib::f) ? (*(fib ::f++))                                                  \
             : (fgets(fib::b, sizeof(fib::b), stdin)                           \
                    ? (fib::f = fib::b, *(fib::f++))                           \
                    : -1))
inline void in(ll &x) {
  x = 0;
  char c;
  bool f = 0;
  while ((c = gc) > '9' || c < '0')
    if (c == '-')
      f = !f;
  x = c - 48;
  while ((c = gc) <= '9' && c >= '0')
    x = x * 10 + c - 48;
  if (f)
    x = -x;
}
namespace fob {
char b[300000] = {}, *f = b, *g = b + 300000 - 2;
}
#define pob                                                                    \
  (fwrite(fob::b, sizeof(char), fob::f - fob::b, stdout), fob::f = fob::b, 0)
#define pc(x) (*(fob::f++) = (x), (fob::f == fob::g) ? pob : 0)
struct foce {
  ~foce() {
    pob;
    fflush(stdout);
  }
} _foce;
namespace ib {
char b[100];
}
inline void out(ll x) {
  if (x == 0) {
    pc(48);
    return;
  }
  if (x < 0) {
    pc('-');
    x = -x;
  }
  char *s = ib::b;
  while (x)
    *(++s) = x % 10, x /= 10;
  while (s != ib::b)
    pc((*(s--)) + 48);
}
inline void outn(ll x) {
  out(x);
  pc('\n');
}
inline ll jdz(ll x) { return x > 0 ? x : -x; }
/*------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------*/
#define N 10001
ll a[N], n, s = 0;
int main() {
  in(n);
  Fur(i, 1, n) {
    in(a[i]);
    s += jdz(a[i] - a[i - 1]);
  }
  s += jdz(a[n]);
  Fur(i, 1, n) outn(s - jdz(a[i] - a[i - 1]) - jdz(a[i] - a[i + 1]) +
                    jdz(a[i - 1] - a[i + 1]));
}
/*

*/


Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#define ll long long
#define mx 800
#define max(x, y) ((x) > (y) ? (x) : (y))
#define min(x, y) ((x) < (y) ? (x) : (y))
#define fur(i, x, y) for (i = x; i <= y; i++)
#define fdr(i, x, y) for (i = x; i >= y; i--)
#define Fur(i, x, y) for (ll i = x; i <= y; i++)
#define Fdr(x, y) for (ll i = x; i >= y; i--)
#define in2(x, y)                                                              \
  in(x);                                                                       \
  in(y)
#define in3(x, y, z)                                                           \
  in2(x, y);                                                                   \
  in(z)
#define in4(a, b, c, d)                                                        \
  in2(a, b);                                                                   \
  in2(c, d)
#define clr(x, y) memset(x, y, sizeof(x))
using namespace std;
/*---------------------------------------*/
namespace fib {
char b[300000] = {}, *f = b;
}
#define gc                                                                     \
  ((*fib::f) ? (*(fib ::f++))                                                  \
             : (fgets(fib::b, sizeof(fib::b), stdin)                           \
                    ? (fib::f = fib::b, *(fib::f++))                           \
                    : -1))
inline void in(ll &x) {
  x = 0;
  char c;
  bool f = 0;
  while ((c = gc) > '9' || c < '0')
    if (c == '-')
      f = !f;
  x = c - 48;
  while ((c = gc) <= '9' && c >= '0')
    x = x * 10 + c - 48;
  if (f)
    x = -x;
}
namespace fob {
char b[300000] = {}, *f = b, *g = b + 300000 - 2;
}
#define pob                                                                    \
  (fwrite(fob::b, sizeof(char), fob::f - fob::b, stdout), fob::f = fob::b, 0)
#define pc(x) (*(fob::f++) = (x), (fob::f == fob::g) ? pob : 0)
struct foce {
  ~foce() {
    pob;
    fflush(stdout);
  }
} _foce;
namespace ib {
char b[100];
}
inline void out(ll x) {
  if (x == 0) {
    pc(48);
    return;
  }
  if (x < 0) {
    pc('-');
    x = -x;
  }
  char *s = ib::b;
  while (x)
    *(++s) = x % 10, x /= 10;
  while (s != ib::b)
    pc((*(s--)) + 48);
}
inline void outn(ll x) {
  out(x);
  pc('\n');
}
inline ll jdz(ll x) { return x > 0 ? x : -x; }
/*------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------*/
#define N 100011
ll a[N], n, s = 0;
int main() {
  in(n);
  Fur(i, 1, n) {
    in(a[i]);
    s += jdz(a[i] - a[i - 1]);
  }
  s += jdz(a[n]);
  Fur(i, 1, n) outn(s - jdz(a[i] - a[i - 1]) - jdz(a[i] - a[i + 1]) +
                    jdz(a[i - 1] - a[i + 1]));
}
/*

*/