Problem p03463 (C++)

Buggy submission (status: Time Limit Exceeded):
// https://atcoder.jp/contests/agc020/tasks/agc020_a
// INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
// DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a) (a).begin(), (a).end()
#define ALL(a, n) (a), (a) + n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
#define dcml(n) fixed << setprecision(n)
// CONST
//------------------------------------------
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;
const ld EPS = 1e-12;
const ld PI = 3.14159265358979323846;
// REPEAT
//------------------------------------------
#define FOR(i, m, n) for (ll(i) = (m); (i) < (n); (i)++)
#define FORS(i, m, n) for (ll(i) = (m); (i) <= (n); (i)++)
#define RFOR(i, m, n) for (ll(i) = (n)-1; (i) >= (n); (i)--)
#define RFORS(i, m, n) for (ll(i) = (n); (i) > (n); (i)--)
#define REP(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define REPS(i, x) for (ll(i) = 1; (i) <= (x); (i)++)
#define RREP(i, x) for (ll(i) = (x)-1; (i) >= 0; (i)--)
#define RREPS(i, x) for (ll(i) = (x); (i) > 0; (i)--)
#define WREP(i, in, j, jn) REP(i, in) REP(j, jn)
#define WREPS(i, in, j, jn) REPS(i, in) REPS(j, jn)
//-----------------------------------------
// namespace
using namespace std;
// ライブラリはここに
// ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

//-----------------------------------------
int main(void) {
  ll N;
  cin >> N;
  ll a, b;
  cin >> a >> b;
  while (true) {
    if (a + 1 != b)
      a++;
    else
      a--;
    if (a == 0) {
      cout << "Borys\n";
      return 0;
    }

    if (b - 1 != a)
      b--;
    else
      b++;
    if (b == N) {
      cout << "Alice\n";
      return 0;
    }
  }
}

Fixed submission:
// https://atcoder.jp/contests/agc020/tasks/agc020_a
// INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
// DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a) (a).begin(), (a).end()
#define ALL(a, n) (a), (a) + n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
#define dcml(n) fixed << setprecision(n)
// CONST
//------------------------------------------
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;
const ld EPS = 1e-12;
const ld PI = 3.14159265358979323846;
// REPEAT
//------------------------------------------
#define FOR(i, m, n) for (ll(i) = (m); (i) < (n); (i)++)
#define FORS(i, m, n) for (ll(i) = (m); (i) <= (n); (i)++)
#define RFOR(i, m, n) for (ll(i) = (n)-1; (i) >= (n); (i)--)
#define RFORS(i, m, n) for (ll(i) = (n); (i) > (n); (i)--)
#define REP(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define REPS(i, x) for (ll(i) = 1; (i) <= (x); (i)++)
#define RREP(i, x) for (ll(i) = (x)-1; (i) >= 0; (i)--)
#define RREPS(i, x) for (ll(i) = (x); (i) > 0; (i)--)
#define WREP(i, in, j, jn) REP(i, in) REP(j, jn)
#define WREPS(i, in, j, jn) REPS(i, in) REPS(j, jn)
//-----------------------------------------
// namespace
using namespace std;
// ライブラリはここに
// ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

//-----------------------------------------
int main(void) {
  ll N;
  cin >> N;
  ll a, b;
  cin >> a >> b;
  while (true) {
    if (a + 1 != b)
      a++;
    else
      a--;
    if (a == 0) {
      cout << "Borys\n";
      return 0;
    }

    if (b - 1 != a)
      b--;
    else
      b++;
    if (b == N + 1) {
      cout << "Alice\n";
      return 0;
    }
  }
}