Problem p02720 (C++) — buggy submission, verdict: Runtime Error

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

int64_t push1(int64_t x) {
  int64_t a = x % 10 - 1;
  if (a == -1)
    return 5000000000;
  else
    return 10 * x + a;
}
int64_t push2(int64_t x) {
  int64_t a = x % 10;
  return 10 * x + a;
}
int64_t push3(int64_t x) {
  int64_t a = x % 10 + 1;
  if (a == 10)
    return 50000000000;
  else
    return 10 * x + a;
}

int main() {
  vector<int64_t> vec, vec2, vec3, vec4, vec5, vec6, vec7, vec8, vec9, vec10;
  rep(i, 9) {
    vec.push_back(push1(i + 1));
    vec.push_back(push2(i + 1));
    vec.push_back(push3(i + 1));
  }
  for (int64_t i : vec) {
    vec2.push_back(push1(i));
    vec2.push_back(push2(i));
    vec2.push_back(push3(i));
  }
  for (int64_t i : vec2) {
    vec3.push_back(push1(i));
    vec3.push_back(push2(i));
    vec3.push_back(push3(i));
  }
  for (int64_t i : vec3) {
    vec4.push_back(push1(i));
    vec4.push_back(push2(i));
    vec4.push_back(push3(i));
  }
  for (int64_t i : vec4) {
    vec5.push_back(push1(i));
    vec5.push_back(push2(i));
    vec5.push_back(push3(i));
  }
  for (int64_t i : vec5) {
    vec6.push_back(push1(i));
    vec6.push_back(push2(i));
    vec6.push_back(push3(i));
  }
  for (int64_t i : vec6) {
    vec7.push_back(push1(i));
    vec7.push_back(push2(i));
    vec7.push_back(push3(i));
  }
  for (int64_t i : vec7) {
    vec8.push_back(push1(i));
    vec8.push_back(push2(i));
    vec8.push_back(push3(i));
  }
  for (int64_t i : vec8) {
    vec9.push_back(push1(i));
    vec9.push_back(push2(i));
    vec9.push_back(push3(i));
  }
  vec10 = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  vector<int64_t> fial;
  for (int64_t x : vec10)
    fial.push_back(x);
  for (int64_t x : vec)
    fial.push_back(x);
  for (int64_t x : vec2)
    fial.push_back(x);
  for (int64_t x : vec3)
    fial.push_back(x);
  for (int64_t x : vec4)
    fial.push_back(x);
  for (int64_t x : vec5)
    fial.push_back(x);
  for (int64_t x : vec6)
    fial.push_back(x);
  for (int64_t x : vec7)
    fial.push_back(x);
  for (int64_t x : vec8)
    fial.push_back(x);
  for (int64_t x : vec9)
    fial.push_back(x);
  sort(fial.begin(), fial.end());

  int k;
  cin >> k;
  cout << fial.at(k - 1) << endl;
}


Error: -11

Fixed submission:

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

int64_t push1(int x) {
  int a = x / 10 - 1;
  if (a = 9)
    return 100000000000;
  else
    return 10 * x + a;
}
int64_t push2(int x) {
  int a = x / 10;
  return 10 * x + a;
}
int64_t push3(int x) {
  int a = x / 10 + 1;
  if (a = 10)
    return 100000000000;
  else
    return 10 * x + a;
}

int main() {
  vector<int64_t> vec, vec2, vec3, vec4, vec5, vec6, vec7, vec8, vec9, vec10;
  rep(i, 9) {
    vec.push_back(push1(i));
    vec.push_back(push2(i));
    vec.push_back(push3(i));
  }
  for (int i : vec) {
    vec2.push_back(push1(i));
    vec2.push_back(push2(i));
    vec2.push_back(push3(i));
  }
  for (int i : vec2) {
    vec3.push_back(push1(i));
    vec3.push_back(push2(i));
    vec3.push_back(push3(i));
  }
  for (int i : vec3) {
    vec4.push_back(push1(i));
    vec4.push_back(push2(i));
    vec4.push_back(push3(i));
  }
  for (int i : vec4) {
    vec5.push_back(push1(i));
    vec5.push_back(push2(i));
    vec5.push_back(push3(i));
  }
  for (int i : vec5) {
    vec6.push_back(push1(i));
    vec6.push_back(push2(i));
    vec6.push_back(push3(i));
  }
  for (int i : vec6) {
    vec7.push_back(push1(i));
    vec7.push_back(push2(i));
    vec7.push_back(push3(i));
  }
  for (int i : vec7) {
    vec8.push_back(push1(i));
    vec8.push_back(push2(i));
    vec8.push_back(push3(i));
  }
  for (int i : vec8) {
    vec9.push_back(push1(i));
    vec9.push_back(push2(i));
    vec9.push_back(push3(i));
  }
  vec10 = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  vector<int64_t> fial;
  for (int x : vec10)
    vec.push_back(x);
  for (int x : vec)
    vec.push_back(x);
  for (int x : vec2)
    vec.push_back(x);
  for (int x : vec3)
    vec.push_back(x);
  for (int x : vec4)
    vec.push_back(x);
  for (int x : vec5)
    vec.push_back(x);
  for (int x : vec6)
    vec.push_back(x);
  for (int x : vec7)
    vec.push_back(x);
  for (int x : vec8)
    vec.push_back(x);
  for (int x : vec9)
    vec.push_back(x);
  sort(fial.begin(), fial.end());

  int k;
  cin >> k;
  cout << fial[k - 1] << endl;
}