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
43
44
#include<bits/stdc++.h>
using namespace std;

void solve() {
    vector<int> cnt_A(11, 0), cnt_B(11, 0);
    int sum_A = 0, sum_B = 0;
    for(int i = 0; i < 18; i++) {
        int x; cin >> x;
        sum_A += x;
        cnt_A[x]++;
    }
    for(int i = 0; i < 18; i++) {
        int x; cin >> x;
        sum_B += x;
        cnt_B[x]++;
    }
    if(sum_A > sum_B) {
        cout << "Algosia\n";
        return;
    } else if(sum_A < sum_B) {
        cout << "Bajtek\n";
        return;
    } else {
        for(int i = 10; i >= 0; i--) {
            if(cnt_A[i] > cnt_B[i]) {
                cout << "Algosia\n";
                return;
            } else if(cnt_A[i] < cnt_B[i]) {
                cout << "Bajtek\n";
                return;
            }
        }
    }
    cout << "remis\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1; //cin >> t;
    while(t--) solve();
    return 0;
}