#define int long long #define x first #define y second
usingnamespace std;
typedef pair<int, int> PII;
constint N = 200010;
int T; int n, m; int a[N];
signedmain() { cin >> T; while (T--) { cin >> n >> m; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); reverse(a, a + n); int res = 0; for (int i = 0; i < n; i++) { if (i % 2 == 0) res += a[i]; else { int x = min(m, a[i - 1] - a[i]); res -= a[i] + x; m -= x; } } cout << res << endl; } return0; }
#define int long long #define x first #define y second
usingnamespace std;
typedef pair<int, int> PII;
constint N = 200010;
int T; int n, m; int a[N]; vector<int> s[6]; map<string, int> p;
intcheck(int x, int y, int id) { int res = 1e9; int l = 0, r = s[id].size() - 1; while (l < r) { int mid = l + r >> 1; if (s[id][mid] < x) l = mid + 1; else r = mid; } int t = s[id][l]; if (t >= x) res = min(res, max((int)0, t - y));
l = 0, r = s[id].size() - 1; while (l < r) { int mid = l + r + 1 >> 1; if (s[id][mid] <= x) l = mid; else r = mid - 1; } t = s[id][l]; if (t <= y) res = min(res, max((int)0, x - t));
return res; }
intcalc(int x, int y) { int res = 1e9; for (int i = 0; i < 6; i++) { if (i == a[x] || i == a[y]) continue; if (!s[i].size()) continue; res = min(res, check(x, y, i)); }
int T; int n; int a[N]; int p[N], d[N], cnt; int f[N];
voidinit() { for (int i = 2; i <= (N - 10); i++) { if (!d[i]) p[cnt++] = i; for (int j = 0; p[j] <= (N - 10) / i; j++) { d[p[j] * i] = p[j]; if (i % p[j] == 0) break; } } }
intdp(int x) { if (~f[x]) return f[x]; if (x <= 1) return x; if (x % 2 == 0) return0; if (d[x]) return f[x] = dp(d[x]); else { int l = 0, r = cnt - 1; while (l < r) { int mid = l + r >> 1; if (p[mid] < x) l = mid + 1; else r = mid; } return f[x] = l + 1; } }
intmain() { init();
memset(f, -1, sizeof f);
cin >> T; while (T--) { cin >> n; int res = 0; while (n--) { int x; cin >> x; res ^= dp(x); } if (res) cout << "Alice" << endl; else cout << "Bob" << endl; }