#include using namespace std; typedef long long ll; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b #define vl vector #define vii vector> #define vll vector> #define vvi vector> #define vvl vector> #define vvii vector>> #define vvll vector>> #define vst vector #define pii pair #define pll pair #define pb push_back #define all(x) (x).begin(),(x).end() #define mkunique(x) sort(all(x));(x).erase(unique(all(x)),(x).end()) #define fi first #define se second #define mp make_pair #define si(x) int(x.size()) const int mod=998244353,MAX=300005,INF=15<<26; //fastset // https://www.dropbox.com/s/1zxohqaxrb87uft/Gifted_Infants_The_University_of_Tokyo___erated_files-job_14.pdf?dl=0 using uint = unsigned int ; using ll = long long ; using ull = unsigned long long ; template < class T > using V = vector ; template < class T > using VV = V >; int popcnt ( uint x ) { return __builtin_popcount(x); } int popcnt ( ull x ) { return __builtin_popcountll(x); } int bsr ( uint x ) { return 31 - __builtin_clz(x); } int bsr ( ull x ) { return 63 - __builtin_clzll(x); } int bsf ( uint x ) { return __builtin_ctz(x); } int bsf ( ull x ) { return __builtin_ctzll(x); } struct FastSet { static constexpr uint B = 64 ; int n, lg; VV seg; FastSet( int _n) : n(_n) { do { seg.push_back(V((_n + B - 1 ) / B)); _n = (_n + B - 1 ) / B; }while (_n > 1 ); lg = seg.size(); } bool operator []( int i) const { return (seg[ 0 ][i / B] >> (i % B) & 1 ) != 0 ; } void set ( int i) { for ( int h = 0 ; h < lg; h++) { seg[h][i / B] |= 1ULL << (i % B); i /= B; } } void reset ( int i) { for ( int h = 0 ; h < lg; h++) { seg[h][i / B] &= ~( 1ULL << (i % B)); if (seg[h][i / B]) break ; i /= B; } } int next ( int i) { if (i < 0) i = 0; if (i > n) i = n; for ( int h = 0 ; h < lg; h++) { if (i / B == seg[h].size()) break ; ull d = seg[h][i / B] >> (i % B); if (!d) { i = i / B + 1 ; continue ; } i += bsf(d); for ( int g = h - 1 ; g >= 0 ; g--) { i *= B; i += bsf(seg[g][i / B]); } return i; } return n; } // i以上 int prev ( int i) { if (i < 0) i = 0; if (i > n) i = n; i--; for ( int h = 0 ; h < lg; h++) { if (i == -1 ) break ; ull d = seg[h][i / B] << ( 63 - i % 64 ); if (!d) { i = i / B - 1 ; continue ; } i += bsr(d) - (B - 1 ); for ( int g = h - 1 ; g >= 0 ; g--) { i *= B; i += bsr(seg[g][i / B]); } return i; } return -1 ; } // i未満 }; int main(){ std::ifstream in("text.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); ll N;cin>>N; ll X;cin>>X; vl S(N+1); for(int i=0;i>x; S[i+1]=S[i]+x; } vector L(N+1,FastSet(N+1)),R(N+1,FastSet(N+1)); for(int i=0;i=l&&S[r]-S[x]<=X) ok=true; } { int x=R[r].next(l); if(x<=r&&S[x]-S[l]<=X) ok=true; } if(!ok){ L[l].set(r); R[r].set(l); } } } if(L[0][N]) cout<<"B\n"; else cout<<"A\n"; }