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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define pii pair<int,int>
#define pb push_back
#define pf push_front
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define endl "\n"
#define in(x) cin >> x
#define ini(x) int x; in(x)
#define instr(x) string x; in(x)

#define inf 1e18

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int sum1 = 0;
    vector<int> vec1;
    for (int i = 0; i < 18; i++) {
        ini(a);
        vec1.pb(a);

        sum1 += a;
    }

    int sum2 = 0;
    vector<int> vec2;
    for (int i = 0; i < 18; i++) {
        ini(a);
        vec2.pb(a);

        sum2 += a;
    }

    if (sum1 > sum2) {
        cout << "Algosia" << endl;
    } else if (sum1 < sum2) {
        cout << "Bajtek" << endl;
    } else {
        vector<int> by_points1(11);
        vector<int> by_points2(11);

        for (int i : vec1) {
            by_points1[i]++;
        }

        for (int i : vec2) {
            by_points2[i]++;
        }

        for (int i = 10; i >= 0; i--) {
            if (by_points1[i] > by_points2[i]) {
                cout << "Algosia" << endl;
                return 0;
            } else if (by_points1[i] < by_points2[i]) {
                cout << "Bajtek" << endl;
                return 0;
            }
        }

        cout << "remis" << endl;
    }
}