Problem p02963 (C++)

Buggy submission (status: Runtime Error):
// #define DEB1 //output check function
// #define DEB2 //same output, input from input.txt

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <mutex>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <thread>
#include <vector>

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define ALL(t) (t).begin(), (t).end()
#define FILL(a, c) fill(a, a + sizeof(a) / sizeof(*a), c)
#define FILL2D(A, c) fill(A[0], A[0] + sizeof(A) / sizeof(**A), c)
#define FILL3D(A, c) fill(A[0][0], A[0][0] + sizeof(A) / sizeof(***A), c)
#define REP(i, m) for (int i = 0; i < (m); ++i)
#define REPN(i, m, in) for (int i = (in); i < (m); ++i)
#define IN(a, x, b) (a <= x && x < b)
#define PB push_back

using namespace std;

using LL = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<LL, LL>;
using VI = vector<int>;
using VVI = vector<VI>;

template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

#ifdef DEB1
#define DPRINT(x) cout << #x << "=" << (x) << endl; // print at debug mode
#else
#define DPRINT(x) ;
#endif
#ifdef DEB1
#define DCHECK(x) cout << "debug check" << #x << endl;
#else
#define DCHECK(x) ;
#endif

/*
constant values
*/

// const int dx[] = {1,0,-1,0};
// const int dy[] = {0,1,0,-1};
// const int MX = 31001;

// const LL INF= 1LL<<60 ;//INF = 1001001001001; //1e9

// Main program
void solve() {
  string S;
  cin >> S;
  int size = S.size();
  DPRINT(size)
  if (size == 19) {
    cout << "0 0 1000000000 0 0 1000000000 " << endl;
    return;
  }
  if (size < 9) {
    cout << "0 0 1 0 0 " + S << endl;
    return;
  } else {
    string left, right;

    right = S.substr(size - 9, 9);
    left = S.substr(0, size - 9);
    DPRINT(left)
    LL iright = stoi(right);
    LL ileft = stoi(left);
    LL b1 = 1000000000 - iright;
    LL b2 = ileft + 1;
    cout << "0 0 1000000000 1 " << b1 << " " << b2 << endl;
    // LL check;
    // check = 1000000000 - b1;
    // DPRINT(check)
  }
}

// ----------------------------------------------
int main() {

#ifdef DEB2
  cout << "DEBUG MODE" << endl;
  ifstream in("input.txt"); // for debug
  cin.rdbuf(in.rdbuf());    // for debug
#endif

  int T = 1;

  for (int i = 0; i < T; ++i) {
    solve();
  }
}

Fixed submission:
// #define DEB1 //output check function
// #define DEB2 //same output, input from input.txt

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <mutex>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <thread>
#include <vector>

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define ALL(t) (t).begin(), (t).end()
#define FILL(a, c) fill(a, a + sizeof(a) / sizeof(*a), c)
#define FILL2D(A, c) fill(A[0], A[0] + sizeof(A) / sizeof(**A), c)
#define FILL3D(A, c) fill(A[0][0], A[0][0] + sizeof(A) / sizeof(***A), c)
#define REP(i, m) for (int i = 0; i < (m); ++i)
#define REPN(i, m, in) for (int i = (in); i < (m); ++i)
#define IN(a, x, b) (a <= x && x < b)
#define PB push_back

using namespace std;

using LL = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<LL, LL>;
using VI = vector<int>;
using VVI = vector<VI>;

template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

#ifdef DEB1
#define DPRINT(x) cout << #x << "=" << (x) << endl; // print at debug mode
#else
#define DPRINT(x) ;
#endif
#ifdef DEB1
#define DCHECK(x) cout << "debug check" << #x << endl;
#else
#define DCHECK(x) ;
#endif

/*
constant values
*/

// const int dx[] = {1,0,-1,0};
// const int dy[] = {0,1,0,-1};
// const int MX = 31001;

// const LL INF= 1LL<<60 ;//INF = 1001001001001; //1e9

// Main program
void solve() {
  string S;
  cin >> S;
  int size = S.size();
  DPRINT(size)
  if (size == 19) {
    cout << "0 0 1000000000 0 0 1000000000 " << endl;
    return;
  }
  if (size < 10) {
    cout << "0 0 1 0 0 " + S << endl;
    return;
  } else {
    string left, right;

    right = S.substr(size - 9, 9);
    left = S.substr(0, size - 9);
    DPRINT(left)
    LL iright = stoi(right);
    LL ileft = stoi(left);
    LL b1 = 1000000000 - iright;
    LL b2 = ileft + 1;
    cout << "0 0 1000000000 1 " << b1 << " " << b2 << endl;
    // LL check;
    // check = 1000000000 - b1;
    // DPRINT(check)
  }
}

// ----------------------------------------------
int main() {

#ifdef DEB2
  cout << "DEBUG MODE" << endl;
  ifstream in("input.txt"); // for debug
  cin.rdbuf(in.rdbuf());    // for debug
#endif

  int T = 1;

  for (int i = 0; i < T; ++i) {
    solve();
  }
}