1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// https://sio2.mimuw.edu.pl/c/pa-2024-1/p/kto/
#include <bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rep(i, a) for (int i = 0; i < (a); i++)
#define rep1(i, a) for (int i = 1; i <= (a); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
const int MAX_N = 20;
int tab[2][20];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int sum[2] = {0, 0};
    for (int j = 0; j < 2; j++) {
        for (int i = 0; i < 18; i++) {
            int x;
            cin >> x;
            sum[j] += x;
            tab[j][x]++;
        }
    }
    if (sum[0] > sum[1])
        cout << "Algosia\n";
    else if (sum[0] != sum[1])
        cout << "Bajtek\n";
    else {
        for (int i = 10; i > 0; i--) {
            if (tab[0][i] > tab[1][i]) {
                cout << "Algosia\n";
                return 0;
            } else if (tab[0][i] < tab[1][i]) {
                cout << "Bajtek\n";
                return 0;
            }
        }
        cout << "remis\n";
    }
}