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
#include <iostream>
#include <vector>

void solve() {
    std::vector<int> cntA(11), cntB(11);
    int sumA = 0, sumB = 0;

    for (int i = 0; i < 18; i++) {
        int res;
        std::cin >> res;
        cntA[res]++;
        sumA += res;
    }

    for (int i = 0; i < 18; i++) {
        int res;
        std::cin >> res;
        cntB[res]++;
        sumB += res;
    }

    if (sumA > sumB) std::cout << "Algosia\n";
    else if (sumA < sumB) std::cout << "Bajtek\n";
    else {
        bool draw = true;
        for (int i = 10; i > 0; i--) {
            if (cntA[i] > cntB[i]) { std::cout << "Algosia\n"; draw = false; break; }
            if (cntA[i] < cntB[i]) { std::cout << "Bajtek\n"; draw = false; break; }
        }
        if (draw) std::cout << "remis\n";
    }
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);

    solve();

    return 0;
}