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

int main() {
    int a[18], b[18];
    for(int i = 0; i < 18; i++)
        std::cin >> a[i];
    for(int i = 0; i < 18; i++)
        std::cin >> b[i];
    
    int sum_a = std::reduce(a, a + 18);
    int sum_b = std::reduce(b, b + 18);
    if(sum_a > sum_b) {
        std::cout << "Algosia";
        return 0;
    }
    if(sum_a < sum_b) {
        std::cout << "Bajtek";
        return 0;
    }
    for(int p = 10; p >= 0; p--) {
        int count_a = std::count(a, a + 18, p);
        int count_b = std::count(b, b + 18, p);
        if(count_a > count_b) {
            std::cout << "Algosia";
            return 0;
        }
        if(count_a < count_b) {
            std::cout << "Bajtek";
            return 0;
        }
    }
    std::cout << "remis";
    return 0;
}