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
45
46
47
#include<bits/stdc++.h>
using namespace std;
//#define int unsigned int

vector<int> wyn_a;
vector<int> wyn_b;
int s_a = 0;
int s_b = 0;

int32_t main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    for(int i = 0; i < 18; ++i) {
        int x;
        cin >> x;
        wyn_a.push_back(x);
        s_a += wyn_a[i];
    }
    for(int i = 0; i < 18; ++i) {
        int x;
        cin >> x;
        wyn_b.push_back(x);
        s_b += wyn_b[i];
    }
    sort(wyn_a.begin(), wyn_a.end());
    sort(wyn_b.begin(), wyn_b.end());
    if(s_a > s_b) {
        cout << "Algosia";
        return 0;
    }
    else if(s_a < s_b){
        cout << "Bajtek";
        return 0;
    }
    else {
        for(int i = wyn_a.size() - 1; i >= 0; --i) {
            if(wyn_a[i] > wyn_b[i]) {
                cout << "Algosia";
                return 0;
            }
            if(wyn_b[i] > wyn_a[i]) {
                cout << "Bajtek";
                return 0;
            }
        }
    }
    cout << "remis";
}