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
#include <algorithm>
#include <iostream>
#include <vector>

int main()
{
    std::vector<int> a_scores(18), b_scores(18);
    int a_sum = 0, b_sum = 0;
    for (int i = 0; i < 18; ++i) {
        std::cin >> a_scores[i];
        a_sum += a_scores[i];
    }
    for (int i = 0; i < 18; ++i) {
        std::cin >> b_scores[i];
        b_sum += b_scores[i];
    }
    if (a_sum != b_sum) {
        std::cout << (a_sum > b_sum ? "Algosia" : "Bajtek") << std::endl;
        return 0;
    }

    std::sort(a_scores.begin(), a_scores.end());
    std::sort(b_scores.begin(), b_scores.end());
    for (int i = 17; i >= 0; --i) {
        if (a_scores[i] != b_scores[i]) {
            std::cout << (a_scores[i] > b_scores[i] ? "Algosia" : "Bajtek") << std::endl;
            return 0;
        }
    }

    std::cout << "remis" << std::endl;
    return 0;
}