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

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

    vector<int> a(18), b(18);
    for (int i = 0; i < 18; i++) cin >> a[i];
    for (int i = 0; i < 18; i++) cin >> b[i];

    int sumA = 0, sumB = 0;
    for (auto i : a) sumA += i;
    for (auto i : b) sumB += i;
    if (sumA > sumB) { cout << "Algosia\n"; return 0; }
    else if (sumB > sumA) { cout << "Bajtek\n"; return 0; }

    for (int i = 10; i > 0; i--) {
        int countA = 0, countB = 0;
        for (auto elem : a) { if (elem == i) countA++; }
        for (auto elem : b) { if (elem == i) countB++; }
        if (countA > countB) { cout << "Algosia\n"; return 0; }
        else if (countB > countA) { cout << "Bajtek\n"; return 0; }
    }

    cout << "remis\n";
    return 0;
}