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
#include <bits/stdc++.h>
#include <cstdint>

using std::cin, std::cout;
using std::string;
using std::array;
using std::vector;
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
const char endl = '\n';

template<class num>
inline num ceildiv(num a, num b) { return (a + b - 1) / b; }

template<class num>
inline num modulo(num i, num n) { //return value >= 0
    const num k = i % n;
    return k < 0 ? k + n : k;
}



int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    const int n = 18;
    const int possible_scores = 11; // |[0, 10]| = 11

    // first element is sum, rest are number of problems solved in order of importance
    std::array<int, possible_scores + 1> bajtek_score{}, algosia_score{};

    for (int i = 1; i <= n; i++) {
        int points;
        cin >> points;

        algosia_score[0] += points;
        algosia_score[possible_scores - points]++;
    }
    for (int i = 1; i <= n; i++) {
        int points;
        cin >> points;

        bajtek_score[0] += points;
        bajtek_score[possible_scores - points]++;
    }

    if (bajtek_score == algosia_score) {
        cout << "remis";
    }
    if (bajtek_score > algosia_score) {
        cout << "Bajtek";
    }
    if (algosia_score > bajtek_score) {
        cout << "Algosia";
    }

    cout << endl;
    return 0;
}