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;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 18;

void solve() {
    int n=18;

    int c[n]={}, sa=0, sb=0;
    for (int i=0; i<n; ++i) {
        int x; cin>>x;
        ++c[x]; sa+=x;
    }

    for (int i=0; i<n; ++i) {
        int x; cin>>x;
        --c[x], sb+=x;
    }

    if (sa > sb) cout<<"Algosia\n";
    else if (sa < sb) cout<<"Bajtek";
    else {
        for (int i=10; i>=0; --i) {
            if (c[i] == 0) continue;
            if (c[i] > 0) {
                cout<<"Algosia\n";
                return;
            } else {
                cout<<"Bajtek\n";
                return;
            }
        } cout<<"remis\n";
    }
}

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

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