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<iostream>
#include<vector>
using namespace std;

int main() {
    int n = 18, m = 11, alsum = 0, basum = 0;
    vector<int> al(m), ba(m);
    
    for (int i = 0, e; i < n; i++) {
        cin >> e;
        al[e]++;
        alsum += e;
    }
    
    for (int i = 0, e; i < n; i++) {
        cin >> e;
        ba[e]++;
        basum += e;
    }
    
    if (alsum > basum) {
        cout << "Algosia" << endl;
        return 0;
    }
    else if (alsum < basum) {
        cout << "Bajtek" << endl;
        return 0;
    }
    else {
        for (int i = m - 1; i > 0; i--) {
            if (al[i] > ba[i]) {
                cout << "Algosia" << endl;
                return 0;
            }
            if (al[i] < ba[i]) {
                cout << "Bajtek" << endl;
                return 0;
            }
        }
    }
    cout << "remis" << endl;

    return 0;
}